From 971730b33ee2182497560cdc19aac1673d7a02ce Mon Sep 17 00:00:00 2001 From: Matt Behrens Date: Mon, 23 Dec 2024 10:05:52 -0800 Subject: [PATCH] update to remove model code --- .openapi-generator/FILES | 1 - Cargo.toml | 3 - regen.bash | 13 +- rustfmt.toml | 1 + src/apis/admissionregistration_api.rs | 62 - src/apis/admissionregistration_v1_api.rs | 1994 --- .../admissionregistration_v1alpha1_api.rs | 1110 -- src/apis/admissionregistration_v1beta1_api.rs | 1110 -- src/apis/apiextensions_api.rs | 62 - src/apis/apiextensions_v1_api.rs | 668 - src/apis/apiregistration_api.rs | 62 - src/apis/apiregistration_v1_api.rs | 668 - src/apis/apis_api.rs | 62 - src/apis/apps_api.rs | 62 - src/apis/apps_v1_api.rs | 3805 ----- src/apis/authentication_api.rs | 62 - src/apis/authentication_v1_api.rs | 176 - src/apis/authentication_v1alpha1_api.rs | 119 - src/apis/authentication_v1beta1_api.rs | 119 - src/apis/authorization_api.rs | 62 - src/apis/authorization_v1_api.rs | 290 - src/apis/autoscaling_api.rs | 62 - src/apis/autoscaling_v1_api.rs | 745 - src/apis/autoscaling_v2_api.rs | 745 - src/apis/batch_api.rs | 62 - src/apis/batch_v1_api.rs | 1428 -- src/apis/certificates_api.rs | 62 - src/apis/certificates_v1_api.rs | 832 -- src/apis/certificates_v1alpha1_api.rs | 504 - src/apis/configuration.rs | 52 - src/apis/coordination_api.rs | 62 - src/apis/coordination_v1_api.rs | 581 - src/apis/coordination_v1alpha1_api.rs | 581 - src/apis/core_api.rs | 62 - src/apis/core_v1_api.rs | 11962 ---------------- src/apis/custom_objects_api.rs | 1571 -- src/apis/discovery_api.rs | 62 - src/apis/discovery_v1_api.rs | 581 - src/apis/events_api.rs | 62 - src/apis/events_v1_api.rs | 581 - src/apis/flowcontrol_apiserver_api.rs | 62 - src/apis/flowcontrol_apiserver_v1_api.rs | 1274 -- src/apis/flowcontrol_apiserver_v1beta3_api.rs | 1274 -- src/apis/internal_apiserver_api.rs | 62 - src/apis/internal_apiserver_v1alpha1_api.rs | 668 - src/apis/logs_api.rs | 104 - src/apis/mod.rs | 128 - src/apis/networking_api.rs | 62 - src/apis/networking_v1_api.rs | 1706 --- src/apis/networking_v1beta1_api.rs | 1110 -- src/apis/node_api.rs | 62 - src/apis/node_v1_api.rs | 504 - src/apis/openid_api.rs | 62 - src/apis/policy_api.rs | 62 - src/apis/policy_v1_api.rs | 745 - src/apis/rbac_authorization_api.rs | 62 - src/apis/rbac_authorization_v1_api.rs | 1984 --- src/apis/resource_api.rs | 62 - src/apis/resource_v1alpha3_api.rs | 2831 ---- src/apis/scheduling_api.rs | 62 - src/apis/scheduling_v1_api.rs | 504 - src/apis/storage_api.rs | 62 - src/apis/storage_v1_api.rs | 2513 ---- src/apis/storage_v1alpha1_api.rs | 504 - src/apis/storage_v1beta1_api.rs | 504 - src/apis/storagemigration_api.rs | 62 - src/apis/storagemigration_v1alpha1_api.rs | 668 - src/apis/version_api.rs | 62 - src/apis/well_known_api.rs | 62 - src/lib.rs | 2 - 70 files changed, 11 insertions(+), 48926 deletions(-) create mode 100644 rustfmt.toml delete mode 100644 src/apis/admissionregistration_api.rs delete mode 100644 src/apis/admissionregistration_v1_api.rs delete mode 100644 src/apis/admissionregistration_v1alpha1_api.rs delete mode 100644 src/apis/admissionregistration_v1beta1_api.rs delete mode 100644 src/apis/apiextensions_api.rs delete mode 100644 src/apis/apiextensions_v1_api.rs delete mode 100644 src/apis/apiregistration_api.rs delete mode 100644 src/apis/apiregistration_v1_api.rs delete mode 100644 src/apis/apis_api.rs delete mode 100644 src/apis/apps_api.rs delete mode 100644 src/apis/apps_v1_api.rs delete mode 100644 src/apis/authentication_api.rs delete mode 100644 src/apis/authentication_v1_api.rs delete mode 100644 src/apis/authentication_v1alpha1_api.rs delete mode 100644 src/apis/authentication_v1beta1_api.rs delete mode 100644 src/apis/authorization_api.rs delete mode 100644 src/apis/authorization_v1_api.rs delete mode 100644 src/apis/autoscaling_api.rs delete mode 100644 src/apis/autoscaling_v1_api.rs delete mode 100644 src/apis/autoscaling_v2_api.rs delete mode 100644 src/apis/batch_api.rs delete mode 100644 src/apis/batch_v1_api.rs delete mode 100644 src/apis/certificates_api.rs delete mode 100644 src/apis/certificates_v1_api.rs delete mode 100644 src/apis/certificates_v1alpha1_api.rs delete mode 100644 src/apis/configuration.rs delete mode 100644 src/apis/coordination_api.rs delete mode 100644 src/apis/coordination_v1_api.rs delete mode 100644 src/apis/coordination_v1alpha1_api.rs delete mode 100644 src/apis/core_api.rs delete mode 100644 src/apis/core_v1_api.rs delete mode 100644 src/apis/custom_objects_api.rs delete mode 100644 src/apis/discovery_api.rs delete mode 100644 src/apis/discovery_v1_api.rs delete mode 100644 src/apis/events_api.rs delete mode 100644 src/apis/events_v1_api.rs delete mode 100644 src/apis/flowcontrol_apiserver_api.rs delete mode 100644 src/apis/flowcontrol_apiserver_v1_api.rs delete mode 100644 src/apis/flowcontrol_apiserver_v1beta3_api.rs delete mode 100644 src/apis/internal_apiserver_api.rs delete mode 100644 src/apis/internal_apiserver_v1alpha1_api.rs delete mode 100644 src/apis/logs_api.rs delete mode 100644 src/apis/mod.rs delete mode 100644 src/apis/networking_api.rs delete mode 100644 src/apis/networking_v1_api.rs delete mode 100644 src/apis/networking_v1beta1_api.rs delete mode 100644 src/apis/node_api.rs delete mode 100644 src/apis/node_v1_api.rs delete mode 100644 src/apis/openid_api.rs delete mode 100644 src/apis/policy_api.rs delete mode 100644 src/apis/policy_v1_api.rs delete mode 100644 src/apis/rbac_authorization_api.rs delete mode 100644 src/apis/rbac_authorization_v1_api.rs delete mode 100644 src/apis/resource_api.rs delete mode 100644 src/apis/resource_v1alpha3_api.rs delete mode 100644 src/apis/scheduling_api.rs delete mode 100644 src/apis/scheduling_v1_api.rs delete mode 100644 src/apis/storage_api.rs delete mode 100644 src/apis/storage_v1_api.rs delete mode 100644 src/apis/storage_v1alpha1_api.rs delete mode 100644 src/apis/storage_v1beta1_api.rs delete mode 100644 src/apis/storagemigration_api.rs delete mode 100644 src/apis/storagemigration_v1alpha1_api.rs delete mode 100644 src/apis/version_api.rs delete mode 100644 src/apis/well_known_api.rs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 79c2139..008edee 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml Cargo.toml README.md diff --git a/Cargo.toml b/Cargo.toml index 23849b3..8cbe054 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,5 @@ serde = "^1.0" serde_derive = "^1.0" serde_json = "^1.0" url = "^2.2" -[dependencies.reqwest] -version = "^0.11" -features = ["json", "multipart"] [dev-dependencies] diff --git a/regen.bash b/regen.bash index a986d98..ada858d 100755 --- a/regen.bash +++ b/regen.bash @@ -43,10 +43,17 @@ rm -rf "${gen_dir}" # Remove unnecessary files generated by openapi-generator. rm -rf .travis.yml swagger.json swagger.json.unprocessed git_push.sh +# Delete api code +rm -r src/apis +sed -i '' '/pub mod apis;/d' "src/lib.rs" +sed -i '' '/extern crate reqwest;/d' "src/lib.rs" +cargo remove reqwest + +# Remove empty doc comments +sed -i '' '/^[[:space:]]*\/\/\/[[:space:]]*$/d' src/models/*.rs + # Do not format generated code. -cat > rustfmt.toml < rustfmt.toml cargo build diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..248fb36 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +ignore = ["/"] diff --git a/src/apis/admissionregistration_api.rs b/src/apis/admissionregistration_api.rs deleted file mode 100644 index eee6c1d..0000000 --- a/src/apis/admissionregistration_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/admissionregistration_v1_api.rs b/src/apis/admissionregistration_v1_api.rs deleted file mode 100644 index 69a7338..0000000 --- a/src/apis/admissionregistration_v1_api.rs +++ /dev/null @@ -1,1994 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_mutating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceMutatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_webhook_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingWebhookConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a MutatingWebhookConfiguration -pub async fn create_mutating_webhook_configuration(configuration: &configuration::Configuration, body: crate::models::V1MutatingWebhookConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ValidatingAdmissionPolicy -pub async fn create_validating_admission_policy(configuration: &configuration::Configuration, body: crate::models::V1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ValidatingAdmissionPolicyBinding -pub async fn create_validating_admission_policy_binding(configuration: &configuration::Configuration, body: crate::models::V1ValidatingAdmissionPolicyBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ValidatingWebhookConfiguration -pub async fn create_validating_webhook_configuration(configuration: &configuration::Configuration, body: crate::models::V1ValidatingWebhookConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of MutatingWebhookConfiguration -pub async fn delete_collection_mutating_webhook_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingAdmissionPolicy -pub async fn delete_collection_validating_admission_policy(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingAdmissionPolicyBinding -pub async fn delete_collection_validating_admission_policy_binding(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingWebhookConfiguration -pub async fn delete_collection_validating_webhook_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a MutatingWebhookConfiguration -pub async fn delete_mutating_webhook_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingAdmissionPolicy -pub async fn delete_validating_admission_policy(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingAdmissionPolicyBinding -pub async fn delete_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingWebhookConfiguration -pub async fn delete_validating_webhook_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind MutatingWebhookConfiguration -pub async fn list_mutating_webhook_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingAdmissionPolicy -pub async fn list_validating_admission_policy(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingAdmissionPolicyBinding -pub async fn list_validating_admission_policy_binding(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingWebhookConfiguration -pub async fn list_validating_webhook_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified MutatingWebhookConfiguration -pub async fn patch_mutating_webhook_configuration(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingAdmissionPolicy -pub async fn patch_validating_admission_policy(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingAdmissionPolicyBinding -pub async fn patch_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ValidatingAdmissionPolicy -pub async fn patch_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingWebhookConfiguration -pub async fn patch_validating_webhook_configuration(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified MutatingWebhookConfiguration -pub async fn read_mutating_webhook_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingAdmissionPolicy -pub async fn read_validating_admission_policy(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingAdmissionPolicyBinding -pub async fn read_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ValidatingAdmissionPolicy -pub async fn read_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingWebhookConfiguration -pub async fn read_validating_webhook_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified MutatingWebhookConfiguration -pub async fn replace_mutating_webhook_configuration(configuration: &configuration::Configuration, name: &str, body: crate::models::V1MutatingWebhookConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingAdmissionPolicy -pub async fn replace_validating_admission_policy(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingAdmissionPolicyBinding -pub async fn replace_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ValidatingAdmissionPolicyBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ValidatingAdmissionPolicy -pub async fn replace_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingWebhookConfiguration -pub async fn replace_validating_webhook_configuration(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ValidatingWebhookConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/admissionregistration_v1alpha1_api.rs b/src/apis/admissionregistration_v1alpha1_api.rs deleted file mode 100644 index 72aa4a6..0000000 --- a/src/apis/admissionregistration_v1alpha1_api.rs +++ /dev/null @@ -1,1110 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a ValidatingAdmissionPolicy -pub async fn create_validating_admission_policy(configuration: &configuration::Configuration, body: crate::models::V1alpha1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ValidatingAdmissionPolicyBinding -pub async fn create_validating_admission_policy_binding(configuration: &configuration::Configuration, body: crate::models::V1alpha1ValidatingAdmissionPolicyBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingAdmissionPolicy -pub async fn delete_collection_validating_admission_policy(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingAdmissionPolicyBinding -pub async fn delete_collection_validating_admission_policy_binding(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingAdmissionPolicy -pub async fn delete_validating_admission_policy(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingAdmissionPolicyBinding -pub async fn delete_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingAdmissionPolicy -pub async fn list_validating_admission_policy(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingAdmissionPolicyBinding -pub async fn list_validating_admission_policy_binding(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingAdmissionPolicy -pub async fn patch_validating_admission_policy(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingAdmissionPolicyBinding -pub async fn patch_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ValidatingAdmissionPolicy -pub async fn patch_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingAdmissionPolicy -pub async fn read_validating_admission_policy(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingAdmissionPolicyBinding -pub async fn read_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ValidatingAdmissionPolicy -pub async fn read_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingAdmissionPolicy -pub async fn replace_validating_admission_policy(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingAdmissionPolicyBinding -pub async fn replace_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1ValidatingAdmissionPolicyBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ValidatingAdmissionPolicy -pub async fn replace_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/admissionregistration_v1beta1_api.rs b/src/apis/admissionregistration_v1beta1_api.rs deleted file mode 100644 index 6530edc..0000000 --- a/src/apis/admissionregistration_v1beta1_api.rs +++ /dev/null @@ -1,1110 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_validating_admission_policy_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceValidatingAdmissionPolicyStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a ValidatingAdmissionPolicy -pub async fn create_validating_admission_policy(configuration: &configuration::Configuration, body: crate::models::V1beta1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ValidatingAdmissionPolicyBinding -pub async fn create_validating_admission_policy_binding(configuration: &configuration::Configuration, body: crate::models::V1beta1ValidatingAdmissionPolicyBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingAdmissionPolicy -pub async fn delete_collection_validating_admission_policy(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ValidatingAdmissionPolicyBinding -pub async fn delete_collection_validating_admission_policy_binding(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingAdmissionPolicy -pub async fn delete_validating_admission_policy(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ValidatingAdmissionPolicyBinding -pub async fn delete_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingAdmissionPolicy -pub async fn list_validating_admission_policy(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ValidatingAdmissionPolicyBinding -pub async fn list_validating_admission_policy_binding(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingAdmissionPolicy -pub async fn patch_validating_admission_policy(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ValidatingAdmissionPolicyBinding -pub async fn patch_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ValidatingAdmissionPolicy -pub async fn patch_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingAdmissionPolicy -pub async fn read_validating_admission_policy(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ValidatingAdmissionPolicyBinding -pub async fn read_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ValidatingAdmissionPolicy -pub async fn read_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingAdmissionPolicy -pub async fn replace_validating_admission_policy(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ValidatingAdmissionPolicyBinding -pub async fn replace_validating_admission_policy_binding(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1ValidatingAdmissionPolicyBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicybindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ValidatingAdmissionPolicy -pub async fn replace_validating_admission_policy_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1ValidatingAdmissionPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/admissionregistration.k8s.io/v1beta1/validatingadmissionpolicies/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apiextensions_api.rs b/src/apis/apiextensions_api.rs deleted file mode 100644 index 3bc3a61..0000000 --- a/src/apis/apiextensions_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apiextensions_v1_api.rs b/src/apis/apiextensions_v1_api.rs deleted file mode 100644 index 72600b2..0000000 --- a/src/apis/apiextensions_v1_api.rs +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_custom_resource_definition_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCustomResourceDefinitionStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_custom_resource_definition_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCustomResourceDefinitionStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_custom_resource_definition`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCustomResourceDefinitionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_custom_resource_definition_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCustomResourceDefinitionStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a CustomResourceDefinition -pub async fn create_custom_resource_definition(configuration: &configuration::Configuration, body: crate::models::V1CustomResourceDefinition, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of CustomResourceDefinition -pub async fn delete_collection_custom_resource_definition(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a CustomResourceDefinition -pub async fn delete_custom_resource_definition(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CustomResourceDefinition -pub async fn list_custom_resource_definition(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified CustomResourceDefinition -pub async fn patch_custom_resource_definition(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified CustomResourceDefinition -pub async fn patch_custom_resource_definition_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified CustomResourceDefinition -pub async fn read_custom_resource_definition(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified CustomResourceDefinition -pub async fn read_custom_resource_definition_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified CustomResourceDefinition -pub async fn replace_custom_resource_definition(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CustomResourceDefinition, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified CustomResourceDefinition -pub async fn replace_custom_resource_definition_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CustomResourceDefinition, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apiregistration_api.rs b/src/apis/apiregistration_api.rs deleted file mode 100644 index dfa382b..0000000 --- a/src/apis/apiregistration_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apiregistration_v1_api.rs b/src/apis/apiregistration_v1_api.rs deleted file mode 100644 index 3c2ebc2..0000000 --- a/src/apis/apiregistration_v1_api.rs +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_api_service_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchApiServiceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_api_service_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadApiServiceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_api_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceApiServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_api_service_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceApiServiceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create an APIService -pub async fn create_api_service(configuration: &configuration::Configuration, body: crate::models::V1ApiService, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an APIService -pub async fn delete_api_service(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of APIService -pub async fn delete_collection_api_service(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind APIService -pub async fn list_api_service(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified APIService -pub async fn patch_api_service(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified APIService -pub async fn patch_api_service_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified APIService -pub async fn read_api_service(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified APIService -pub async fn read_api_service_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified APIService -pub async fn replace_api_service(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ApiService, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified APIService -pub async fn replace_api_service_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ApiService, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apiregistration.k8s.io/v1/apiservices/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apis_api.rs b/src/apis/apis_api.rs deleted file mode 100644 index 6378044..0000000 --- a/src/apis/apis_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_versions`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiVersionsError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get available API versions -pub async fn get_api_versions(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apps_api.rs b/src/apis/apps_api.rs deleted file mode 100644 index eaf02d7..0000000 --- a/src/apis/apps_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/apps_v1_api.rs b/src/apis/apps_v1_api.rs deleted file mode 100644 index 8977300..0000000 --- a/src/apis/apps_v1_api.rs +++ /dev/null @@ -1,3805 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_controller_revision_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListControllerRevisionForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_daemon_set_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListDaemonSetForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_deployment_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListDeploymentForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_replica_set_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListReplicaSetForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_stateful_set_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListStatefulSetForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_daemon_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedDaemonSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_deployment_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedDeploymentScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_deployment_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedDeploymentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_replica_set_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedReplicaSetScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_replica_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedReplicaSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_stateful_set_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedStatefulSetScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_stateful_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedStatefulSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_daemon_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedDaemonSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_deployment_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedDeploymentScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_deployment_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedDeploymentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_replica_set_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedReplicaSetScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_replica_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedReplicaSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_stateful_set_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedStatefulSetScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_stateful_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedStatefulSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_controller_revision`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedControllerRevisionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_daemon_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedDaemonSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_daemon_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedDaemonSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_deployment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedDeploymentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_deployment_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedDeploymentScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_deployment_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedDeploymentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_replica_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedReplicaSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_replica_set_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedReplicaSetScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_replica_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedReplicaSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_stateful_set`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedStatefulSetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_stateful_set_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedStatefulSetScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_stateful_set_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedStatefulSetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a ControllerRevision -pub async fn create_namespaced_controller_revision(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1ControllerRevision, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a DaemonSet -pub async fn create_namespaced_daemon_set(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1DaemonSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Deployment -pub async fn create_namespaced_deployment(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Deployment, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ReplicaSet -pub async fn create_namespaced_replica_set(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1ReplicaSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a StatefulSet -pub async fn create_namespaced_stateful_set(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1StatefulSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ControllerRevision -pub async fn delete_collection_namespaced_controller_revision(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of DaemonSet -pub async fn delete_collection_namespaced_daemon_set(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Deployment -pub async fn delete_collection_namespaced_deployment(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ReplicaSet -pub async fn delete_collection_namespaced_replica_set(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of StatefulSet -pub async fn delete_collection_namespaced_stateful_set(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ControllerRevision -pub async fn delete_namespaced_controller_revision(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a DaemonSet -pub async fn delete_namespaced_daemon_set(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Deployment -pub async fn delete_namespaced_deployment(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ReplicaSet -pub async fn delete_namespaced_replica_set(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a StatefulSet -pub async fn delete_namespaced_stateful_set(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ControllerRevision -pub async fn list_controller_revision_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/controllerrevisions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind DaemonSet -pub async fn list_daemon_set_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/daemonsets", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Deployment -pub async fn list_deployment_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/deployments", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ControllerRevision -pub async fn list_namespaced_controller_revision(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind DaemonSet -pub async fn list_namespaced_daemon_set(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Deployment -pub async fn list_namespaced_deployment(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ReplicaSet -pub async fn list_namespaced_replica_set(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind StatefulSet -pub async fn list_namespaced_stateful_set(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ReplicaSet -pub async fn list_replica_set_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/replicasets", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind StatefulSet -pub async fn list_stateful_set_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/statefulsets", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ControllerRevision -pub async fn patch_namespaced_controller_revision(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified DaemonSet -pub async fn patch_namespaced_daemon_set(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified DaemonSet -pub async fn patch_namespaced_daemon_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Deployment -pub async fn patch_namespaced_deployment(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update scale of the specified Deployment -pub async fn patch_namespaced_deployment_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Deployment -pub async fn patch_namespaced_deployment_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ReplicaSet -pub async fn patch_namespaced_replica_set(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update scale of the specified ReplicaSet -pub async fn patch_namespaced_replica_set_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ReplicaSet -pub async fn patch_namespaced_replica_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified StatefulSet -pub async fn patch_namespaced_stateful_set(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update scale of the specified StatefulSet -pub async fn patch_namespaced_stateful_set_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified StatefulSet -pub async fn patch_namespaced_stateful_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ControllerRevision -pub async fn read_namespaced_controller_revision(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified DaemonSet -pub async fn read_namespaced_daemon_set(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified DaemonSet -pub async fn read_namespaced_daemon_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Deployment -pub async fn read_namespaced_deployment(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read scale of the specified Deployment -pub async fn read_namespaced_deployment_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Deployment -pub async fn read_namespaced_deployment_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ReplicaSet -pub async fn read_namespaced_replica_set(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read scale of the specified ReplicaSet -pub async fn read_namespaced_replica_set_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ReplicaSet -pub async fn read_namespaced_replica_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified StatefulSet -pub async fn read_namespaced_stateful_set(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read scale of the specified StatefulSet -pub async fn read_namespaced_stateful_set_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified StatefulSet -pub async fn read_namespaced_stateful_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ControllerRevision -pub async fn replace_namespaced_controller_revision(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ControllerRevision, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified DaemonSet -pub async fn replace_namespaced_daemon_set(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1DaemonSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified DaemonSet -pub async fn replace_namespaced_daemon_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1DaemonSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Deployment -pub async fn replace_namespaced_deployment(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Deployment, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace scale of the specified Deployment -pub async fn replace_namespaced_deployment_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Scale, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Deployment -pub async fn replace_namespaced_deployment_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Deployment, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ReplicaSet -pub async fn replace_namespaced_replica_set(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ReplicaSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace scale of the specified ReplicaSet -pub async fn replace_namespaced_replica_set_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Scale, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ReplicaSet -pub async fn replace_namespaced_replica_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ReplicaSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified StatefulSet -pub async fn replace_namespaced_stateful_set(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1StatefulSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace scale of the specified StatefulSet -pub async fn replace_namespaced_stateful_set_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Scale, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified StatefulSet -pub async fn replace_namespaced_stateful_set_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1StatefulSet, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/authentication_api.rs b/src/apis/authentication_api.rs deleted file mode 100644 index d5deb0a..0000000 --- a/src/apis/authentication_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/authentication_v1_api.rs b/src/apis/authentication_v1_api.rs deleted file mode 100644 index c4ea640..0000000 --- a/src/apis/authentication_v1_api.rs +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_self_subject_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateSelfSubjectReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_token_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateTokenReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a SelfSubjectReview -pub async fn create_self_subject_review(configuration: &configuration::Configuration, body: crate::models::V1SelfSubjectReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1/selfsubjectreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a TokenReview -pub async fn create_token_review(configuration: &configuration::Configuration, body: crate::models::V1TokenReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1/tokenreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/authentication_v1alpha1_api.rs b/src/apis/authentication_v1alpha1_api.rs deleted file mode 100644 index 7c85799..0000000 --- a/src/apis/authentication_v1alpha1_api.rs +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_self_subject_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateSelfSubjectReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a SelfSubjectReview -pub async fn create_self_subject_review(configuration: &configuration::Configuration, body: crate::models::V1alpha1SelfSubjectReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1alpha1/selfsubjectreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/authentication_v1beta1_api.rs b/src/apis/authentication_v1beta1_api.rs deleted file mode 100644 index dc8c73e..0000000 --- a/src/apis/authentication_v1beta1_api.rs +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_self_subject_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateSelfSubjectReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a SelfSubjectReview -pub async fn create_self_subject_review(configuration: &configuration::Configuration, body: crate::models::V1beta1SelfSubjectReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1beta1/selfsubjectreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authentication.k8s.io/v1beta1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/authorization_api.rs b/src/apis/authorization_api.rs deleted file mode 100644 index 44aa9a4..0000000 --- a/src/apis/authorization_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authorization.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/authorization_v1_api.rs b/src/apis/authorization_v1_api.rs deleted file mode 100644 index de7c173..0000000 --- a/src/apis/authorization_v1_api.rs +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_local_subject_access_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedLocalSubjectAccessReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_self_subject_access_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateSelfSubjectAccessReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_self_subject_rules_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateSelfSubjectRulesReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_subject_access_review`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateSubjectAccessReviewError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a LocalSubjectAccessReview -pub async fn create_namespaced_local_subject_access_review(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1LocalSubjectAccessReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authorization.k8s.io/v1/namespaces/{namespace}/localsubjectaccessreviews", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a SelfSubjectAccessReview -pub async fn create_self_subject_access_review(configuration: &configuration::Configuration, body: crate::models::V1SelfSubjectAccessReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authorization.k8s.io/v1/selfsubjectaccessreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a SelfSubjectRulesReview -pub async fn create_self_subject_rules_review(configuration: &configuration::Configuration, body: crate::models::V1SelfSubjectRulesReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authorization.k8s.io/v1/selfsubjectrulesreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a SubjectAccessReview -pub async fn create_subject_access_review(configuration: &configuration::Configuration, body: crate::models::V1SubjectAccessReview, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authorization.k8s.io/v1/subjectaccessreviews", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/authorization.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/autoscaling_api.rs b/src/apis/autoscaling_api.rs deleted file mode 100644 index d25a6c9..0000000 --- a/src/apis/autoscaling_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/autoscaling_v1_api.rs b/src/apis/autoscaling_v1_api.rs deleted file mode 100644 index 28209ac..0000000 --- a/src/apis/autoscaling_v1_api.rs +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_horizontal_pod_autoscaler_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListHorizontalPodAutoscalerForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_horizontal_pod_autoscaler_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedHorizontalPodAutoscalerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_horizontal_pod_autoscaler_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedHorizontalPodAutoscalerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_horizontal_pod_autoscaler_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedHorizontalPodAutoscalerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a HorizontalPodAutoscaler -pub async fn create_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1HorizontalPodAutoscaler, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of HorizontalPodAutoscaler -pub async fn delete_collection_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a HorizontalPodAutoscaler -pub async fn delete_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind HorizontalPodAutoscaler -pub async fn list_horizontal_pod_autoscaler_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/horizontalpodautoscalers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind HorizontalPodAutoscaler -pub async fn list_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified HorizontalPodAutoscaler -pub async fn patch_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified HorizontalPodAutoscaler -pub async fn patch_namespaced_horizontal_pod_autoscaler_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified HorizontalPodAutoscaler -pub async fn read_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified HorizontalPodAutoscaler -pub async fn read_namespaced_horizontal_pod_autoscaler_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified HorizontalPodAutoscaler -pub async fn replace_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1HorizontalPodAutoscaler, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified HorizontalPodAutoscaler -pub async fn replace_namespaced_horizontal_pod_autoscaler_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1HorizontalPodAutoscaler, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/autoscaling_v2_api.rs b/src/apis/autoscaling_v2_api.rs deleted file mode 100644 index b435b41..0000000 --- a/src/apis/autoscaling_v2_api.rs +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_horizontal_pod_autoscaler_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListHorizontalPodAutoscalerForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_horizontal_pod_autoscaler_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedHorizontalPodAutoscalerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_horizontal_pod_autoscaler_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedHorizontalPodAutoscalerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_horizontal_pod_autoscaler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedHorizontalPodAutoscalerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_horizontal_pod_autoscaler_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedHorizontalPodAutoscalerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a HorizontalPodAutoscaler -pub async fn create_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V2HorizontalPodAutoscaler, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of HorizontalPodAutoscaler -pub async fn delete_collection_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a HorizontalPodAutoscaler -pub async fn delete_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind HorizontalPodAutoscaler -pub async fn list_horizontal_pod_autoscaler_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/horizontalpodautoscalers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind HorizontalPodAutoscaler -pub async fn list_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified HorizontalPodAutoscaler -pub async fn patch_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified HorizontalPodAutoscaler -pub async fn patch_namespaced_horizontal_pod_autoscaler_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified HorizontalPodAutoscaler -pub async fn read_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified HorizontalPodAutoscaler -pub async fn read_namespaced_horizontal_pod_autoscaler_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified HorizontalPodAutoscaler -pub async fn replace_namespaced_horizontal_pod_autoscaler(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V2HorizontalPodAutoscaler, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified HorizontalPodAutoscaler -pub async fn replace_namespaced_horizontal_pod_autoscaler_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V2HorizontalPodAutoscaler, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/batch_api.rs b/src/apis/batch_api.rs deleted file mode 100644 index f4e9246..0000000 --- a/src/apis/batch_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/batch_v1_api.rs b/src/apis/batch_v1_api.rs deleted file mode 100644 index 35aa0a4..0000000 --- a/src/apis/batch_v1_api.rs +++ /dev/null @@ -1,1428 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_cron_job_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCronJobForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_job_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListJobForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_cron_job_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedCronJobStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_job_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedJobStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_cron_job_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedCronJobStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_job_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedJobStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_cron_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedCronJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_cron_job_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedCronJobStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_job`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedJobError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_job_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedJobStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a CronJob -pub async fn create_namespaced_cron_job(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1CronJob, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Job -pub async fn create_namespaced_job(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Job, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of CronJob -pub async fn delete_collection_namespaced_cron_job(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Job -pub async fn delete_collection_namespaced_job(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a CronJob -pub async fn delete_namespaced_cron_job(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Job -pub async fn delete_namespaced_job(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CronJob -pub async fn list_cron_job_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/cronjobs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Job -pub async fn list_job_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/jobs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CronJob -pub async fn list_namespaced_cron_job(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Job -pub async fn list_namespaced_job(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified CronJob -pub async fn patch_namespaced_cron_job(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified CronJob -pub async fn patch_namespaced_cron_job_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Job -pub async fn patch_namespaced_job(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Job -pub async fn patch_namespaced_job_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified CronJob -pub async fn read_namespaced_cron_job(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified CronJob -pub async fn read_namespaced_cron_job_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Job -pub async fn read_namespaced_job(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Job -pub async fn read_namespaced_job_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified CronJob -pub async fn replace_namespaced_cron_job(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1CronJob, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified CronJob -pub async fn replace_namespaced_cron_job_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1CronJob, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Job -pub async fn replace_namespaced_job(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Job, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Job -pub async fn replace_namespaced_job_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Job, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/batch/v1/namespaces/{namespace}/jobs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/certificates_api.rs b/src/apis/certificates_api.rs deleted file mode 100644 index ec72c34..0000000 --- a/src/apis/certificates_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/certificates_v1_api.rs b/src/apis/certificates_v1_api.rs deleted file mode 100644 index fe3ea44..0000000 --- a/src/apis/certificates_v1_api.rs +++ /dev/null @@ -1,832 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_certificate_signing_request_approval`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCertificateSigningRequestApprovalError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_certificate_signing_request_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCertificateSigningRequestStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_certificate_signing_request_approval`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCertificateSigningRequestApprovalError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_certificate_signing_request_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCertificateSigningRequestStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_certificate_signing_request`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCertificateSigningRequestError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_certificate_signing_request_approval`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCertificateSigningRequestApprovalError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_certificate_signing_request_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCertificateSigningRequestStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a CertificateSigningRequest -pub async fn create_certificate_signing_request(configuration: &configuration::Configuration, body: crate::models::V1CertificateSigningRequest, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a CertificateSigningRequest -pub async fn delete_certificate_signing_request(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of CertificateSigningRequest -pub async fn delete_collection_certificate_signing_request(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CertificateSigningRequest -pub async fn list_certificate_signing_request(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified CertificateSigningRequest -pub async fn patch_certificate_signing_request(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update approval of the specified CertificateSigningRequest -pub async fn patch_certificate_signing_request_approval(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/approval", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified CertificateSigningRequest -pub async fn patch_certificate_signing_request_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified CertificateSigningRequest -pub async fn read_certificate_signing_request(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read approval of the specified CertificateSigningRequest -pub async fn read_certificate_signing_request_approval(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/approval", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified CertificateSigningRequest -pub async fn read_certificate_signing_request_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified CertificateSigningRequest -pub async fn replace_certificate_signing_request(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CertificateSigningRequest, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace approval of the specified CertificateSigningRequest -pub async fn replace_certificate_signing_request_approval(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CertificateSigningRequest, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/approval", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified CertificateSigningRequest -pub async fn replace_certificate_signing_request_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CertificateSigningRequest, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1/certificatesigningrequests/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/certificates_v1alpha1_api.rs b/src/apis/certificates_v1alpha1_api.rs deleted file mode 100644 index 91dabd2..0000000 --- a/src/apis/certificates_v1alpha1_api.rs +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_cluster_trust_bundle`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceClusterTrustBundleError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a ClusterTrustBundle -pub async fn create_cluster_trust_bundle(configuration: &configuration::Configuration, body: crate::models::V1alpha1ClusterTrustBundle, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ClusterTrustBundle -pub async fn delete_cluster_trust_bundle(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ClusterTrustBundle -pub async fn delete_collection_cluster_trust_bundle(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ClusterTrustBundle -pub async fn list_cluster_trust_bundle(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ClusterTrustBundle -pub async fn patch_cluster_trust_bundle(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ClusterTrustBundle -pub async fn read_cluster_trust_bundle(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ClusterTrustBundle -pub async fn replace_cluster_trust_bundle(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1ClusterTrustBundle, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/certificates.k8s.io/v1alpha1/clustertrustbundles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs deleted file mode 100644 index 529fce3..0000000 --- a/src/apis/configuration.rs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -#[derive(Debug, Clone)] -pub struct Configuration { - pub base_path: String, - pub user_agent: Option, - pub client: reqwest::Client, - pub basic_auth: Option, - pub oauth_access_token: Option, - pub bearer_access_token: Option, - pub api_key: Option, - // TODO: take an oauth2 token source, similar to the go one -} - -pub type BasicAuth = (String, Option); - -#[derive(Debug, Clone)] -pub struct ApiKey { - pub prefix: Option, - pub key: String, -} - -impl Configuration { - pub fn new() -> Configuration { - Configuration::default() - } -} - -impl Default for Configuration { - fn default() -> Self { - Configuration { - base_path: "http://localhost".to_owned(), - user_agent: Some("OpenAPI-Generator/v1.31.3/rust".to_owned()), - client: reqwest::Client::new(), - basic_auth: None, - oauth_access_token: None, - bearer_access_token: None, - api_key: None, - } - } -} diff --git a/src/apis/coordination_api.rs b/src/apis/coordination_api.rs deleted file mode 100644 index 3015823..0000000 --- a/src/apis/coordination_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/coordination_v1_api.rs b/src/apis/coordination_v1_api.rs deleted file mode 100644 index a728227..0000000 --- a/src/apis/coordination_v1_api.rs +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_lease_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListLeaseForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_lease`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedLeaseError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a Lease -pub async fn create_namespaced_lease(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Lease, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Lease -pub async fn delete_collection_namespaced_lease(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Lease -pub async fn delete_namespaced_lease(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Lease -pub async fn list_lease_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/leases", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Lease -pub async fn list_namespaced_lease(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Lease -pub async fn patch_namespaced_lease(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Lease -pub async fn read_namespaced_lease(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Lease -pub async fn replace_namespaced_lease(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Lease, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/coordination_v1alpha1_api.rs b/src/apis/coordination_v1alpha1_api.rs deleted file mode 100644 index 3804814..0000000 --- a/src/apis/coordination_v1alpha1_api.rs +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_lease_candidate_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListLeaseCandidateForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_lease_candidate`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedLeaseCandidateError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a LeaseCandidate -pub async fn create_namespaced_lease_candidate(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1alpha1LeaseCandidate, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of LeaseCandidate -pub async fn delete_collection_namespaced_lease_candidate(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a LeaseCandidate -pub async fn delete_namespaced_lease_candidate(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind LeaseCandidate -pub async fn list_lease_candidate_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/leasecandidates", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind LeaseCandidate -pub async fn list_namespaced_lease_candidate(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified LeaseCandidate -pub async fn patch_namespaced_lease_candidate(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified LeaseCandidate -pub async fn read_namespaced_lease_candidate(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified LeaseCandidate -pub async fn replace_namespaced_lease_candidate(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1alpha1LeaseCandidate, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/coordination.k8s.io/v1alpha1/namespaces/{namespace}/leasecandidates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/core_api.rs b/src/apis/core_api.rs deleted file mode 100644 index 0048387..0000000 --- a/src/apis/core_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_versions`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiVersionsError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get available API versions -pub async fn get_api_versions(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/core_v1_api.rs b/src/apis/core_v1_api.rs deleted file mode 100644 index 630dad1..0000000 --- a/src/apis/core_v1_api.rs +++ /dev/null @@ -1,11962 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`connect_delete_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectDeleteNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_delete_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectDeleteNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_delete_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectDeleteNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_delete_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectDeleteNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_delete_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectDeleteNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_delete_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectDeleteNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_pod_attach`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedPodAttachError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_pod_exec`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedPodExecError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_pod_portforward`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedPodPortforwardError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_get_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectGetNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_head_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectHeadNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_head_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectHeadNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_head_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectHeadNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_head_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectHeadNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_head_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectHeadNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_head_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectHeadNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_options_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectOptionsNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_options_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectOptionsNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_options_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectOptionsNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_options_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectOptionsNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_options_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectOptionsNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_options_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectOptionsNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_patch_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPatchNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_patch_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPatchNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_patch_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPatchNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_patch_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPatchNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_patch_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPatchNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_patch_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPatchNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_pod_attach`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedPodAttachError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_pod_exec`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedPodExecError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_pod_portforward`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedPodPortforwardError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_post_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPostNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_put_namespaced_pod_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPutNamespacedPodProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_put_namespaced_pod_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPutNamespacedPodProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_put_namespaced_service_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPutNamespacedServiceProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_put_namespaced_service_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPutNamespacedServiceProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_put_node_proxy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPutNodeProxyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`connect_put_node_proxy_with_path`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConnectPutNodeProxyWithPathError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespace`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespaceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_pod_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPodBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_pod_eviction`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPodEvictionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_service_account_token`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedServiceAccountTokenError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreatePersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionPersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespace`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespaceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeletePersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_component_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListComponentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_config_map_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListConfigMapForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_endpoints_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListEndpointsForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_event_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListEventForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_limit_range_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListLimitRangeForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespace`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespaceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_persistent_volume_claim_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPersistentVolumeClaimForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_pod_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPodForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_pod_template_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPodTemplateForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_replication_controller_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListReplicationControllerForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_resource_quota_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListResourceQuotaForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_secret_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListSecretForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_service_account_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListServiceAccountForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_service_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListServiceForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespace`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespaceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespace_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespaceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_persistent_volume_claim_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPersistentVolumeClaimStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_ephemeralcontainers`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodEphemeralcontainersError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_replication_controller_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedReplicationControllerScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_replication_controller_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedReplicationControllerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_resource_quota_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedResourceQuotaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_service_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedServiceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_node_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNodeStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_persistent_volume_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPersistentVolumeStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_component_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadComponentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespace`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespaceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespace_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespaceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_persistent_volume_claim_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPersistentVolumeClaimStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_ephemeralcontainers`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodEphemeralcontainersError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_log`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodLogError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_replication_controller_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedReplicationControllerScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_replication_controller_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedReplicationControllerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_resource_quota_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedResourceQuotaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_service_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedServiceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_node_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNodeStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_persistent_volume_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPersistentVolumeStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespace`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespaceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespace_finalize`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespaceFinalizeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespace_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespaceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_config_map`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedConfigMapError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_endpoints`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedEndpointsError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_limit_range`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedLimitRangeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_persistent_volume_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPersistentVolumeClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_persistent_volume_claim_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPersistentVolumeClaimStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_ephemeralcontainers`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodEphemeralcontainersError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_replication_controller`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedReplicationControllerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_replication_controller_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedReplicationControllerScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_replication_controller_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedReplicationControllerStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_resource_quota`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedResourceQuotaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_resource_quota_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedResourceQuotaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_secret`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedSecretError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_service`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedServiceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_service_account`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedServiceAccountError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_service_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedServiceStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_node_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNodeStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_persistent_volume`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePersistentVolumeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_persistent_volume_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePersistentVolumeStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// connect DELETE requests to proxy of Pod -pub async fn connect_delete_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect DELETE requests to proxy of Pod -pub async fn connect_delete_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect DELETE requests to proxy of Service -pub async fn connect_delete_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect DELETE requests to proxy of Service -pub async fn connect_delete_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect DELETE requests to proxy of Node -pub async fn connect_delete_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect DELETE requests to proxy of Node -pub async fn connect_delete_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to attach of Pod -pub async fn connect_get_namespaced_pod_attach(configuration: &configuration::Configuration, name: &str, namespace: &str, container: Option<&str>, stderr: Option, stdin: Option, stdout: Option, tty: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/attach", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = container { - local_var_req_builder = local_var_req_builder.query(&[("container", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stderr { - local_var_req_builder = local_var_req_builder.query(&[("stderr", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdin { - local_var_req_builder = local_var_req_builder.query(&[("stdin", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdout { - local_var_req_builder = local_var_req_builder.query(&[("stdout", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = tty { - local_var_req_builder = local_var_req_builder.query(&[("tty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to exec of Pod -pub async fn connect_get_namespaced_pod_exec(configuration: &configuration::Configuration, name: &str, namespace: &str, command: Option<&str>, container: Option<&str>, stderr: Option, stdin: Option, stdout: Option, tty: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/exec", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = command { - local_var_req_builder = local_var_req_builder.query(&[("command", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = container { - local_var_req_builder = local_var_req_builder.query(&[("container", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stderr { - local_var_req_builder = local_var_req_builder.query(&[("stderr", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdin { - local_var_req_builder = local_var_req_builder.query(&[("stdin", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdout { - local_var_req_builder = local_var_req_builder.query(&[("stdout", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = tty { - local_var_req_builder = local_var_req_builder.query(&[("tty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to portforward of Pod -pub async fn connect_get_namespaced_pod_portforward(configuration: &configuration::Configuration, name: &str, namespace: &str, ports: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/portforward", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = ports { - local_var_req_builder = local_var_req_builder.query(&[("ports", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to proxy of Pod -pub async fn connect_get_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to proxy of Pod -pub async fn connect_get_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to proxy of Service -pub async fn connect_get_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to proxy of Service -pub async fn connect_get_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to proxy of Node -pub async fn connect_get_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect GET requests to proxy of Node -pub async fn connect_get_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect HEAD requests to proxy of Pod -pub async fn connect_head_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect HEAD requests to proxy of Pod -pub async fn connect_head_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect HEAD requests to proxy of Service -pub async fn connect_head_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect HEAD requests to proxy of Service -pub async fn connect_head_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect HEAD requests to proxy of Node -pub async fn connect_head_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect HEAD requests to proxy of Node -pub async fn connect_head_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::HEAD, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect OPTIONS requests to proxy of Pod -pub async fn connect_options_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect OPTIONS requests to proxy of Pod -pub async fn connect_options_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect OPTIONS requests to proxy of Service -pub async fn connect_options_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect OPTIONS requests to proxy of Service -pub async fn connect_options_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect OPTIONS requests to proxy of Node -pub async fn connect_options_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect OPTIONS requests to proxy of Node -pub async fn connect_options_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PATCH requests to proxy of Pod -pub async fn connect_patch_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PATCH requests to proxy of Pod -pub async fn connect_patch_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PATCH requests to proxy of Service -pub async fn connect_patch_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PATCH requests to proxy of Service -pub async fn connect_patch_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PATCH requests to proxy of Node -pub async fn connect_patch_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PATCH requests to proxy of Node -pub async fn connect_patch_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to attach of Pod -pub async fn connect_post_namespaced_pod_attach(configuration: &configuration::Configuration, name: &str, namespace: &str, container: Option<&str>, stderr: Option, stdin: Option, stdout: Option, tty: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/attach", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = container { - local_var_req_builder = local_var_req_builder.query(&[("container", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stderr { - local_var_req_builder = local_var_req_builder.query(&[("stderr", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdin { - local_var_req_builder = local_var_req_builder.query(&[("stdin", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdout { - local_var_req_builder = local_var_req_builder.query(&[("stdout", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = tty { - local_var_req_builder = local_var_req_builder.query(&[("tty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to exec of Pod -pub async fn connect_post_namespaced_pod_exec(configuration: &configuration::Configuration, name: &str, namespace: &str, command: Option<&str>, container: Option<&str>, stderr: Option, stdin: Option, stdout: Option, tty: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/exec", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = command { - local_var_req_builder = local_var_req_builder.query(&[("command", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = container { - local_var_req_builder = local_var_req_builder.query(&[("container", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stderr { - local_var_req_builder = local_var_req_builder.query(&[("stderr", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdin { - local_var_req_builder = local_var_req_builder.query(&[("stdin", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = stdout { - local_var_req_builder = local_var_req_builder.query(&[("stdout", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = tty { - local_var_req_builder = local_var_req_builder.query(&[("tty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to portforward of Pod -pub async fn connect_post_namespaced_pod_portforward(configuration: &configuration::Configuration, name: &str, namespace: &str, ports: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/portforward", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = ports { - local_var_req_builder = local_var_req_builder.query(&[("ports", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to proxy of Pod -pub async fn connect_post_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to proxy of Pod -pub async fn connect_post_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to proxy of Service -pub async fn connect_post_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to proxy of Service -pub async fn connect_post_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to proxy of Node -pub async fn connect_post_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect POST requests to proxy of Node -pub async fn connect_post_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PUT requests to proxy of Pod -pub async fn connect_put_namespaced_pod_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PUT requests to proxy of Pod -pub async fn connect_put_namespaced_pod_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PUT requests to proxy of Service -pub async fn connect_put_namespaced_service_proxy(configuration: &configuration::Configuration, name: &str, namespace: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PUT requests to proxy of Service -pub async fn connect_put_namespaced_service_proxy_with_path(configuration: &configuration::Configuration, name: &str, namespace: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PUT requests to proxy of Node -pub async fn connect_put_node_proxy(configuration: &configuration::Configuration, name: &str, path: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// connect PUT requests to proxy of Node -pub async fn connect_put_node_proxy_with_path(configuration: &configuration::Configuration, name: &str, path: &str, path2: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/proxy/{path}", local_var_configuration.base_path, name=crate::apis::urlencode(name), path=crate::apis::urlencode(path)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = path2 { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Namespace -pub async fn create_namespace(configuration: &configuration::Configuration, body: crate::models::V1Namespace, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Binding -pub async fn create_namespaced_binding(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Binding, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/bindings", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ConfigMap -pub async fn create_namespaced_config_map(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1ConfigMap, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create Endpoints -pub async fn create_namespaced_endpoints(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Endpoints, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create an Event -pub async fn create_namespaced_event(configuration: &configuration::Configuration, namespace: &str, body: crate::models::CoreV1Event, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a LimitRange -pub async fn create_namespaced_limit_range(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1LimitRange, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a PersistentVolumeClaim -pub async fn create_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1PersistentVolumeClaim, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Pod -pub async fn create_namespaced_pod(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Pod, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create binding of a Pod -pub async fn create_namespaced_pod_binding(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Binding, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/binding", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create eviction of a Pod -pub async fn create_namespaced_pod_eviction(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Eviction, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/eviction", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a PodTemplate -pub async fn create_namespaced_pod_template(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1PodTemplate, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ReplicationController -pub async fn create_namespaced_replication_controller(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1ReplicationController, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ResourceQuota -pub async fn create_namespaced_resource_quota(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1ResourceQuota, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Secret -pub async fn create_namespaced_secret(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Secret, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Service -pub async fn create_namespaced_service(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Service, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ServiceAccount -pub async fn create_namespaced_service_account(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1ServiceAccount, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create token of a ServiceAccount -pub async fn create_namespaced_service_account_token(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::AuthenticationV1TokenRequest, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts/{name}/token", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Node -pub async fn create_node(configuration: &configuration::Configuration, body: crate::models::V1Node, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a PersistentVolume -pub async fn create_persistent_volume(configuration: &configuration::Configuration, body: crate::models::V1PersistentVolume, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ConfigMap -pub async fn delete_collection_namespaced_config_map(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Endpoints -pub async fn delete_collection_namespaced_endpoints(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Event -pub async fn delete_collection_namespaced_event(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of LimitRange -pub async fn delete_collection_namespaced_limit_range(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PersistentVolumeClaim -pub async fn delete_collection_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Pod -pub async fn delete_collection_namespaced_pod(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PodTemplate -pub async fn delete_collection_namespaced_pod_template(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ReplicationController -pub async fn delete_collection_namespaced_replication_controller(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ResourceQuota -pub async fn delete_collection_namespaced_resource_quota(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Secret -pub async fn delete_collection_namespaced_secret(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Service -pub async fn delete_collection_namespaced_service(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ServiceAccount -pub async fn delete_collection_namespaced_service_account(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Node -pub async fn delete_collection_node(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PersistentVolume -pub async fn delete_collection_persistent_volume(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Namespace -pub async fn delete_namespace(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ConfigMap -pub async fn delete_namespaced_config_map(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete Endpoints -pub async fn delete_namespaced_endpoints(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an Event -pub async fn delete_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a LimitRange -pub async fn delete_namespaced_limit_range(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PersistentVolumeClaim -pub async fn delete_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Pod -pub async fn delete_namespaced_pod(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PodTemplate -pub async fn delete_namespaced_pod_template(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ReplicationController -pub async fn delete_namespaced_replication_controller(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ResourceQuota -pub async fn delete_namespaced_resource_quota(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Secret -pub async fn delete_namespaced_secret(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Service -pub async fn delete_namespaced_service(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ServiceAccount -pub async fn delete_namespaced_service_account(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Node -pub async fn delete_node(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PersistentVolume -pub async fn delete_persistent_volume(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list objects of kind ComponentStatus -pub async fn list_component_status(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/componentstatuses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ConfigMap -pub async fn list_config_map_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/configmaps", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Endpoints -pub async fn list_endpoints_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/endpoints", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Event -pub async fn list_event_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/events", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind LimitRange -pub async fn list_limit_range_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/limitranges", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Namespace -pub async fn list_namespace(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ConfigMap -pub async fn list_namespaced_config_map(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Endpoints -pub async fn list_namespaced_endpoints(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Event -pub async fn list_namespaced_event(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind LimitRange -pub async fn list_namespaced_limit_range(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PersistentVolumeClaim -pub async fn list_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Pod -pub async fn list_namespaced_pod(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PodTemplate -pub async fn list_namespaced_pod_template(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ReplicationController -pub async fn list_namespaced_replication_controller(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceQuota -pub async fn list_namespaced_resource_quota(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Secret -pub async fn list_namespaced_secret(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Service -pub async fn list_namespaced_service(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ServiceAccount -pub async fn list_namespaced_service_account(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Node -pub async fn list_node(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PersistentVolume -pub async fn list_persistent_volume(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PersistentVolumeClaim -pub async fn list_persistent_volume_claim_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumeclaims", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Pod -pub async fn list_pod_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/pods", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PodTemplate -pub async fn list_pod_template_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/podtemplates", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ReplicationController -pub async fn list_replication_controller_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/replicationcontrollers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceQuota -pub async fn list_resource_quota_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/resourcequotas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Secret -pub async fn list_secret_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/secrets", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ServiceAccount -pub async fn list_service_account_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/serviceaccounts", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Service -pub async fn list_service_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/services", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Namespace -pub async fn patch_namespace(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Namespace -pub async fn patch_namespace_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ConfigMap -pub async fn patch_namespaced_config_map(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Endpoints -pub async fn patch_namespaced_endpoints(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Event -pub async fn patch_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified LimitRange -pub async fn patch_namespaced_limit_range(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PersistentVolumeClaim -pub async fn patch_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified PersistentVolumeClaim -pub async fn patch_namespaced_persistent_volume_claim_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Pod -pub async fn patch_namespaced_pod(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update ephemeralcontainers of the specified Pod -pub async fn patch_namespaced_pod_ephemeralcontainers(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Pod -pub async fn patch_namespaced_pod_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PodTemplate -pub async fn patch_namespaced_pod_template(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ReplicationController -pub async fn patch_namespaced_replication_controller(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update scale of the specified ReplicationController -pub async fn patch_namespaced_replication_controller_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ReplicationController -pub async fn patch_namespaced_replication_controller_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ResourceQuota -pub async fn patch_namespaced_resource_quota(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ResourceQuota -pub async fn patch_namespaced_resource_quota_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Secret -pub async fn patch_namespaced_secret(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Service -pub async fn patch_namespaced_service(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ServiceAccount -pub async fn patch_namespaced_service_account(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Service -pub async fn patch_namespaced_service_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Node -pub async fn patch_node(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Node -pub async fn patch_node_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PersistentVolume -pub async fn patch_persistent_volume(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified PersistentVolume -pub async fn patch_persistent_volume_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ComponentStatus -pub async fn read_component_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/componentstatuses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Namespace -pub async fn read_namespace(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Namespace -pub async fn read_namespace_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ConfigMap -pub async fn read_namespaced_config_map(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Endpoints -pub async fn read_namespaced_endpoints(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Event -pub async fn read_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified LimitRange -pub async fn read_namespaced_limit_range(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PersistentVolumeClaim -pub async fn read_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified PersistentVolumeClaim -pub async fn read_namespaced_persistent_volume_claim_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Pod -pub async fn read_namespaced_pod(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read ephemeralcontainers of the specified Pod -pub async fn read_namespaced_pod_ephemeralcontainers(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read log of the specified Pod -pub async fn read_namespaced_pod_log(configuration: &configuration::Configuration, name: &str, namespace: &str, container: Option<&str>, follow: Option, insecure_skip_tls_verify_backend: Option, limit_bytes: Option, pretty: Option<&str>, previous: Option, since_seconds: Option, tail_lines: Option, timestamps: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/log", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = container { - local_var_req_builder = local_var_req_builder.query(&[("container", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = follow { - local_var_req_builder = local_var_req_builder.query(&[("follow", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = insecure_skip_tls_verify_backend { - local_var_req_builder = local_var_req_builder.query(&[("insecureSkipTLSVerifyBackend", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit_bytes { - local_var_req_builder = local_var_req_builder.query(&[("limitBytes", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = previous { - local_var_req_builder = local_var_req_builder.query(&[("previous", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = since_seconds { - local_var_req_builder = local_var_req_builder.query(&[("sinceSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = tail_lines { - local_var_req_builder = local_var_req_builder.query(&[("tailLines", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timestamps { - local_var_req_builder = local_var_req_builder.query(&[("timestamps", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Pod -pub async fn read_namespaced_pod_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PodTemplate -pub async fn read_namespaced_pod_template(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ReplicationController -pub async fn read_namespaced_replication_controller(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read scale of the specified ReplicationController -pub async fn read_namespaced_replication_controller_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ReplicationController -pub async fn read_namespaced_replication_controller_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ResourceQuota -pub async fn read_namespaced_resource_quota(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ResourceQuota -pub async fn read_namespaced_resource_quota_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Secret -pub async fn read_namespaced_secret(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Service -pub async fn read_namespaced_service(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ServiceAccount -pub async fn read_namespaced_service_account(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Service -pub async fn read_namespaced_service_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Node -pub async fn read_node(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Node -pub async fn read_node_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PersistentVolume -pub async fn read_persistent_volume(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified PersistentVolume -pub async fn read_persistent_volume_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Namespace -pub async fn replace_namespace(configuration: &configuration::Configuration, name: &str, body: crate::models::V1Namespace, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace finalize of the specified Namespace -pub async fn replace_namespace_finalize(configuration: &configuration::Configuration, name: &str, body: crate::models::V1Namespace, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}/finalize", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Namespace -pub async fn replace_namespace_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1Namespace, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ConfigMap -pub async fn replace_namespaced_config_map(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ConfigMap, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/configmaps/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Endpoints -pub async fn replace_namespaced_endpoints(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Endpoints, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/endpoints/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Event -pub async fn replace_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::CoreV1Event, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified LimitRange -pub async fn replace_namespaced_limit_range(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1LimitRange, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/limitranges/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PersistentVolumeClaim -pub async fn replace_namespaced_persistent_volume_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1PersistentVolumeClaim, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified PersistentVolumeClaim -pub async fn replace_namespaced_persistent_volume_claim_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1PersistentVolumeClaim, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Pod -pub async fn replace_namespaced_pod(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Pod, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace ephemeralcontainers of the specified Pod -pub async fn replace_namespaced_pod_ephemeralcontainers(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Pod, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Pod -pub async fn replace_namespaced_pod_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Pod, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/pods/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PodTemplate -pub async fn replace_namespaced_pod_template(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1PodTemplate, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/podtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ReplicationController -pub async fn replace_namespaced_replication_controller(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ReplicationController, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace scale of the specified ReplicationController -pub async fn replace_namespaced_replication_controller_scale(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Scale, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/scale", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ReplicationController -pub async fn replace_namespaced_replication_controller_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ReplicationController, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/replicationcontrollers/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ResourceQuota -pub async fn replace_namespaced_resource_quota(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ResourceQuota, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ResourceQuota -pub async fn replace_namespaced_resource_quota_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ResourceQuota, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/resourcequotas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Secret -pub async fn replace_namespaced_secret(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Secret, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/secrets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Service -pub async fn replace_namespaced_service(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Service, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ServiceAccount -pub async fn replace_namespaced_service_account(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1ServiceAccount, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/serviceaccounts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Service -pub async fn replace_namespaced_service_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Service, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/namespaces/{namespace}/services/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Node -pub async fn replace_node(configuration: &configuration::Configuration, name: &str, body: crate::models::V1Node, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Node -pub async fn replace_node_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1Node, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/nodes/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PersistentVolume -pub async fn replace_persistent_volume(configuration: &configuration::Configuration, name: &str, body: crate::models::V1PersistentVolume, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified PersistentVolume -pub async fn replace_persistent_volume_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1PersistentVolume, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/persistentvolumes/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/custom_objects_api.rs b/src/apis/custom_objects_api.rs deleted file mode 100644 index da5e005..0000000 --- a/src/apis/custom_objects_api.rs +++ /dev/null @@ -1,1571 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_cluster_custom_object_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetClusterCustomObjectScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_cluster_custom_object_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetClusterCustomObjectStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_namespaced_custom_object_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetNamespacedCustomObjectScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_namespaced_custom_object_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetNamespacedCustomObjectStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_custom_object_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCustomObjectForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_cluster_custom_object_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchClusterCustomObjectScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_cluster_custom_object_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchClusterCustomObjectStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_custom_object_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedCustomObjectScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_custom_object_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedCustomObjectStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_cluster_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceClusterCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_cluster_custom_object_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceClusterCustomObjectScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_cluster_custom_object_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceClusterCustomObjectStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_custom_object`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedCustomObjectError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_custom_object_scale`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedCustomObjectScaleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_custom_object_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedCustomObjectStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// Creates a cluster scoped Custom object -pub async fn create_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Creates a namespace scoped Custom object -pub async fn create_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Deletes the specified cluster scoped custom object -pub async fn delete_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, dry_run: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Delete collection of cluster scoped custom objects -pub async fn delete_collection_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, pretty: Option<&str>, label_selector: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, dry_run: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Delete collection of namespace scoped custom objects -pub async fn delete_collection_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, pretty: Option<&str>, label_selector: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Deletes the specified namespace scoped custom object -pub async fn delete_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, dry_run: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, group: &str, version: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Returns a cluster scoped custom object -pub async fn get_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read scale of the specified custom object -pub async fn get_cluster_custom_object_scale(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}/scale", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified cluster scoped custom object -pub async fn get_cluster_custom_object_status(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}/status", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Returns a namespace scoped custom object -pub async fn get_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read scale of the specified namespace scoped custom object -pub async fn get_namespaced_custom_object_scale(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/scale", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified namespace scoped custom object -pub async fn get_namespaced_custom_object_status(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/status", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch cluster scoped custom objects -pub async fn list_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch namespace scoped custom objects -pub async fn list_custom_object_for_all_namespaces(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}#‎", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch namespace scoped custom objects -pub async fn list_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// patch the specified cluster scoped custom object -pub async fn patch_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update scale of the specified cluster scoped custom object -pub async fn patch_cluster_custom_object_scale(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}/scale", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified cluster scoped custom object -pub async fn patch_cluster_custom_object_status(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}/status", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// patch the specified namespace scoped custom object -pub async fn patch_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update scale of the specified namespace scoped custom object -pub async fn patch_namespaced_custom_object_scale(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/scale", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified namespace scoped custom object -pub async fn patch_namespaced_custom_object_status(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/status", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified cluster scoped custom object -pub async fn replace_cluster_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace scale of the specified cluster scoped custom object -pub async fn replace_cluster_custom_object_scale(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}/scale", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the cluster scoped specified custom object -pub async fn replace_cluster_custom_object_status(configuration: &configuration::Configuration, group: &str, version: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/{plural}/{name}/status", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified namespace scoped custom object -pub async fn replace_namespaced_custom_object(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace scale of the specified namespace scoped custom object -pub async fn replace_namespaced_custom_object_scale(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/scale", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified namespace scoped custom object -pub async fn replace_namespaced_custom_object_status(configuration: &configuration::Configuration, group: &str, version: &str, namespace: &str, plural: &str, name: &str, body: serde_json::Value, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/status", local_var_configuration.base_path, group=crate::apis::urlencode(group), version=crate::apis::urlencode(version), namespace=crate::apis::urlencode(namespace), plural=crate::apis::urlencode(plural), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/discovery_api.rs b/src/apis/discovery_api.rs deleted file mode 100644 index 42cd782..0000000 --- a/src/apis/discovery_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/discovery_v1_api.rs b/src/apis/discovery_v1_api.rs deleted file mode 100644 index eca6468..0000000 --- a/src/apis/discovery_v1_api.rs +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_endpoint_slice_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListEndpointSliceForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_endpoint_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedEndpointSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create an EndpointSlice -pub async fn create_namespaced_endpoint_slice(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1EndpointSlice, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of EndpointSlice -pub async fn delete_collection_namespaced_endpoint_slice(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an EndpointSlice -pub async fn delete_namespaced_endpoint_slice(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind EndpointSlice -pub async fn list_endpoint_slice_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/endpointslices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind EndpointSlice -pub async fn list_namespaced_endpoint_slice(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified EndpointSlice -pub async fn patch_namespaced_endpoint_slice(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified EndpointSlice -pub async fn read_namespaced_endpoint_slice(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified EndpointSlice -pub async fn replace_namespaced_endpoint_slice(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1EndpointSlice, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/events_api.rs b/src/apis/events_api.rs deleted file mode 100644 index 90b5130..0000000 --- a/src/apis/events_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/events_v1_api.rs b/src/apis/events_v1_api.rs deleted file mode 100644 index 0819604..0000000 --- a/src/apis/events_v1_api.rs +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_event_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListEventForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_event`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedEventError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create an Event -pub async fn create_namespaced_event(configuration: &configuration::Configuration, namespace: &str, body: crate::models::EventsV1Event, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Event -pub async fn delete_collection_namespaced_event(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an Event -pub async fn delete_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Event -pub async fn list_event_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/events", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Event -pub async fn list_namespaced_event(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Event -pub async fn patch_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Event -pub async fn read_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Event -pub async fn replace_namespaced_event(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::EventsV1Event, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/flowcontrol_apiserver_api.rs b/src/apis/flowcontrol_apiserver_api.rs deleted file mode 100644 index 31615d5..0000000 --- a/src/apis/flowcontrol_apiserver_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/flowcontrol_apiserver_v1_api.rs b/src/apis/flowcontrol_apiserver_v1_api.rs deleted file mode 100644 index 21d5e9f..0000000 --- a/src/apis/flowcontrol_apiserver_v1_api.rs +++ /dev/null @@ -1,1274 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreatePriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeletePriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_flow_schema_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchFlowSchemaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_priority_level_configuration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPriorityLevelConfigurationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_flow_schema_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadFlowSchemaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_priority_level_configuration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPriorityLevelConfigurationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_flow_schema_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceFlowSchemaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_priority_level_configuration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePriorityLevelConfigurationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a FlowSchema -pub async fn create_flow_schema(configuration: &configuration::Configuration, body: crate::models::V1FlowSchema, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a PriorityLevelConfiguration -pub async fn create_priority_level_configuration(configuration: &configuration::Configuration, body: crate::models::V1PriorityLevelConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of FlowSchema -pub async fn delete_collection_flow_schema(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PriorityLevelConfiguration -pub async fn delete_collection_priority_level_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a FlowSchema -pub async fn delete_flow_schema(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PriorityLevelConfiguration -pub async fn delete_priority_level_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind FlowSchema -pub async fn list_flow_schema(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PriorityLevelConfiguration -pub async fn list_priority_level_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified FlowSchema -pub async fn patch_flow_schema(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified FlowSchema -pub async fn patch_flow_schema_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PriorityLevelConfiguration -pub async fn patch_priority_level_configuration(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified PriorityLevelConfiguration -pub async fn patch_priority_level_configuration_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified FlowSchema -pub async fn read_flow_schema(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified FlowSchema -pub async fn read_flow_schema_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PriorityLevelConfiguration -pub async fn read_priority_level_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified PriorityLevelConfiguration -pub async fn read_priority_level_configuration_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified FlowSchema -pub async fn replace_flow_schema(configuration: &configuration::Configuration, name: &str, body: crate::models::V1FlowSchema, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified FlowSchema -pub async fn replace_flow_schema_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1FlowSchema, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PriorityLevelConfiguration -pub async fn replace_priority_level_configuration(configuration: &configuration::Configuration, name: &str, body: crate::models::V1PriorityLevelConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified PriorityLevelConfiguration -pub async fn replace_priority_level_configuration_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1PriorityLevelConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/flowcontrol_apiserver_v1beta3_api.rs b/src/apis/flowcontrol_apiserver_v1beta3_api.rs deleted file mode 100644 index 0d2642b..0000000 --- a/src/apis/flowcontrol_apiserver_v1beta3_api.rs +++ /dev/null @@ -1,1274 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreatePriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeletePriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_flow_schema_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchFlowSchemaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_priority_level_configuration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPriorityLevelConfigurationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_flow_schema_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadFlowSchemaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_priority_level_configuration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPriorityLevelConfigurationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_flow_schema`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceFlowSchemaError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_flow_schema_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceFlowSchemaStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_priority_level_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePriorityLevelConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_priority_level_configuration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePriorityLevelConfigurationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a FlowSchema -pub async fn create_flow_schema(configuration: &configuration::Configuration, body: crate::models::V1beta3FlowSchema, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a PriorityLevelConfiguration -pub async fn create_priority_level_configuration(configuration: &configuration::Configuration, body: crate::models::V1beta3PriorityLevelConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of FlowSchema -pub async fn delete_collection_flow_schema(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PriorityLevelConfiguration -pub async fn delete_collection_priority_level_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a FlowSchema -pub async fn delete_flow_schema(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PriorityLevelConfiguration -pub async fn delete_priority_level_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind FlowSchema -pub async fn list_flow_schema(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PriorityLevelConfiguration -pub async fn list_priority_level_configuration(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified FlowSchema -pub async fn patch_flow_schema(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified FlowSchema -pub async fn patch_flow_schema_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PriorityLevelConfiguration -pub async fn patch_priority_level_configuration(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified PriorityLevelConfiguration -pub async fn patch_priority_level_configuration_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified FlowSchema -pub async fn read_flow_schema(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified FlowSchema -pub async fn read_flow_schema_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PriorityLevelConfiguration -pub async fn read_priority_level_configuration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified PriorityLevelConfiguration -pub async fn read_priority_level_configuration_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified FlowSchema -pub async fn replace_flow_schema(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta3FlowSchema, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified FlowSchema -pub async fn replace_flow_schema_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta3FlowSchema, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/flowschemas/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PriorityLevelConfiguration -pub async fn replace_priority_level_configuration(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta3PriorityLevelConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified PriorityLevelConfiguration -pub async fn replace_priority_level_configuration_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta3PriorityLevelConfiguration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/flowcontrol.apiserver.k8s.io/v1beta3/prioritylevelconfigurations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/internal_apiserver_api.rs b/src/apis/internal_apiserver_api.rs deleted file mode 100644 index 1194d61..0000000 --- a/src/apis/internal_apiserver_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/internal_apiserver_v1alpha1_api.rs b/src/apis/internal_apiserver_v1alpha1_api.rs deleted file mode 100644 index 4cd765d..0000000 --- a/src/apis/internal_apiserver_v1alpha1_api.rs +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_storage_version_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchStorageVersionStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_storage_version_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadStorageVersionStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_storage_version`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceStorageVersionError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_storage_version_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceStorageVersionStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a StorageVersion -pub async fn create_storage_version(configuration: &configuration::Configuration, body: crate::models::V1alpha1StorageVersion, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of StorageVersion -pub async fn delete_collection_storage_version(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a StorageVersion -pub async fn delete_storage_version(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind StorageVersion -pub async fn list_storage_version(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified StorageVersion -pub async fn patch_storage_version(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified StorageVersion -pub async fn patch_storage_version_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified StorageVersion -pub async fn read_storage_version(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified StorageVersion -pub async fn read_storage_version_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified StorageVersion -pub async fn replace_storage_version(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1StorageVersion, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified StorageVersion -pub async fn replace_storage_version_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1StorageVersion, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/internal.apiserver.k8s.io/v1alpha1/storageversions/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/logs_api.rs b/src/apis/logs_api.rs deleted file mode 100644 index 232f9c3..0000000 --- a/src/apis/logs_api.rs +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`log_file_handler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum LogFileHandlerError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`log_file_list_handler`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum LogFileListHandlerError { - Status401(), - UnknownValue(serde_json::Value), -} - - -pub async fn log_file_handler(configuration: &configuration::Configuration, logpath: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/logs/{logpath}", local_var_configuration.base_path, logpath=crate::apis::urlencode(logpath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn log_file_list_handler(configuration: &configuration::Configuration, ) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/logs/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/mod.rs b/src/apis/mod.rs deleted file mode 100644 index 32e1aa1..0000000 --- a/src/apis/mod.rs +++ /dev/null @@ -1,128 +0,0 @@ -use std::error; -use std::fmt; - -#[derive(Debug, Clone)] -pub struct ResponseContent { - pub status: reqwest::StatusCode, - pub content: String, - pub entity: Option, -} - -#[derive(Debug)] -pub enum Error { - Reqwest(reqwest::Error), - Serde(serde_json::Error), - Io(std::io::Error), - ResponseError(ResponseContent), -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let (module, e) = match self { - Error::Reqwest(e) => ("reqwest", e.to_string()), - Error::Serde(e) => ("serde", e.to_string()), - Error::Io(e) => ("IO", e.to_string()), - Error::ResponseError(e) => ("response", format!("status code {}", e.status)), - }; - write!(f, "error in {}: {}", module, e) - } -} - -impl error::Error for Error { - fn source(&self) -> Option<&(dyn error::Error + 'static)> { - Some(match self { - Error::Reqwest(e) => e, - Error::Serde(e) => e, - Error::Io(e) => e, - Error::ResponseError(_) => return None, - }) - } -} - -impl From for Error { - fn from(e: reqwest::Error) -> Self { - Error::Reqwest(e) - } -} - -impl From for Error { - fn from(e: serde_json::Error) -> Self { - Error::Serde(e) - } -} - -impl From for Error { - fn from(e: std::io::Error) -> Self { - Error::Io(e) - } -} - -pub fn urlencode>(s: T) -> String { - ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() -} - -pub mod admissionregistration_api; -pub mod admissionregistration_v1_api; -pub mod admissionregistration_v1alpha1_api; -pub mod admissionregistration_v1beta1_api; -pub mod apiextensions_api; -pub mod apiextensions_v1_api; -pub mod apiregistration_api; -pub mod apiregistration_v1_api; -pub mod apis_api; -pub mod apps_api; -pub mod apps_v1_api; -pub mod authentication_api; -pub mod authentication_v1_api; -pub mod authentication_v1alpha1_api; -pub mod authentication_v1beta1_api; -pub mod authorization_api; -pub mod authorization_v1_api; -pub mod autoscaling_api; -pub mod autoscaling_v1_api; -pub mod autoscaling_v2_api; -pub mod batch_api; -pub mod batch_v1_api; -pub mod certificates_api; -pub mod certificates_v1_api; -pub mod certificates_v1alpha1_api; -pub mod coordination_api; -pub mod coordination_v1_api; -pub mod coordination_v1alpha1_api; -pub mod core_api; -pub mod core_v1_api; -pub mod custom_objects_api; -pub mod discovery_api; -pub mod discovery_v1_api; -pub mod events_api; -pub mod events_v1_api; -pub mod flowcontrol_apiserver_api; -pub mod flowcontrol_apiserver_v1_api; -pub mod flowcontrol_apiserver_v1beta3_api; -pub mod internal_apiserver_api; -pub mod internal_apiserver_v1alpha1_api; -pub mod logs_api; -pub mod networking_api; -pub mod networking_v1_api; -pub mod networking_v1beta1_api; -pub mod node_api; -pub mod node_v1_api; -pub mod openid_api; -pub mod policy_api; -pub mod policy_v1_api; -pub mod rbac_authorization_api; -pub mod rbac_authorization_v1_api; -pub mod resource_api; -pub mod resource_v1alpha3_api; -pub mod scheduling_api; -pub mod scheduling_v1_api; -pub mod storage_api; -pub mod storage_v1_api; -pub mod storage_v1alpha1_api; -pub mod storage_v1beta1_api; -pub mod storagemigration_api; -pub mod storagemigration_v1alpha1_api; -pub mod version_api; -pub mod well_known_api; - -pub mod configuration; diff --git a/src/apis/networking_api.rs b/src/apis/networking_api.rs deleted file mode 100644 index 04f2e79..0000000 --- a/src/apis/networking_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/networking_v1_api.rs b/src/apis/networking_v1_api.rs deleted file mode 100644 index 3ab9017..0000000 --- a/src/apis/networking_v1_api.rs +++ /dev/null @@ -1,1706 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_ingress_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListIngressForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_network_policy_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNetworkPolicyForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_ingress_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedIngressStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_ingress_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedIngressStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_ingress_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceIngressClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_ingress`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedIngressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_ingress_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedIngressStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_network_policy`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedNetworkPolicyError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create an IngressClass -pub async fn create_ingress_class(configuration: &configuration::Configuration, body: crate::models::V1IngressClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create an Ingress -pub async fn create_namespaced_ingress(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Ingress, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a NetworkPolicy -pub async fn create_namespaced_network_policy(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1NetworkPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of IngressClass -pub async fn delete_collection_ingress_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Ingress -pub async fn delete_collection_namespaced_ingress(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of NetworkPolicy -pub async fn delete_collection_namespaced_network_policy(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an IngressClass -pub async fn delete_ingress_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an Ingress -pub async fn delete_namespaced_ingress(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a NetworkPolicy -pub async fn delete_namespaced_network_policy(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind IngressClass -pub async fn list_ingress_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Ingress -pub async fn list_ingress_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingresses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Ingress -pub async fn list_namespaced_ingress(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind NetworkPolicy -pub async fn list_namespaced_network_policy(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind NetworkPolicy -pub async fn list_network_policy_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/networkpolicies", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified IngressClass -pub async fn patch_ingress_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Ingress -pub async fn patch_namespaced_ingress(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified Ingress -pub async fn patch_namespaced_ingress_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified NetworkPolicy -pub async fn patch_namespaced_network_policy(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified IngressClass -pub async fn read_ingress_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Ingress -pub async fn read_namespaced_ingress(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified Ingress -pub async fn read_namespaced_ingress_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified NetworkPolicy -pub async fn read_namespaced_network_policy(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified IngressClass -pub async fn replace_ingress_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1IngressClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/ingressclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Ingress -pub async fn replace_namespaced_ingress(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Ingress, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified Ingress -pub async fn replace_namespaced_ingress_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Ingress, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/ingresses/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified NetworkPolicy -pub async fn replace_namespaced_network_policy(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1NetworkPolicy, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/networking_v1beta1_api.rs b/src/apis/networking_v1beta1_api.rs deleted file mode 100644 index e2b0731..0000000 --- a/src/apis/networking_v1beta1_api.rs +++ /dev/null @@ -1,1110 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_service_cidr_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchServiceCidrStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_service_cidr_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadServiceCidrStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_ip_address`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceIpAddressError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_service_cidr`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceServiceCidrError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_service_cidr_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceServiceCidrStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create an IPAddress -pub async fn create_ip_address(configuration: &configuration::Configuration, body: crate::models::V1beta1IpAddress, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ServiceCIDR -pub async fn create_service_cidr(configuration: &configuration::Configuration, body: crate::models::V1beta1ServiceCidr, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of IPAddress -pub async fn delete_collection_ip_address(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ServiceCIDR -pub async fn delete_collection_service_cidr(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete an IPAddress -pub async fn delete_ip_address(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ServiceCIDR -pub async fn delete_service_cidr(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind IPAddress -pub async fn list_ip_address(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ServiceCIDR -pub async fn list_service_cidr(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified IPAddress -pub async fn patch_ip_address(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ServiceCIDR -pub async fn patch_service_cidr(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ServiceCIDR -pub async fn patch_service_cidr_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified IPAddress -pub async fn read_ip_address(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ServiceCIDR -pub async fn read_service_cidr(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ServiceCIDR -pub async fn read_service_cidr_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified IPAddress -pub async fn replace_ip_address(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1IpAddress, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/ipaddresses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ServiceCIDR -pub async fn replace_service_cidr(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1ServiceCidr, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ServiceCIDR -pub async fn replace_service_cidr_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1ServiceCidr, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/networking.k8s.io/v1beta1/servicecidrs/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/node_api.rs b/src/apis/node_api.rs deleted file mode 100644 index 5fa00b0..0000000 --- a/src/apis/node_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/node_v1_api.rs b/src/apis/node_v1_api.rs deleted file mode 100644 index b080b8b..0000000 --- a/src/apis/node_v1_api.rs +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_runtime_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceRuntimeClassError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a RuntimeClass -pub async fn create_runtime_class(configuration: &configuration::Configuration, body: crate::models::V1RuntimeClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of RuntimeClass -pub async fn delete_collection_runtime_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a RuntimeClass -pub async fn delete_runtime_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind RuntimeClass -pub async fn list_runtime_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified RuntimeClass -pub async fn patch_runtime_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified RuntimeClass -pub async fn read_runtime_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified RuntimeClass -pub async fn replace_runtime_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1RuntimeClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/node.k8s.io/v1/runtimeclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/openid_api.rs b/src/apis/openid_api.rs deleted file mode 100644 index 1af5964..0000000 --- a/src/apis/openid_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_service_account_issuer_open_id_keyset`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetServiceAccountIssuerOpenIdKeysetError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get service account issuer OpenID JSON Web Key Set (contains public token verification keys) -pub async fn get_service_account_issuer_open_id_keyset(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/openid/v1/jwks", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/policy_api.rs b/src/apis/policy_api.rs deleted file mode 100644 index bf5ea80..0000000 --- a/src/apis/policy_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/policy_v1_api.rs b/src/apis/policy_v1_api.rs deleted file mode 100644 index bab1c4f..0000000 --- a/src/apis/policy_v1_api.rs +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_pod_disruption_budget_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPodDisruptionBudgetForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_disruption_budget_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodDisruptionBudgetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_disruption_budget_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodDisruptionBudgetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_disruption_budget`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodDisruptionBudgetError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_disruption_budget_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodDisruptionBudgetStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a PodDisruptionBudget -pub async fn create_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1PodDisruptionBudget, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PodDisruptionBudget -pub async fn delete_collection_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PodDisruptionBudget -pub async fn delete_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PodDisruptionBudget -pub async fn list_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PodDisruptionBudget -pub async fn list_pod_disruption_budget_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/poddisruptionbudgets", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PodDisruptionBudget -pub async fn patch_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified PodDisruptionBudget -pub async fn patch_namespaced_pod_disruption_budget_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PodDisruptionBudget -pub async fn read_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified PodDisruptionBudget -pub async fn read_namespaced_pod_disruption_budget_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PodDisruptionBudget -pub async fn replace_namespaced_pod_disruption_budget(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1PodDisruptionBudget, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified PodDisruptionBudget -pub async fn replace_namespaced_pod_disruption_budget_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1PodDisruptionBudget, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/rbac_authorization_api.rs b/src/apis/rbac_authorization_api.rs deleted file mode 100644 index 97be67a..0000000 --- a/src/apis/rbac_authorization_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/rbac_authorization_v1_api.rs b/src/apis/rbac_authorization_v1_api.rs deleted file mode 100644 index ee62eb1..0000000 --- a/src/apis/rbac_authorization_v1_api.rs +++ /dev/null @@ -1,1984 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_role_binding_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListRoleBindingForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_role_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListRoleForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_cluster_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceClusterRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_cluster_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceClusterRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_role`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedRoleError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_role_binding`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedRoleBindingError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a ClusterRole -pub async fn create_cluster_role(configuration: &configuration::Configuration, body: crate::models::V1ClusterRole, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ClusterRoleBinding -pub async fn create_cluster_role_binding(configuration: &configuration::Configuration, body: crate::models::V1ClusterRoleBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a Role -pub async fn create_namespaced_role(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1Role, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a RoleBinding -pub async fn create_namespaced_role_binding(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1RoleBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ClusterRole -pub async fn delete_cluster_role(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ClusterRoleBinding -pub async fn delete_cluster_role_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ClusterRole -pub async fn delete_collection_cluster_role(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ClusterRoleBinding -pub async fn delete_collection_cluster_role_binding(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of Role -pub async fn delete_collection_namespaced_role(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of RoleBinding -pub async fn delete_collection_namespaced_role_binding(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a Role -pub async fn delete_namespaced_role(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a RoleBinding -pub async fn delete_namespaced_role_binding(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ClusterRole -pub async fn list_cluster_role(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ClusterRoleBinding -pub async fn list_cluster_role_binding(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Role -pub async fn list_namespaced_role(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind RoleBinding -pub async fn list_namespaced_role_binding(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind RoleBinding -pub async fn list_role_binding_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/rolebindings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind Role -pub async fn list_role_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/roles", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ClusterRole -pub async fn patch_cluster_role(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ClusterRoleBinding -pub async fn patch_cluster_role_binding(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified Role -pub async fn patch_namespaced_role(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified RoleBinding -pub async fn patch_namespaced_role_binding(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ClusterRole -pub async fn read_cluster_role(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ClusterRoleBinding -pub async fn read_cluster_role_binding(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified Role -pub async fn read_namespaced_role(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified RoleBinding -pub async fn read_namespaced_role_binding(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ClusterRole -pub async fn replace_cluster_role(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ClusterRole, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterroles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ClusterRoleBinding -pub async fn replace_cluster_role_binding(configuration: &configuration::Configuration, name: &str, body: crate::models::V1ClusterRoleBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified Role -pub async fn replace_namespaced_role(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1Role, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified RoleBinding -pub async fn replace_namespaced_role_binding(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1RoleBinding, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/resource_api.rs b/src/apis/resource_api.rs deleted file mode 100644 index 14b3ee3..0000000 --- a/src/apis/resource_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/resource_v1alpha3_api.rs b/src/apis/resource_v1alpha3_api.rs deleted file mode 100644 index 578317c..0000000 --- a/src/apis/resource_v1alpha3_api.rs +++ /dev/null @@ -1,2831 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_pod_scheduling_context_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPodSchedulingContextForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_resource_claim_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListResourceClaimForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_resource_claim_template_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListResourceClaimTemplateForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_pod_scheduling_context_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedPodSchedulingContextStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_resource_claim_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedResourceClaimStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_pod_scheduling_context_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedPodSchedulingContextStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_resource_claim_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedResourceClaimStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_device_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceDeviceClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_scheduling_context`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodSchedulingContextError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_pod_scheduling_context_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedPodSchedulingContextStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_resource_claim`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedResourceClaimError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_resource_claim_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedResourceClaimStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_resource_claim_template`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedResourceClaimTemplateError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_resource_slice`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceResourceSliceError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a DeviceClass -pub async fn create_device_class(configuration: &configuration::Configuration, body: crate::models::V1alpha3DeviceClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a PodSchedulingContext -pub async fn create_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1alpha3PodSchedulingContext, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ResourceClaim -pub async fn create_namespaced_resource_claim(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1alpha3ResourceClaim, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ResourceClaimTemplate -pub async fn create_namespaced_resource_claim_template(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1alpha3ResourceClaimTemplate, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a ResourceSlice -pub async fn create_resource_slice(configuration: &configuration::Configuration, body: crate::models::V1alpha3ResourceSlice, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of DeviceClass -pub async fn delete_collection_device_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PodSchedulingContext -pub async fn delete_collection_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ResourceClaim -pub async fn delete_collection_namespaced_resource_claim(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ResourceClaimTemplate -pub async fn delete_collection_namespaced_resource_claim_template(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of ResourceSlice -pub async fn delete_collection_resource_slice(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a DeviceClass -pub async fn delete_device_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PodSchedulingContext -pub async fn delete_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ResourceClaim -pub async fn delete_namespaced_resource_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ResourceClaimTemplate -pub async fn delete_namespaced_resource_claim_template(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a ResourceSlice -pub async fn delete_resource_slice(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind DeviceClass -pub async fn list_device_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PodSchedulingContext -pub async fn list_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceClaim -pub async fn list_namespaced_resource_claim(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceClaimTemplate -pub async fn list_namespaced_resource_claim_template(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PodSchedulingContext -pub async fn list_pod_scheduling_context_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/podschedulingcontexts", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceClaim -pub async fn list_resource_claim_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceclaims", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceClaimTemplate -pub async fn list_resource_claim_template_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceclaimtemplates", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind ResourceSlice -pub async fn list_resource_slice(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified DeviceClass -pub async fn patch_device_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PodSchedulingContext -pub async fn patch_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified PodSchedulingContext -pub async fn patch_namespaced_pod_scheduling_context_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ResourceClaim -pub async fn patch_namespaced_resource_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified ResourceClaim -pub async fn patch_namespaced_resource_claim_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ResourceClaimTemplate -pub async fn patch_namespaced_resource_claim_template(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified ResourceSlice -pub async fn patch_resource_slice(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified DeviceClass -pub async fn read_device_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PodSchedulingContext -pub async fn read_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified PodSchedulingContext -pub async fn read_namespaced_pod_scheduling_context_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ResourceClaim -pub async fn read_namespaced_resource_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified ResourceClaim -pub async fn read_namespaced_resource_claim_status(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ResourceClaimTemplate -pub async fn read_namespaced_resource_claim_template(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified ResourceSlice -pub async fn read_resource_slice(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified DeviceClass -pub async fn replace_device_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha3DeviceClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/deviceclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PodSchedulingContext -pub async fn replace_namespaced_pod_scheduling_context(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1alpha3PodSchedulingContext, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified PodSchedulingContext -pub async fn replace_namespaced_pod_scheduling_context_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1alpha3PodSchedulingContext, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/podschedulingcontexts/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ResourceClaim -pub async fn replace_namespaced_resource_claim(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1alpha3ResourceClaim, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified ResourceClaim -pub async fn replace_namespaced_resource_claim_status(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1alpha3ResourceClaim, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaims/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ResourceClaimTemplate -pub async fn replace_namespaced_resource_claim_template(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1alpha3ResourceClaimTemplate, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/namespaces/{namespace}/resourceclaimtemplates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified ResourceSlice -pub async fn replace_resource_slice(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha3ResourceSlice, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/resource.k8s.io/v1alpha3/resourceslices/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/scheduling_api.rs b/src/apis/scheduling_api.rs deleted file mode 100644 index 62cc4e3..0000000 --- a/src/apis/scheduling_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/scheduling_v1_api.rs b/src/apis/scheduling_v1_api.rs deleted file mode 100644 index fae8997..0000000 --- a/src/apis/scheduling_v1_api.rs +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreatePriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionPriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeletePriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListPriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchPriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadPriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_priority_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplacePriorityClassError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a PriorityClass -pub async fn create_priority_class(configuration: &configuration::Configuration, body: crate::models::V1PriorityClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of PriorityClass -pub async fn delete_collection_priority_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a PriorityClass -pub async fn delete_priority_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind PriorityClass -pub async fn list_priority_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified PriorityClass -pub async fn patch_priority_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified PriorityClass -pub async fn read_priority_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified PriorityClass -pub async fn replace_priority_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1PriorityClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/scheduling.k8s.io/v1/priorityclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/storage_api.rs b/src/apis/storage_api.rs deleted file mode 100644 index 2b7512a..0000000 --- a/src/apis/storage_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/storage_v1_api.rs b/src/apis/storage_v1_api.rs deleted file mode 100644 index 485abe1..0000000 --- a/src/apis/storage_v1_api.rs +++ /dev/null @@ -1,2513 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_csi_storage_capacity_for_all_namespaces`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListCsiStorageCapacityForAllNamespacesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_volume_attachment_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchVolumeAttachmentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_volume_attachment_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadVolumeAttachmentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_csi_driver`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCsiDriverError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_csi_node`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceCsiNodeError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_namespaced_csi_storage_capacity`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceNamespacedCsiStorageCapacityError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_storage_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceStorageClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_volume_attachment`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceVolumeAttachmentError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_volume_attachment_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceVolumeAttachmentStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a CSIDriver -pub async fn create_csi_driver(configuration: &configuration::Configuration, body: crate::models::V1CsiDriver, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a CSINode -pub async fn create_csi_node(configuration: &configuration::Configuration, body: crate::models::V1CsiNode, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a CSIStorageCapacity -pub async fn create_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, namespace: &str, body: crate::models::V1CsiStorageCapacity, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a StorageClass -pub async fn create_storage_class(configuration: &configuration::Configuration, body: crate::models::V1StorageClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// create a VolumeAttachment -pub async fn create_volume_attachment(configuration: &configuration::Configuration, body: crate::models::V1VolumeAttachment, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of CSIDriver -pub async fn delete_collection_csi_driver(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of CSINode -pub async fn delete_collection_csi_node(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of CSIStorageCapacity -pub async fn delete_collection_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of StorageClass -pub async fn delete_collection_storage_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of VolumeAttachment -pub async fn delete_collection_volume_attachment(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a CSIDriver -pub async fn delete_csi_driver(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a CSINode -pub async fn delete_csi_node(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a CSIStorageCapacity -pub async fn delete_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a StorageClass -pub async fn delete_storage_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a VolumeAttachment -pub async fn delete_volume_attachment(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CSIDriver -pub async fn list_csi_driver(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CSINode -pub async fn list_csi_node(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CSIStorageCapacity -pub async fn list_csi_storage_capacity_for_all_namespaces(configuration: &configuration::Configuration, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, pretty: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csistoragecapacities", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind CSIStorageCapacity -pub async fn list_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, namespace: &str, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities", local_var_configuration.base_path, namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind StorageClass -pub async fn list_storage_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind VolumeAttachment -pub async fn list_volume_attachment(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified CSIDriver -pub async fn patch_csi_driver(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified CSINode -pub async fn patch_csi_node(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified CSIStorageCapacity -pub async fn patch_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, name: &str, namespace: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified StorageClass -pub async fn patch_storage_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified VolumeAttachment -pub async fn patch_volume_attachment(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified VolumeAttachment -pub async fn patch_volume_attachment_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified CSIDriver -pub async fn read_csi_driver(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified CSINode -pub async fn read_csi_node(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified CSIStorageCapacity -pub async fn read_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, name: &str, namespace: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified StorageClass -pub async fn read_storage_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified VolumeAttachment -pub async fn read_volume_attachment(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified VolumeAttachment -pub async fn read_volume_attachment_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified CSIDriver -pub async fn replace_csi_driver(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CsiDriver, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csidrivers/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified CSINode -pub async fn replace_csi_node(configuration: &configuration::Configuration, name: &str, body: crate::models::V1CsiNode, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/csinodes/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified CSIStorageCapacity -pub async fn replace_namespaced_csi_storage_capacity(configuration: &configuration::Configuration, name: &str, namespace: &str, body: crate::models::V1CsiStorageCapacity, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name), namespace=crate::apis::urlencode(namespace)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified StorageClass -pub async fn replace_storage_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1StorageClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/storageclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified VolumeAttachment -pub async fn replace_volume_attachment(configuration: &configuration::Configuration, name: &str, body: crate::models::V1VolumeAttachment, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified VolumeAttachment -pub async fn replace_volume_attachment_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1VolumeAttachment, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1/volumeattachments/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/storage_v1alpha1_api.rs b/src/apis/storage_v1alpha1_api.rs deleted file mode 100644 index 1734c74..0000000 --- a/src/apis/storage_v1alpha1_api.rs +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a VolumeAttributesClass -pub async fn create_volume_attributes_class(configuration: &configuration::Configuration, body: crate::models::V1alpha1VolumeAttributesClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of VolumeAttributesClass -pub async fn delete_collection_volume_attributes_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a VolumeAttributesClass -pub async fn delete_volume_attributes_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind VolumeAttributesClass -pub async fn list_volume_attributes_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified VolumeAttributesClass -pub async fn patch_volume_attributes_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified VolumeAttributesClass -pub async fn read_volume_attributes_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified VolumeAttributesClass -pub async fn replace_volume_attributes_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1VolumeAttributesClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1alpha1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/storage_v1beta1_api.rs b/src/apis/storage_v1beta1_api.rs deleted file mode 100644 index fd70c01..0000000 --- a/src/apis/storage_v1beta1_api.rs +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_volume_attributes_class`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceVolumeAttributesClassError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a VolumeAttributesClass -pub async fn create_volume_attributes_class(configuration: &configuration::Configuration, body: crate::models::V1beta1VolumeAttributesClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of VolumeAttributesClass -pub async fn delete_collection_volume_attributes_class(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a VolumeAttributesClass -pub async fn delete_volume_attributes_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind VolumeAttributesClass -pub async fn list_volume_attributes_class(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified VolumeAttributesClass -pub async fn patch_volume_attributes_class(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified VolumeAttributesClass -pub async fn read_volume_attributes_class(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified VolumeAttributesClass -pub async fn replace_volume_attributes_class(configuration: &configuration::Configuration, name: &str, body: crate::models::V1beta1VolumeAttributesClass, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storage.k8s.io/v1beta1/volumeattributesclasses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/storagemigration_api.rs b/src/apis/storagemigration_api.rs deleted file mode 100644 index e812bf8..0000000 --- a/src/apis/storagemigration_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_api_group`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiGroupError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get information of a group -pub async fn get_api_group(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/storagemigration_v1alpha1_api.rs b/src/apis/storagemigration_v1alpha1_api.rs deleted file mode 100644 index 313d322..0000000 --- a/src/apis/storagemigration_v1alpha1_api.rs +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_collection_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCollectionStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_api_resources`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetApiResourcesError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`list_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`patch_storage_version_migration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PatchStorageVersionMigrationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`read_storage_version_migration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReadStorageVersionMigrationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_storage_version_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceStorageVersionMigrationError { - Status401(), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`replace_storage_version_migration_status`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ReplaceStorageVersionMigrationStatusError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// create a StorageVersionMigration -pub async fn create_storage_version_migration(configuration: &configuration::Configuration, body: crate::models::V1alpha1StorageVersionMigration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete collection of StorageVersionMigration -pub async fn delete_collection_storage_version_migration(configuration: &configuration::Configuration, pretty: Option<&str>, _continue: Option<&str>, dry_run: Option<&str>, field_selector: Option<&str>, grace_period_seconds: Option, label_selector: Option<&str>, limit: Option, orphan_dependents: Option, propagation_policy: Option<&str>, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// delete a StorageVersionMigration -pub async fn delete_storage_version_migration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>, dry_run: Option<&str>, grace_period_seconds: Option, orphan_dependents: Option, propagation_policy: Option<&str>, body: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = grace_period_seconds { - local_var_req_builder = local_var_req_builder.query(&[("gracePeriodSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = orphan_dependents { - local_var_req_builder = local_var_req_builder.query(&[("orphanDependents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = propagation_policy { - local_var_req_builder = local_var_req_builder.query(&[("propagationPolicy", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// get available resources -pub async fn get_api_resources(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// list or watch objects of kind StorageVersionMigration -pub async fn list_storage_version_migration(configuration: &configuration::Configuration, pretty: Option<&str>, allow_watch_bookmarks: Option, _continue: Option<&str>, field_selector: Option<&str>, label_selector: Option<&str>, limit: Option, resource_version: Option<&str>, resource_version_match: Option<&str>, send_initial_events: Option, timeout_seconds: Option, watch: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = allow_watch_bookmarks { - local_var_req_builder = local_var_req_builder.query(&[("allowWatchBookmarks", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = _continue { - local_var_req_builder = local_var_req_builder.query(&[("continue", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_selector { - local_var_req_builder = local_var_req_builder.query(&[("fieldSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = label_selector { - local_var_req_builder = local_var_req_builder.query(&[("labelSelector", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersion", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = resource_version_match { - local_var_req_builder = local_var_req_builder.query(&[("resourceVersionMatch", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = send_initial_events { - local_var_req_builder = local_var_req_builder.query(&[("sendInitialEvents", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = timeout_seconds { - local_var_req_builder = local_var_req_builder.query(&[("timeoutSeconds", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = watch { - local_var_req_builder = local_var_req_builder.query(&[("watch", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update the specified StorageVersionMigration -pub async fn patch_storage_version_migration(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// partially update status of the specified StorageVersionMigration -pub async fn patch_storage_version_migration_status(configuration: &configuration::Configuration, name: &str, body: serde_json::Value, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>, force: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = force { - local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read the specified StorageVersionMigration -pub async fn read_storage_version_migration(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// read status of the specified StorageVersionMigration -pub async fn read_storage_version_migration_status(configuration: &configuration::Configuration, name: &str, pretty: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace the specified StorageVersionMigration -pub async fn replace_storage_version_migration(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1StorageVersionMigration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// replace status of the specified StorageVersionMigration -pub async fn replace_storage_version_migration_status(configuration: &configuration::Configuration, name: &str, body: crate::models::V1alpha1StorageVersionMigration, pretty: Option<&str>, dry_run: Option<&str>, field_manager: Option<&str>, field_validation: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}/status", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = pretty { - local_var_req_builder = local_var_req_builder.query(&[("pretty", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = dry_run { - local_var_req_builder = local_var_req_builder.query(&[("dryRun", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_manager { - local_var_req_builder = local_var_req_builder.query(&[("fieldManager", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = field_validation { - local_var_req_builder = local_var_req_builder.query(&[("fieldValidation", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - local_var_req_builder = local_var_req_builder.json(&body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/version_api.rs b/src/apis/version_api.rs deleted file mode 100644 index 389bc00..0000000 --- a/src/apis/version_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_code`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetCodeError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get the code version -pub async fn get_code(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/version/", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/apis/well_known_api.rs b/src/apis/well_known_api.rs deleted file mode 100644 index 1f345be..0000000 --- a/src/apis/well_known_api.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Kubernetes - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1.31.3 - * - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::apis::ResponseContent; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`get_service_account_issuer_open_id_configuration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetServiceAccountIssuerOpenIdConfigurationError { - Status401(), - UnknownValue(serde_json::Value), -} - - -/// get service account issuer OpenID configuration, also known as the 'OIDC discovery doc' -pub async fn get_service_account_issuer_open_id_configuration(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/.well-known/openid-configuration", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("authorization", local_var_value); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/src/lib.rs b/src/lib.rs index c1dd666..543c941 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,5 @@ extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate url; -extern crate reqwest; -pub mod apis; pub mod models;