From e90af5a25de1cfbaf810240e73b410f312e692d3 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Wed, 27 Mar 2024 11:22:49 -0700 Subject: [PATCH] working? --- progenitor-impl/src/lib.rs | 69 +- progenitor-impl/src/method.rs | 98 +- .../tests/output/src/buildomat_builder.rs | 1141 +- .../output/src/buildomat_builder_tagged.rs | 1141 +- .../tests/output/src/buildomat_positional.rs | 345 +- .../tests/output/src/keeper_builder.rs | 412 +- .../tests/output/src/keeper_builder_tagged.rs | 412 +- .../tests/output/src/keeper_positional.rs | 153 +- .../tests/output/src/nexus_builder.rs | 16506 ++++++++++----- .../tests/output/src/nexus_builder_tagged.rs | 17291 +++++++++++----- .../tests/output/src/nexus_positional.rs | 6047 +++--- .../output/src/param_collision_builder.rs | 73 +- .../src/param_collision_builder_tagged.rs | 73 +- .../output/src/param_collision_positional.rs | 22 +- .../output/src/param_overrides_builder.rs | 71 +- .../src/param_overrides_builder_tagged.rs | 71 +- .../output/src/param_overrides_positional.rs | 22 +- .../output/src/propolis_server_builder.rs | 544 +- .../src/propolis_server_builder_tagged.rs | 544 +- .../output/src/propolis_server_positional.rs | 154 +- .../output/src/test_default_params_builder.rs | 57 +- .../src/test_default_params_positional.rs | 8 +- .../output/src/test_freeform_response.rs | 8 +- .../output/src/test_renamed_parameters.rs | 42 +- 24 files changed, 29639 insertions(+), 15665 deletions(-) diff --git a/progenitor-impl/src/lib.rs b/progenitor-impl/src/lib.rs index b59e256a..be096c51 100644 --- a/progenitor-impl/src/lib.rs +++ b/progenitor-impl/src/lib.rs @@ -350,8 +350,9 @@ impl Generator { let version_str = &spec.info.version; - // The allow(unused_imports) on the `pub use` is necessary with Rust 1.76+, in case the - // generated file is not at the top level of the crate. + // The allow(unused_imports) on the `pub use` is necessary with Rust + // 1.76+, in case the generated file is not at the top level of the + // crate. let file = quote! { // Re-export ResponseValue and Error since those are used by the @@ -461,8 +462,9 @@ impl Generator { .map(|method| self.positional_method(method)) .collect::>>()?; - // The allow(unused_imports) on the `pub use` is necessary with Rust 1.76+, in case the - // generated file is not at the top level of the crate. + // The allow(unused_imports) on the `pub use` is necessary with Rust + // 1.76+, in case the generated file is not at the top level of the + // crate. let out = quote! { #[allow(clippy::all)] @@ -483,16 +485,25 @@ impl Generator { &mut self, input_methods: &[method::OperationMethod], ) -> Result { - let builder_struct = input_methods + let (builder_struct, built_struct): ( + Vec, + Vec, + ) = input_methods .iter() .map(|method| self.builder_struct(method, TagStyle::Merged)) - .collect::>>()?; + .collect::>>()? + .into_iter() + .unzip(); let builder_methods = input_methods .iter() .map(|method| self.builder_impl(method)) .collect::>(); + // The allow(unused_imports) on the `pub use` is necessary with Rust + // 1.76+, in case the generated file is not at the top level of the + // crate. + let out = quote! { impl Client { #(#builder_methods)* @@ -513,6 +524,21 @@ impl Generator { ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, + ByteStream, + Error, + HeaderMap, + HeaderValue, + RequestBuilderExt, + ResponseValue, + }; + #(#built_struct)* + } + #(#builder_struct)* } @@ -530,16 +556,22 @@ impl Generator { input_methods: &[method::OperationMethod], tag_info: BTreeMap<&String, &openapiv3::Tag>, ) -> Result { - let builder_struct = input_methods + let (builder_struct, built_struct): ( + Vec, + Vec, + ) = input_methods .iter() - .map(|method| self.builder_struct(method, TagStyle::Separate)) - .collect::>>()?; + .map(|method| self.builder_struct(method, TagStyle::Merged)) + .collect::>>()? + .into_iter() + .unzip(); let (traits_and_impls, trait_preludes) = self.builder_tags(input_methods, &tag_info); - // The allow(unused_imports) on the `pub use` is necessary with Rust 1.76+, in case the - // generated file is not at the top level of the crate. + // The allow(unused_imports) on the `pub use` is necessary with Rust + // 1.76+, in case the generated file is not at the top level of the + // crate. let out = quote! { #traits_and_impls @@ -559,6 +591,21 @@ impl Generator { ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, + ByteStream, + Error, + HeaderMap, + HeaderValue, + RequestBuilderExt, + ResponseValue, + }; + #(#built_struct)* + } + #(#builder_struct)* } diff --git a/progenitor-impl/src/method.rs b/progenitor-impl/src/method.rs index fdf53a94..4e2d9b7f 100644 --- a/progenitor-impl/src/method.rs +++ b/progenitor-impl/src/method.rs @@ -78,7 +78,8 @@ impl HttpMethod { struct MethodSigBody { success: TokenStream, error: TokenStream, - body: TokenStream, + build: TokenStream, + send: TokenStream, } struct BuilderImpl { @@ -657,7 +658,8 @@ impl Generator { let MethodSigBody { success: success_type, error: error_type, - body, + build, + send, } = self.method_sig_body(method, quote! { self })?; let method_impl = quote! { @@ -669,7 +671,11 @@ impl Generator { ResponseValue<#success_type>, Error<#error_type>, > { - #body + #[allow(unused_mut)] + let mut request = { + #build + }.build()?; + #send } }; @@ -831,7 +837,6 @@ impl Generator { // Generate a unique Ident for internal variables let url_ident = unique_ident_from("url", ¶m_names); let query_ident = unique_ident_from("query", ¶m_names); - let request_ident = unique_ident_from("request", ¶m_names); let response_ident = unique_ident_from("response", ¶m_names); let result_ident = unique_ident_from("result", ¶m_names); @@ -1138,12 +1143,12 @@ impl Generator { let pre_hook = self.settings.pre_hook.as_ref().map(|hook| { quote! { - (#hook)(&#client.inner, &#request_ident); + (#hook)(&#client.inner, &request); } }); let pre_hook_async = self.settings.pre_hook_async.as_ref().map(|hook| { quote! { - match (#hook)(&#client.inner, &mut #request_ident).await { + match (#hook)(&#client.inner, &mut request).await { Ok(_) => (), Err(e) => return Err(Error::PreHookError(e.to_string())), } @@ -1157,26 +1162,27 @@ impl Generator { let method_func = format_ident!("{}", method.method.as_str()); - let body_impl = quote! { + let build_impl = quote! { #url_path #query_build #headers_build - #[allow(unused_mut)] - let mut #request_ident = #client.client + #client.client . #method_func (#url_ident) #accept_header #(#body_func)* #query_use #headers_use #websock_hdrs - .build()?; + }; + // Assumes `request: reqwest::Request` + let send_impl = quote! { #pre_hook #pre_hook_async let #result_ident = #client.client - .execute(#request_ident) + .execute(request) .await; #post_hook @@ -1221,7 +1227,8 @@ impl Generator { Ok(MethodSigBody { success: response_type.into_tokens(&self.type_space), error: error_type.into_tokens(&self.type_space), - body: body_impl, + build: build_impl, + send: send_impl, }) } @@ -1419,14 +1426,14 @@ impl Generator { /// also has a corresponding method: /// ```ignore /// impl<'a> OperationId<'a> { - /// pub fn param_1(self, value: V) + /// pub fn param_1(self, value: V) -> Self /// where V: std::convert::TryInto /// { /// self.param_1 = value.try_into() /// .map_err(|_| #err_msg.to_string()); /// self /// } - /// pub fn param_2(self, value: V) + /// pub fn param_2(self, value: V) -> Self /// where V: std::convert::TryInto /// { /// self.param_2 = value.try_into() @@ -1481,7 +1488,7 @@ impl Generator { &mut self, method: &OperationMethod, tag_style: TagStyle, - ) -> Result { + ) -> Result<(TokenStream, TokenStream)> { let struct_name = sanitize(&method.operation_id, Case::Pascal); let struct_ident = format_ident!("{}", struct_name); @@ -1724,8 +1731,9 @@ impl Generator { let MethodSigBody { success, error, - body, - } = self.method_sig_body(method, quote! { #client_ident })?; + build, + send, + } = self.method_sig_body(method, quote! { client })?; let send_doc = format!( "Sends a `{}` request to `{}`", @@ -1738,6 +1746,14 @@ impl Generator { ResponseValue<#success>, Error<#error>, > { + self.build()?.send().await + } + }; + + let build_impl = quote! { + pub fn build(self) + -> Result, Error<#error>> + { // Destructure the builder for convenience. let Self { #client_ident, @@ -1757,8 +1773,11 @@ impl Generator { .map_err(Error::InvalidRequest)?; )* - // Do the work. - #body + let request = {#build}; + Ok(built::#struct_ident { + client: #client_ident, + request, + }) } }; @@ -1938,7 +1957,7 @@ impl Generator { } }; - Ok(quote! { + let builder = quote! { #[doc = #struct_doc] #derive pub struct #struct_ident<'a> { @@ -1956,9 +1975,46 @@ impl Generator { #( #param_impls )* #send_impl + #build_impl #stream_impl } - }) + }; + + let built = quote! { + pub struct #struct_ident<'a> { + pub (crate) client: &'a super::super::Client, + pub (crate) request: reqwest::RequestBuilder, + } + + impl<'a> #struct_ident<'a> { + pub async fn send(self) -> Result< + ResponseValue<#success>, + Error<#error>, + > { + let Self { + client, + request + } = self; + + #[allow(unused_mut)] + let mut request = request.build()?; + + #send + } + + pub fn map_request(self, f: F) -> Self + where F: Fn(reqwest::RequestBuilder) + -> reqwest::RequestBuilder + { + Self { + client: self.client, + request: f(self.request) + } + } + } + }; + + Ok((builder, built)) } fn builder_helper(&self, method: &OperationMethod) -> BuilderImpl { diff --git a/progenitor-impl/tests/output/src/buildomat_builder.rs b/progenitor-impl/tests/output/src/buildomat_builder.rs index c42c7309..51b48165 100644 --- a/progenitor-impl/tests/output/src/buildomat_builder.rs +++ b/progenitor-impl/tests/output/src/buildomat_builder.rs @@ -2388,6 +2388,548 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct ControlHold<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ControlHold<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ControlResume<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ControlResume<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskGet<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TasksGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TasksGet<'a> { + pub async fn send(self) -> Result>, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskSubmit<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskSubmit<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskEventsGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskEventsGet<'a> { + pub async fn send(self) -> Result>, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskOutputsGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskOutputsGet<'a> { + pub async fn send(self) -> Result>, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskOutputDownload<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskOutputDownload<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UserCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UserCreate<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct Whoami<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Whoami<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WhoamiPutName<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WhoamiPutName<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerBootstrap<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerBootstrap<'a> { + pub async fn send( + self, + ) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerPing<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerPing<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskAppend<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskAppend<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskUploadChunk<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskUploadChunk<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskComplete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskComplete<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskAddOutput<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskAddOutput<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkersList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkersList<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkersRecycle<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkersRecycle<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::control_hold`] /// ///[`Client::control_hold`]: super::Client::control_hold @@ -2403,23 +2945,22 @@ pub mod builder { ///Sends a `POST` request to `/v1/control/hold` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/control/hold", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/v1/control/hold", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ControlHold { + client: client, + request, + }) } } @@ -2438,16 +2979,19 @@ pub mod builder { ///Sends a `POST` request to `/v1/control/resume` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/control/resume", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/control/resume", client.baseurl,); + client.client.post(url) + }; + Ok(built::ControlResume { + client: client, + request, + }) } } @@ -2480,28 +3024,27 @@ pub mod builder { ///Sends a `GET` request to `/v1/task/{task}` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task } = self; let task = task.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/task/{}", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/task/{}", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::TaskGet { + client: client, + request, + }) } } @@ -2520,23 +3063,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks` pub async fn send(self) -> Result>, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/tasks", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/tasks", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::TasksGet { + client: client, + request, + }) } } @@ -2579,27 +3121,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/tasks` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body .and_then(|v| types::TaskSubmit::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/tasks", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/tasks", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::TaskSubmit { + client: client, + request, + }) } } @@ -2645,6 +3189,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks/{task}/events` pub async fn send(self) -> Result>, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, @@ -2652,31 +3200,29 @@ pub mod builder { } = self; let task = task.map_err(Error::InvalidRequest)?; let minseq = minseq.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/tasks/{}/events", - client.baseurl, - encode_path(&task.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &minseq { - query.push(("minseq", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/tasks/{}/events", + client.baseurl, + encode_path(&task.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &minseq { + query.push(("minseq", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::TaskEventsGet { + client: client, + request, + }) } } @@ -2709,28 +3255,27 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks/{task}/outputs` pub async fn send(self) -> Result>, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task } = self; let task = task.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/tasks/{}/outputs", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/tasks/{}/outputs", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::TaskOutputsGet { + client: client, + request, + }) } } @@ -2775,6 +3320,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, @@ -2782,20 +3331,19 @@ pub mod builder { } = self; let task = task.map_err(Error::InvalidRequest)?; let output = output.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/tasks/{}/outputs/{}", - client.baseurl, - encode_path(&task.to_string()), - encode_path(&output.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.get(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/tasks/{}/outputs/{}", + client.baseurl, + encode_path(&task.to_string()), + encode_path(&output.to_string()), + ); + client.client.get(url) + }; + Ok(built::TaskOutputDownload { + client: client, + request, + }) } } @@ -2838,27 +3386,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/users` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body .and_then(|v| types::UserCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/users", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/users", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::UserCreate { + client: client, + request, + }) } } @@ -2877,23 +3427,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/whoami` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/whoami", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/whoami", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::Whoami { + client: client, + request, + }) } } @@ -2927,25 +3476,27 @@ pub mod builder { ///Sends a `PUT` request to `/v1/whoami/name` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/whoami/name", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("text/plain"), - ) - .body(body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/whoami/name", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("text/plain"), + ) + .body(body) + }; + Ok(built::WhoamiPutName { + client: client, + request, + }) } } @@ -2988,27 +3539,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/bootstrap` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body .and_then(|v| types::WorkerBootstrap::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/worker/bootstrap", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/worker/bootstrap", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::WorkerBootstrap { + client: client, + request, + }) } } @@ -3027,23 +3580,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/worker/ping` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/worker/ping", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/worker/ping", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::WorkerPing { + client: client, + request, + }) } } @@ -3100,24 +3652,27 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/append` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body .and_then(|v| types::WorkerAppendTask::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/append", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/append", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::WorkerTaskAppend { + client: client, + request, + }) } } @@ -3162,34 +3717,36 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/chunk` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/chunk", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/chunk", + client.baseurl, + encode_path(&task.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + }; + Ok(built::WorkerTaskUploadChunk { + client: client, + request, + }) } } @@ -3246,24 +3803,27 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/complete` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body .and_then(|v| types::WorkerCompleteTask::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/complete", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/complete", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::WorkerTaskComplete { + client: client, + request, + }) } } @@ -3318,24 +3878,27 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/output` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body .and_then(|v| types::WorkerAddOutput::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/output", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/output", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::WorkerTaskAddOutput { + client: client, + request, + }) } } @@ -3354,23 +3917,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/workers` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/workers", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/workers", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::WorkersList { + client: client, + request, + }) } } @@ -3389,16 +3951,19 @@ pub mod builder { ///Sends a `POST` request to `/v1/workers/recycle` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/workers/recycle", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/workers/recycle", client.baseurl,); + client.client.post(url) + }; + Ok(built::WorkersRecycle { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/buildomat_builder_tagged.rs b/progenitor-impl/tests/output/src/buildomat_builder_tagged.rs index 07590907..c30aa27c 100644 --- a/progenitor-impl/tests/output/src/buildomat_builder_tagged.rs +++ b/progenitor-impl/tests/output/src/buildomat_builder_tagged.rs @@ -2388,6 +2388,548 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct ControlHold<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ControlHold<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ControlResume<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ControlResume<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskGet<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TasksGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TasksGet<'a> { + pub async fn send(self) -> Result>, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskSubmit<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskSubmit<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskEventsGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskEventsGet<'a> { + pub async fn send(self) -> Result>, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskOutputsGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskOutputsGet<'a> { + pub async fn send(self) -> Result>, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TaskOutputDownload<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TaskOutputDownload<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UserCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UserCreate<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct Whoami<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Whoami<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WhoamiPutName<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WhoamiPutName<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerBootstrap<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerBootstrap<'a> { + pub async fn send( + self, + ) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerPing<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerPing<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskAppend<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskAppend<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskUploadChunk<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskUploadChunk<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskComplete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskComplete<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkerTaskAddOutput<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkerTaskAddOutput<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkersList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkersList<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct WorkersRecycle<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> WorkersRecycle<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::control_hold`] /// ///[`Client::control_hold`]: super::Client::control_hold @@ -2403,23 +2945,22 @@ pub mod builder { ///Sends a `POST` request to `/v1/control/hold` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/control/hold", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/v1/control/hold", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ControlHold { + client: client, + request, + }) } } @@ -2438,16 +2979,19 @@ pub mod builder { ///Sends a `POST` request to `/v1/control/resume` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/control/resume", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/control/resume", client.baseurl,); + client.client.post(url) + }; + Ok(built::ControlResume { + client: client, + request, + }) } } @@ -2480,28 +3024,27 @@ pub mod builder { ///Sends a `GET` request to `/v1/task/{task}` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task } = self; let task = task.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/task/{}", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/task/{}", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::TaskGet { + client: client, + request, + }) } } @@ -2520,23 +3063,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks` pub async fn send(self) -> Result>, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/tasks", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/tasks", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::TasksGet { + client: client, + request, + }) } } @@ -2579,27 +3121,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/tasks` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body .and_then(|v| types::TaskSubmit::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/tasks", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/tasks", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::TaskSubmit { + client: client, + request, + }) } } @@ -2645,6 +3189,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks/{task}/events` pub async fn send(self) -> Result>, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, @@ -2652,31 +3200,29 @@ pub mod builder { } = self; let task = task.map_err(Error::InvalidRequest)?; let minseq = minseq.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/tasks/{}/events", - client.baseurl, - encode_path(&task.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &minseq { - query.push(("minseq", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/tasks/{}/events", + client.baseurl, + encode_path(&task.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &minseq { + query.push(("minseq", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::TaskEventsGet { + client: client, + request, + }) } } @@ -2709,28 +3255,27 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks/{task}/outputs` pub async fn send(self) -> Result>, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task } = self; let task = task.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/tasks/{}/outputs", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/tasks/{}/outputs", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::TaskOutputsGet { + client: client, + request, + }) } } @@ -2775,6 +3320,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, @@ -2782,20 +3331,19 @@ pub mod builder { } = self; let task = task.map_err(Error::InvalidRequest)?; let output = output.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/tasks/{}/outputs/{}", - client.baseurl, - encode_path(&task.to_string()), - encode_path(&output.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.get(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/tasks/{}/outputs/{}", + client.baseurl, + encode_path(&task.to_string()), + encode_path(&output.to_string()), + ); + client.client.get(url) + }; + Ok(built::TaskOutputDownload { + client: client, + request, + }) } } @@ -2838,27 +3386,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/users` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body .and_then(|v| types::UserCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/users", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/users", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::UserCreate { + client: client, + request, + }) } } @@ -2877,23 +3427,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/whoami` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/whoami", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/whoami", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::Whoami { + client: client, + request, + }) } } @@ -2927,25 +3476,27 @@ pub mod builder { ///Sends a `PUT` request to `/v1/whoami/name` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/whoami/name", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("text/plain"), - ) - .body(body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/whoami/name", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("text/plain"), + ) + .body(body) + }; + Ok(built::WhoamiPutName { + client: client, + request, + }) } } @@ -2988,27 +3539,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/bootstrap` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body .and_then(|v| types::WorkerBootstrap::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/worker/bootstrap", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/worker/bootstrap", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::WorkerBootstrap { + client: client, + request, + }) } } @@ -3027,23 +3580,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/worker/ping` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/worker/ping", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/worker/ping", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::WorkerPing { + client: client, + request, + }) } } @@ -3100,24 +3652,27 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/append` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body .and_then(|v| types::WorkerAppendTask::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/append", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/append", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::WorkerTaskAppend { + client: client, + request, + }) } } @@ -3162,34 +3717,36 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/chunk` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/chunk", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/chunk", + client.baseurl, + encode_path(&task.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + }; + Ok(built::WorkerTaskUploadChunk { + client: client, + request, + }) } } @@ -3246,24 +3803,27 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/complete` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body .and_then(|v| types::WorkerCompleteTask::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/complete", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/complete", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::WorkerTaskComplete { + client: client, + request, + }) } } @@ -3318,24 +3878,27 @@ pub mod builder { ///Sends a `POST` request to `/v1/worker/task/{task}/output` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body .and_then(|v| types::WorkerAddOutput::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/worker/task/{}/output", - client.baseurl, - encode_path(&task.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/worker/task/{}/output", + client.baseurl, + encode_path(&task.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::WorkerTaskAddOutput { + client: client, + request, + }) } } @@ -3354,23 +3917,22 @@ pub mod builder { ///Sends a `GET` request to `/v1/workers` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/workers", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/workers", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::WorkersList { + client: client, + request, + }) } } @@ -3389,16 +3951,19 @@ pub mod builder { ///Sends a `POST` request to `/v1/workers/recycle` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client } = self; - let url = format!("{}/v1/workers/recycle", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/workers/recycle", client.baseurl,); + client.client.post(url) + }; + Ok(built::WorkersRecycle { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/buildomat_positional.rs b/progenitor-impl/tests/output/src/buildomat_positional.rs index 55f23072..a024c52b 100644 --- a/progenitor-impl/tests/output/src/buildomat_positional.rs +++ b/progenitor-impl/tests/output/src/buildomat_positional.rs @@ -827,16 +827,16 @@ impl Client { impl Client { ///Sends a `POST` request to `/v1/control/hold` pub async fn control_hold<'a>(&'a self) -> Result, Error<()>> { - let url = format!("{}/v1/control/hold", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!("{}/v1/control/hold", self.baseurl,); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -847,9 +847,13 @@ impl Client { ///Sends a `POST` request to `/v1/control/resume` pub async fn control_resume<'a>(&'a self) -> Result, Error<()>> { - let url = format!("{}/v1/control/resume", self.baseurl,); #[allow(unused_mut)] - let mut request = self.client.post(url).build()?; + let mut request = { + let url = format!("{}/v1/control/resume", self.baseurl,); + self.client.post(url) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -863,20 +867,20 @@ impl Client { &'a self, task: &'a str, ) -> Result, Error<()>> { - let url = format!( - "{}/v1/task/{}", - self.baseurl, - encode_path(&task.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/task/{}", + self.baseurl, + encode_path(&task.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -887,16 +891,16 @@ impl Client { ///Sends a `GET` request to `/v1/tasks` pub async fn tasks_get<'a>(&'a self) -> Result>, Error<()>> { - let url = format!("{}/v1/tasks", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/v1/tasks", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -910,17 +914,19 @@ impl Client { &'a self, body: &'a types::TaskSubmit, ) -> Result, Error<()>> { - let url = format!("{}/v1/tasks", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/v1/tasks", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -935,26 +941,27 @@ impl Client { task: &'a str, minseq: Option, ) -> Result>, Error<()>> { - let url = format!( - "{}/v1/tasks/{}/events", - self.baseurl, - encode_path(&task.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &minseq { - query.push(("minseq", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/tasks/{}/events", + self.baseurl, + encode_path(&task.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &minseq { + query.push(("minseq", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -968,20 +975,20 @@ impl Client { &'a self, task: &'a str, ) -> Result>, Error<()>> { - let url = format!( - "{}/v1/tasks/{}/outputs", - self.baseurl, - encode_path(&task.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/tasks/{}/outputs", + self.baseurl, + encode_path(&task.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -996,14 +1003,18 @@ impl Client { task: &'a str, output: &'a str, ) -> Result, Error<()>> { - let url = format!( - "{}/v1/tasks/{}/outputs/{}", - self.baseurl, - encode_path(&task.to_string()), - encode_path(&output.to_string()), - ); #[allow(unused_mut)] - let mut request = self.client.get(url).build()?; + let mut request = { + let url = format!( + "{}/v1/tasks/{}/outputs/{}", + self.baseurl, + encode_path(&task.to_string()), + encode_path(&output.to_string()), + ); + self.client.get(url) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1017,17 +1028,19 @@ impl Client { &'a self, body: &'a types::UserCreate, ) -> Result, Error<()>> { - let url = format!("{}/v1/users", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/v1/users", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1038,16 +1051,16 @@ impl Client { ///Sends a `GET` request to `/v1/whoami` pub async fn whoami<'a>(&'a self) -> Result, Error<()>> { - let url = format!("{}/v1/whoami", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/v1/whoami", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1061,17 +1074,19 @@ impl Client { &'a self, body: String, ) -> Result, Error<()>> { - let url = format!("{}/v1/whoami/name", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("text/plain"), - ) - .body(body) - .build()?; + let mut request = { + let url = format!("{}/v1/whoami/name", self.baseurl,); + self.client + .put(url) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("text/plain"), + ) + .body(body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1085,17 +1100,19 @@ impl Client { &'a self, body: &'a types::WorkerBootstrap, ) -> Result, Error<()>> { - let url = format!("{}/v1/worker/bootstrap", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/v1/worker/bootstrap", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1108,16 +1125,16 @@ impl Client { pub async fn worker_ping<'a>( &'a self, ) -> Result, Error<()>> { - let url = format!("{}/v1/worker/ping", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/v1/worker/ping", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1132,13 +1149,17 @@ impl Client { task: &'a str, body: &'a types::WorkerAppendTask, ) -> Result, Error<()>> { - let url = format!( - "{}/v1/worker/task/{}/append", - self.baseurl, - encode_path(&task.to_string()), - ); #[allow(unused_mut)] - let mut request = self.client.post(url).json(&body).build()?; + let mut request = { + let url = format!( + "{}/v1/worker/task/{}/append", + self.baseurl, + encode_path(&task.to_string()), + ); + self.client.post(url).json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1153,25 +1174,27 @@ impl Client { task: &'a str, body: B, ) -> Result, Error<()>> { - let url = format!( - "{}/v1/worker/task/{}/chunk", - self.baseurl, - encode_path(&task.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .build()?; + let mut request = { + let url = format!( + "{}/v1/worker/task/{}/chunk", + self.baseurl, + encode_path(&task.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1186,13 +1209,17 @@ impl Client { task: &'a str, body: &'a types::WorkerCompleteTask, ) -> Result, Error<()>> { - let url = format!( - "{}/v1/worker/task/{}/complete", - self.baseurl, - encode_path(&task.to_string()), - ); #[allow(unused_mut)] - let mut request = self.client.post(url).json(&body).build()?; + let mut request = { + let url = format!( + "{}/v1/worker/task/{}/complete", + self.baseurl, + encode_path(&task.to_string()), + ); + self.client.post(url).json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1207,13 +1234,17 @@ impl Client { task: &'a str, body: &'a types::WorkerAddOutput, ) -> Result, Error<()>> { - let url = format!( - "{}/v1/worker/task/{}/output", - self.baseurl, - encode_path(&task.to_string()), - ); #[allow(unused_mut)] - let mut request = self.client.post(url).json(&body).build()?; + let mut request = { + let url = format!( + "{}/v1/worker/task/{}/output", + self.baseurl, + encode_path(&task.to_string()), + ); + self.client.post(url).json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1226,16 +1257,16 @@ impl Client { pub async fn workers_list<'a>( &'a self, ) -> Result, Error<()>> { - let url = format!("{}/v1/workers", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/v1/workers", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1246,9 +1277,13 @@ impl Client { ///Sends a `POST` request to `/v1/workers/recycle` pub async fn workers_recycle<'a>(&'a self) -> Result, Error<()>> { - let url = format!("{}/v1/workers/recycle", self.baseurl,); #[allow(unused_mut)] - let mut request = self.client.post(url).build()?; + let mut request = { + let url = format!("{}/v1/workers/recycle", self.baseurl,); + self.client.post(url) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/keeper_builder.rs b/progenitor-impl/tests/output/src/keeper_builder.rs index 908298fc..f764722b 100644 --- a/progenitor-impl/tests/output/src/keeper_builder.rs +++ b/progenitor-impl/tests/output/src/keeper_builder.rs @@ -1374,6 +1374,182 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct Enrol<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Enrol<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct GlobalJobs<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> GlobalJobs<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct Ping<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Ping<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ReportFinish<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ReportFinish<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ReportOutput<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ReportOutput<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ReportStart<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ReportStart<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::enrol`] /// ///[`Client::enrol`]: super::Client::enrol @@ -1425,6 +1601,10 @@ pub mod builder { ///Sends a `POST` request to `/enrol` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1434,22 +1614,16 @@ pub mod builder { let body = body .and_then(|v| types::EnrolBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/enrol", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/enrol", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client.client.post(url).json(&body).headers(header_map) + }; + Ok(built::Enrol { + client: client, + request, + }) } } @@ -1482,30 +1656,32 @@ pub mod builder { ///Sends a `GET` request to `/global/jobs` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, } = self; let authorization = authorization.map_err(Error::InvalidRequest)?; - let url = format!("{}/global/jobs", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/global/jobs", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .headers(header_map) + }; + Ok(built::GlobalJobs { + client: client, + request, + }) } } @@ -1538,30 +1714,32 @@ pub mod builder { ///Sends a `GET` request to `/ping` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, } = self; let authorization = authorization.map_err(Error::InvalidRequest)?; - let url = format!("{}/ping", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/ping", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .headers(header_map) + }; + Ok(built::Ping { + client: client, + request, + }) } } @@ -1618,6 +1796,10 @@ pub mod builder { ///Sends a `POST` request to `/report/finish` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1627,26 +1809,24 @@ pub mod builder { let body = body .and_then(|v| types::ReportFinishBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/report/finish", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/report/finish", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + }; + Ok(built::ReportFinish { + client: client, + request, + }) } } @@ -1703,6 +1883,10 @@ pub mod builder { ///Sends a `POST` request to `/report/output` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1712,26 +1896,24 @@ pub mod builder { let body = body .and_then(|v| types::ReportOutputBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/report/output", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/report/output", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + }; + Ok(built::ReportOutput { + client: client, + request, + }) } } @@ -1786,6 +1968,10 @@ pub mod builder { ///Sends a `POST` request to `/report/start` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1795,26 +1981,24 @@ pub mod builder { let body = body .and_then(|v| types::ReportStartBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/report/start", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/report/start", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + }; + Ok(built::ReportStart { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/keeper_builder_tagged.rs b/progenitor-impl/tests/output/src/keeper_builder_tagged.rs index 6e4dffec..25bd0489 100644 --- a/progenitor-impl/tests/output/src/keeper_builder_tagged.rs +++ b/progenitor-impl/tests/output/src/keeper_builder_tagged.rs @@ -1374,6 +1374,182 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct Enrol<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Enrol<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct GlobalJobs<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> GlobalJobs<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct Ping<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Ping<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ReportFinish<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ReportFinish<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ReportOutput<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ReportOutput<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ReportStart<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ReportStart<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::enrol`] /// ///[`Client::enrol`]: super::Client::enrol @@ -1425,6 +1601,10 @@ pub mod builder { ///Sends a `POST` request to `/enrol` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1434,22 +1614,16 @@ pub mod builder { let body = body .and_then(|v| types::EnrolBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/enrol", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/enrol", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client.client.post(url).json(&body).headers(header_map) + }; + Ok(built::Enrol { + client: client, + request, + }) } } @@ -1482,30 +1656,32 @@ pub mod builder { ///Sends a `GET` request to `/global/jobs` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, } = self; let authorization = authorization.map_err(Error::InvalidRequest)?; - let url = format!("{}/global/jobs", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/global/jobs", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .headers(header_map) + }; + Ok(built::GlobalJobs { + client: client, + request, + }) } } @@ -1538,30 +1714,32 @@ pub mod builder { ///Sends a `GET` request to `/ping` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, } = self; let authorization = authorization.map_err(Error::InvalidRequest)?; - let url = format!("{}/ping", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/ping", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .headers(header_map) + }; + Ok(built::Ping { + client: client, + request, + }) } } @@ -1618,6 +1796,10 @@ pub mod builder { ///Sends a `POST` request to `/report/finish` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1627,26 +1809,24 @@ pub mod builder { let body = body .and_then(|v| types::ReportFinishBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/report/finish", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/report/finish", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + }; + Ok(built::ReportFinish { + client: client, + request, + }) } } @@ -1703,6 +1883,10 @@ pub mod builder { ///Sends a `POST` request to `/report/output` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1712,26 +1896,24 @@ pub mod builder { let body = body .and_then(|v| types::ReportOutputBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/report/output", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/report/output", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + }; + Ok(built::ReportOutput { + client: client, + request, + }) } } @@ -1786,6 +1968,10 @@ pub mod builder { ///Sends a `POST` request to `/report/start` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, authorization, @@ -1795,26 +1981,24 @@ pub mod builder { let body = body .and_then(|v| types::ReportStartBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/report/start", client.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/report/start", client.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + }; + Ok(built::ReportStart { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/keeper_positional.rs b/progenitor-impl/tests/output/src/keeper_positional.rs index 9b63f81f..a28588b0 100644 --- a/progenitor-impl/tests/output/src/keeper_positional.rs +++ b/progenitor-impl/tests/output/src/keeper_positional.rs @@ -522,16 +522,15 @@ impl Client { authorization: &'a str, body: &'a types::EnrolBody, ) -> Result, Error<()>> { - let url = format!("{}/enrol", self.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .json(&body) - .headers(header_map) - .build()?; + let mut request = { + let url = format!("{}/enrol", self.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + self.client.post(url).json(&body).headers(header_map) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -548,19 +547,21 @@ impl Client { &'a self, authorization: &'a str, ) -> Result, Error<()>> { - let url = format!("{}/global/jobs", self.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .headers(header_map) - .build()?; + let mut request = { + let url = format!("{}/global/jobs", self.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .headers(header_map) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -577,19 +578,21 @@ impl Client { &'a self, authorization: &'a str, ) -> Result, Error<()>> { - let url = format!("{}/ping", self.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .headers(header_map) - .build()?; + let mut request = { + let url = format!("{}/ping", self.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .headers(header_map) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -608,20 +611,22 @@ impl Client { authorization: &'a str, body: &'a types::ReportFinishBody, ) -> Result, Error<()>> { - let url = format!("{}/report/finish", self.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; + let mut request = { + let url = format!("{}/report/finish", self.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -640,20 +645,22 @@ impl Client { authorization: &'a str, body: &'a types::ReportOutputBody, ) -> Result, Error<()>> { - let url = format!("{}/report/output", self.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; + let mut request = { + let url = format!("{}/report/output", self.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -672,20 +679,22 @@ impl Client { authorization: &'a str, body: &'a types::ReportStartBody, ) -> Result, Error<()>> { - let url = format!("{}/report/start", self.baseurl,); - let mut header_map = HeaderMap::with_capacity(1usize); - header_map.append("Authorization", HeaderValue::try_from(authorization)?); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .headers(header_map) - .build()?; + let mut request = { + let url = format!("{}/report/start", self.baseurl,); + let mut header_map = HeaderMap::with_capacity(1usize); + header_map.append("Authorization", HeaderValue::try_from(authorization)?); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .headers(header_map) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/nexus_builder.rs b/progenitor-impl/tests/output/src/nexus_builder.rs index df81a2d4..d4c8a79c 100644 --- a/progenitor-impl/tests/output/src/nexus_builder.rs +++ b/progenitor-impl/tests/output/src/nexus_builder.rs @@ -28678,6 +28678,6758 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct DiskViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DeviceAuthRequest<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DeviceAuthRequest<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DeviceAuthConfirm<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DeviceAuthConfirm<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DeviceAccessToken<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DeviceAccessToken<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct GroupList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> GroupList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginSpoof<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginSpoof<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginLocal<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginLocal<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginSamlBegin<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginSamlBegin<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginSaml<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginSaml<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct Logout<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Logout<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectUpdate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskMetricsList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskMetricsList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskAttach<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskAttach<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskDetach<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskDetach<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceExternalIpList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceExternalIpList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceMigrate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceMigrate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceReboot<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceReboot<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsole<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsole<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsoleStream<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsoleStream<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 101u16 => ResponseValue::upgrade(response).await, + 200..=299 => ResponseValue::upgrade(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStart<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStart<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStop<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStop<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcUpdate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcFirewallRulesView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcFirewallRulesView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcFirewallRulesUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcFirewallRulesUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetListNetworkInterfaces<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetListNetworkInterfaces<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct PolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> PolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct PolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> PolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RoleList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RoleList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RoleView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RoleView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionMe<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionMe<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionMeGroups<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionMeGroups<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct PhysicalDiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> PhysicalDiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RackList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RackList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RackView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RackView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SledList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SledList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SledView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SledView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SledPhysicalDiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SledPhysicalDiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolUpdate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolRangeList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolRangeList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolRangeAdd<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolRangeAdd<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolRangeRemove<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolRangeRemove<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceRangeList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceRangeList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceRangeAdd<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceRangeAdd<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceRangeRemove<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceRangeRemove<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemMetric<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemMetric<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SagaList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SagaList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SagaView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SagaView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloIdentityProviderList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloIdentityProviderList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LocalIdpUserCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LocalIdpUserCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LocalIdpUserDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LocalIdpUserDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LocalIdpUserSetPassword<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LocalIdpUserSetPassword<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SamlIdentityProviderCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SamlIdentityProviderCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SamlIdentityProviderView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SamlIdentityProviderView<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloUsersList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloUsersList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloUserView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloUserView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUserList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUserList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUserView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUserView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TimeseriesSchemaGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TimeseriesSchemaGet<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UserList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UserList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskCreateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskViewV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceCreateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceViewV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskAttachV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskAttachV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskDetachV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskDetachV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceMigrateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceMigrateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceRebootV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceRebootV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsoleV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsoleV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsoleStreamV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsoleStreamV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 101u16 => ResponseValue::upgrade(response).await, + 200..=299 => ResponseValue::upgrade(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStartV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStartV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStopV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStopV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationCreateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationViewV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationUpdateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyViewV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyUpdateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectCreateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectViewV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectUpdateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyViewV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyUpdateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemComponentVersionList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemComponentVersionList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UpdateDeploymentsList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UpdateDeploymentsList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UpdateDeploymentView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UpdateDeploymentView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateRefresh<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateRefresh<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateStart<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateStart<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateStop<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateStop<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateComponentsList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateComponentsList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemVersion<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemVersion<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::disk_view_by_id`] /// ///[`Client::disk_view_by_id`]: super::Client::disk_view_by_id @@ -28707,34 +35459,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/disks/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/disks/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/disks/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::DiskViewById { + client: client, + request, + }) } } @@ -28767,34 +35512,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/images/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/images/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/images/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ImageViewById { + client: client, + request, + }) } } @@ -28827,34 +35565,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/instances/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/instances/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/instances/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceViewById { + client: client, + request, + }) } } @@ -28889,34 +35620,29 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/network-interfaces/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/network-interfaces/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceNetworkInterfaceViewById { + client: client, + request, + }) } } @@ -28949,34 +35675,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/organizations/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/organizations/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/organizations/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationViewById { + client: client, + request, + }) } } @@ -29009,34 +35728,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/projects/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/projects/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/projects/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectViewById { + client: client, + request, + }) } } @@ -29069,34 +35781,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/snapshots/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/snapshots/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/snapshots/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SnapshotViewById { + client: client, + request, + }) } } @@ -29129,34 +35834,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpc-router-routes/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpc-router-routes/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpc-router-routes/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterRouteViewById { + client: client, + request, + }) } } @@ -29189,34 +35887,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpc-routers/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpc-routers/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpc-routers/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterViewById { + client: client, + request, + }) } } @@ -29249,34 +35940,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpc-subnets/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpc-subnets/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpc-subnets/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcSubnetViewById { + client: client, + request, + }) } } @@ -29309,34 +35993,27 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpcs/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpcs/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpcs/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcViewById { + client: client, + request, + }) } } @@ -29381,19 +36058,22 @@ pub mod builder { ///Sends a `POST` request to `/device/auth` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::DeviceAuthRequest::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/device/auth", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).form_urlencoded(&body)?.build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), - } + let request = { + let url = format!("{}/device/auth", client.baseurl,); + client.client.post(url).form_urlencoded(&body)? + }; + Ok(built::DeviceAuthRequest { + client: client, + request, + }) } } @@ -29438,33 +36118,29 @@ pub mod builder { ///Sends a `POST` request to `/device/confirm` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::DeviceAuthVerify::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/device/confirm", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/device/confirm", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::DeviceAuthConfirm { + client: client, + request, + }) } } @@ -29511,21 +36187,24 @@ pub mod builder { ///Sends a `POST` request to `/device/token` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| { types::DeviceAccessTokenRequest::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/device/token", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).form_urlencoded(&body)?.build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), - } + let request = { + let url = format!("{}/device/token", client.baseurl,); + client.client.post(url).form_urlencoded(&body)? + }; + Ok(built::DeviceAccessToken { + client: client, + request, + }) } } @@ -29586,6 +36265,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -29595,39 +36278,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/groups", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/groups", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::GroupList { + client: client, + request, + }) } ///Streams `GET` requests to `/groups` @@ -29726,33 +36401,29 @@ pub mod builder { ///Sends a `POST` request to `/login` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SpoofLoginBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/login", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/login", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::LoginSpoof { + client: client, + request, + }) } } @@ -29812,6 +36483,10 @@ pub mod builder { ///Sends a `POST` request to `/login/{silo_name}/local` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -29823,25 +36498,18 @@ pub mod builder { types::UsernamePasswordCredentials::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/login/{}/local", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/login/{}/local", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::LoginLocal { + client: client, + request, + }) } } @@ -29886,6 +36554,10 @@ pub mod builder { ///Sends a `GET` request to `/login/{silo_name}/saml/{provider_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -29893,26 +36565,19 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/login/{}/saml/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.get(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/login/{}/saml/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + client.client.get(url) + }; + Ok(built::LoginSamlBegin { + client: client, + request, + }) } } @@ -29969,6 +36634,10 @@ pub mod builder { ///Sends a `POST` request to `/login/{silo_name}/saml/{provider_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -29978,34 +36647,26 @@ pub mod builder { let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/login/{}/saml/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/login/{}/saml/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + }; + Ok(built::LoginSaml { + client: client, + request, + }) } } @@ -30024,29 +36685,22 @@ pub mod builder { ///Sends a `POST` request to `/logout` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/logout", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/logout", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::Logout { + client: client, + request, + }) } } @@ -30107,6 +36761,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -30116,39 +36774,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/organizations", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/organizations", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::OrganizationList { + client: client, + request, + }) } ///Streams `GET` requests to `/organizations` @@ -30249,33 +36899,29 @@ pub mod builder { ///Sends a `POST` request to `/organizations` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::OrganizationCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/organizations", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/organizations", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationCreate { + client: client, + request, + }) } } @@ -30308,37 +36954,30 @@ pub mod builder { ///Sends a `GET` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationView { + client: client, + request, + }) } } @@ -30395,6 +37034,10 @@ pub mod builder { ///Sends a `PUT` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30404,33 +37047,25 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationUpdate { + client: client, + request, + }) } } @@ -30463,37 +37098,30 @@ pub mod builder { ///Sends a `DELETE` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationDelete { + client: client, + request, + }) } } @@ -30528,37 +37156,30 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationPolicyView { + client: client, + request, + }) } } @@ -30619,6 +37240,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30628,33 +37253,25 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationPolicyUpdate { + client: client, + request, + }) } } @@ -30728,6 +37345,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30739,43 +37360,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -30888,6 +37501,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30897,33 +37514,25 @@ pub mod builder { let body = body .and_then(|v| types::ProjectCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ProjectCreate { + client: client, + request, + }) } } @@ -30969,6 +37578,10 @@ pub mod builder { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30976,33 +37589,22 @@ pub mod builder { } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectView { + client: client, + request, + }) } } @@ -31070,6 +37672,10 @@ pub mod builder { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31081,34 +37687,26 @@ pub mod builder { let body = body .and_then(|v| types::ProjectUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ProjectUpdate { + client: client, + request, + }) } } @@ -31154,6 +37752,10 @@ pub mod builder { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31161,33 +37763,22 @@ pub mod builder { } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectDelete { + client: client, + request, + }) } } @@ -31273,6 +37864,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31286,44 +37881,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -31448,6 +38035,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/disks` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31459,34 +38050,26 @@ pub mod builder { let body = body .and_then(|v| types::DiskCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::DiskCreate { + client: client, + request, + }) } } @@ -31545,6 +38128,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31554,34 +38141,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::DiskView { + client: client, + request, + }) } } @@ -31640,6 +38216,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31649,34 +38229,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::DiskDelete { + client: client, + request, + }) } } @@ -31801,6 +38370,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31820,49 +38393,41 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let start_time = start_time.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - encode_path(&metric_name.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &end_time { - query.push(("end_time", v.to_string())); - } - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &start_time { - query.push(("start_time", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + encode_path(&metric_name.to_string()), + ); + let mut query = Vec::with_capacity(4usize); + if let Some(v) = &end_time { + query.push(("end_time", v.to_string())); + } + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &start_time { + query.push(("start_time", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskMetricsList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -32007,6 +38572,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32020,44 +38589,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ImageList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -32182,6 +38743,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/images` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32193,34 +38758,26 @@ pub mod builder { let body = body .and_then(|v| types::ImageCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ImageCreate { + client: client, + request, + }) } } @@ -32279,6 +38836,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32288,34 +38849,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&image_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ImageView { + client: client, + request, + }) } } @@ -32374,6 +38924,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32383,34 +38937,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&image_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ImageDelete { + client: client, + request, + }) } } @@ -32497,6 +39040,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32510,44 +39057,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -32674,6 +39213,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32685,34 +39228,26 @@ pub mod builder { let body = body .and_then(|v| types::InstanceCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceCreate { + client: client, + request, + }) } } @@ -32771,6 +39306,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32780,34 +39319,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceView { + client: client, + request, + }) } } @@ -32866,6 +39394,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32875,34 +39407,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceDelete { + client: client, + request, + }) } } @@ -33001,6 +39522,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33016,45 +39541,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceDiskList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -33193,6 +39710,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks/attach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33206,35 +39727,27 @@ pub mod builder { let body = body .and_then(|v| types::DiskIdentifier::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks/attach", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks/attach", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceDiskAttach { + client: client, + request, + }) } } @@ -33315,6 +39828,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks/detach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33328,35 +39845,27 @@ pub mod builder { let body = body .and_then(|v| types::DiskIdentifier::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks/detach", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks/detach", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceDiskDetach { + client: client, + request, + }) } } @@ -33417,6 +39926,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33426,34 +39939,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/external-ips", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/external-ips", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceExternalIpList { + client: client, + request, + }) } } @@ -33534,6 +40036,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/migrate` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33547,35 +40053,27 @@ pub mod builder { let body = body .and_then(|v| types::InstanceMigrate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/migrate", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/migrate", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceMigrate { + client: client, + request, + }) } } @@ -33675,6 +40173,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33690,45 +40192,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceNetworkInterfaceList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -33873,6 +40367,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -33886,35 +40386,27 @@ pub mod builder { let body = body .and_then(|v| types::NetworkInterfaceCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceNetworkInterfaceCreate { + client: client, + request, + }) } } @@ -33987,6 +40479,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33998,35 +40494,24 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceNetworkInterfaceView { + client: client, + request, + }) } } @@ -34125,6 +40610,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -34140,36 +40631,28 @@ pub mod builder { let body = body .and_then(|v| types::NetworkInterfaceUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceNetworkInterfaceUpdate { + client: client, + request, + }) } } @@ -34240,6 +40723,12 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces/{interface_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -34251,35 +40740,24 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceNetworkInterfaceDelete { + client: client, + request, + }) } } @@ -34338,6 +40816,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/reboot` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34347,34 +40829,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/reboot", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/reboot", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceReboot { + client: client, + request, + }) } } @@ -34474,6 +40945,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34489,45 +40964,37 @@ pub mod builder { let from_start = from_start.map_err(Error::InvalidRequest)?; let max_bytes = max_bytes.map_err(Error::InvalidRequest)?; let most_recent = most_recent.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/serial-console", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &from_start { - query.push(("from_start", v.to_string())); - } - if let Some(v) = &max_bytes { - query.push(("max_bytes", v.to_string())); - } - if let Some(v) = &most_recent { - query.push(("most_recent", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/serial-console", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &from_start { + query.push(("from_start", v.to_string())); + } + if let Some(v) = &max_bytes { + query.push(("max_bytes", v.to_string())); + } + if let Some(v) = &most_recent { + query.push(("most_recent", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceSerialConsole { + client: client, + request, + }) } } @@ -34588,6 +41055,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -34597,35 +41070,32 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 101u16 => ResponseValue::upgrade(response).await, - 200..=299 => ResponseValue::upgrade(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .get(url) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + }; + Ok(built::InstanceSerialConsoleStream { + client: client, + request, + }) } } @@ -34684,6 +41154,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/start` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34693,34 +41167,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/start", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/start", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceStart { + client: client, + request, + }) } } @@ -34779,6 +41242,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/stop` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34788,34 +41255,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/stop", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/stop", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceStop { + client: client, + request, + }) } } @@ -34863,6 +41319,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34870,33 +41330,22 @@ pub mod builder { } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectPolicyView { + client: client, + request, + }) } } @@ -34968,6 +41417,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34979,34 +41432,26 @@ pub mod builder { let body = body .and_then(|v| types::ProjectRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ProjectPolicyUpdate { + client: client, + request, + }) } } @@ -35093,6 +41538,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35106,44 +41555,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SnapshotList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -35270,6 +41711,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35281,34 +41726,26 @@ pub mod builder { let body = body .and_then(|v| types::SnapshotCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SnapshotCreate { + client: client, + request, + }) } } @@ -35367,6 +41804,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots/{snapshot_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35376,34 +41817,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let snapshot_name = snapshot_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&snapshot_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&snapshot_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SnapshotView { + client: client, + request, + }) } } @@ -35462,6 +41892,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots/{snapshot_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35471,34 +41905,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let snapshot_name = snapshot_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&snapshot_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&snapshot_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SnapshotDelete { + client: client, + request, + }) } } @@ -35584,6 +42007,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35597,44 +42024,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -35759,6 +42178,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35770,34 +42193,26 @@ pub mod builder { let body = body .and_then(|v| types::VpcCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcCreate { + client: client, + request, + }) } } @@ -35856,6 +42271,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35865,34 +42284,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcView { + client: client, + request, + }) } } @@ -35973,6 +42381,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35986,35 +42398,27 @@ pub mod builder { let body = body .and_then(|v| types::VpcUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcUpdate { + client: client, + request, + }) } } @@ -36073,6 +42477,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36082,34 +42490,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcDelete { + client: client, + request, + }) } } @@ -36170,6 +42567,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36179,34 +42580,23 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcFirewallRulesView { + client: client, + request, + }) } } @@ -36294,6 +42684,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36309,35 +42703,27 @@ pub mod builder { types::VpcFirewallRuleUpdateParams::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcFirewallRulesUpdate { + client: client, + request, + }) } } @@ -36436,6 +42822,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36451,45 +42841,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcRouterList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -36628,6 +43010,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36641,35 +43027,27 @@ pub mod builder { let body = body .and_then(|v| types::VpcRouterCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterCreate { + client: client, + request, + }) } } @@ -36740,6 +43118,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36751,35 +43133,24 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterView { + client: client, + request, + }) } } @@ -36872,6 +43243,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36887,36 +43262,28 @@ pub mod builder { let body = body .and_then(|v| types::VpcRouterUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterUpdate { + client: client, + request, + }) } } @@ -36987,6 +43354,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36998,35 +43369,24 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterDelete { + client: client, + request, + }) } } @@ -37137,6 +43497,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37154,46 +43518,38 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcRouterRouteList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -37348,6 +43704,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37365,36 +43725,28 @@ pub mod builder { types::RouterRouteCreateParams::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterRouteCreate { + client: client, + request, + }) } } @@ -37477,6 +43829,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37490,36 +43846,25 @@ pub mod builder { let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterRouteView { + client: client, + request, + }) } } @@ -37628,6 +43973,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37647,37 +43996,29 @@ pub mod builder { types::RouterRouteUpdateParams::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterRouteUpdate { + client: client, + request, + }) } } @@ -37760,6 +44101,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37773,36 +44118,25 @@ pub mod builder { let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterRouteDelete { + client: client, + request, + }) } } @@ -37901,6 +44235,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37916,45 +44254,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcSubnetList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -38093,6 +44423,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38106,35 +44440,27 @@ pub mod builder { let body = body .and_then(|v| types::VpcSubnetCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcSubnetCreate { + client: client, + request, + }) } } @@ -38205,6 +44531,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38216,35 +44546,24 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcSubnetView { + client: client, + request, + }) } } @@ -38337,6 +44656,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38352,36 +44675,28 @@ pub mod builder { let body = body .and_then(|v| types::VpcSubnetUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcSubnetUpdate { + client: client, + request, + }) } } @@ -38452,6 +44767,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38463,35 +44782,24 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcSubnetDelete { + client: client, + request, + }) } } @@ -38603,6 +44911,12 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -38620,46 +44934,38 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcSubnetListNetworkInterfaces { + client: client, + request, + }) } ///Streams `GET` requests to @@ -38738,29 +45044,22 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/policy", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::PolicyView { + client: client, + request, + }) } } @@ -38805,33 +45104,29 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SiloRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/policy", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::PolicyUpdate { + client: client, + request, + }) } } @@ -38879,6 +45174,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -38886,36 +45185,28 @@ pub mod builder { } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!("{}/roles", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/roles", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::RoleList { + client: client, + request, + }) } ///Streams `GET` requests to `/roles` @@ -39003,34 +45294,27 @@ pub mod builder { ///Sends a `GET` request to `/roles/{role_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, role_name } = self; let role_name = role_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/roles/{}", - client.baseurl, - encode_path(&role_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/roles/{}", + client.baseurl, + encode_path(&role_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::RoleView { + client: client, + request, + }) } } @@ -39049,29 +45333,22 @@ pub mod builder { ///Sends a `GET` request to `/session/me` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/session/me", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/session/me", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SessionMe { + client: client, + request, + }) } } @@ -39132,6 +45409,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -39141,39 +45422,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/session/me/groups", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/session/me/groups", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SessionMeGroups { + client: client, + request, + }) } ///Streams `GET` requests to `/session/me/groups` @@ -39290,6 +45563,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -39299,39 +45576,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/session/me/sshkeys", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/session/me/sshkeys", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SessionSshkeyList { + client: client, + request, + }) } ///Streams `GET` requests to `/session/me/sshkeys` @@ -39430,33 +45699,29 @@ pub mod builder { ///Sends a `POST` request to `/session/me/sshkeys` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SshKeyCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/session/me/sshkeys", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/session/me/sshkeys", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SessionSshkeyCreate { + client: client, + request, + }) } } @@ -39489,37 +45754,30 @@ pub mod builder { ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, ssh_key_name, } = self; let ssh_key_name = ssh_key_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/session/me/sshkeys/{}", - client.baseurl, - encode_path(&ssh_key_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/session/me/sshkeys/{}", + client.baseurl, + encode_path(&ssh_key_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SessionSshkeyView { + client: client, + request, + }) } } @@ -39552,37 +45810,30 @@ pub mod builder { ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, ssh_key_name, } = self; let ssh_key_name = ssh_key_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/session/me/sshkeys/{}", - client.baseurl, - encode_path(&ssh_key_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/session/me/sshkeys/{}", + client.baseurl, + encode_path(&ssh_key_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SessionSshkeyDelete { + client: client, + request, + }) } } @@ -39615,34 +45866,27 @@ pub mod builder { ///Sends a `GET` request to `/system/by-id/images/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/by-id/images/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/by-id/images/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemImageViewById { + client: client, + request, + }) } } @@ -39675,34 +45919,27 @@ pub mod builder { ///Sends a `GET` request to `/system/by-id/ip-pools/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/by-id/ip-pools/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/by-id/ip-pools/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolViewById { + client: client, + request, + }) } } @@ -39735,34 +45972,27 @@ pub mod builder { ///Sends a `GET` request to `/system/by-id/silos/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/by-id/silos/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/by-id/silos/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloViewById { + client: client, + request, + }) } } @@ -39823,6 +46053,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -39832,39 +46066,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/certificates", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/certificates", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::CertificateList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/certificates` @@ -39965,33 +46191,29 @@ pub mod builder { ///Sends a `POST` request to `/system/certificates` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; - let body = body - .and_then(|v| types::CertificateCreate::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/certificates", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let body = body + .and_then(|v| types::CertificateCreate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let request = { + let url = format!("{}/system/certificates", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::CertificateCreate { + client: client, + request, + }) } } @@ -40024,37 +46246,30 @@ pub mod builder { ///Sends a `GET` request to `/system/certificates/{certificate}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, certificate, } = self; let certificate = certificate.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/certificates/{}", - client.baseurl, - encode_path(&certificate.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/certificates/{}", + client.baseurl, + encode_path(&certificate.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::CertificateView { + client: client, + request, + }) } } @@ -40087,37 +46302,30 @@ pub mod builder { ///Sends a `DELETE` request to `/system/certificates/{certificate}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, certificate, } = self; let certificate = certificate.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/certificates/{}", - client.baseurl, - encode_path(&certificate.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/certificates/{}", + client.baseurl, + encode_path(&certificate.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::CertificateDelete { + client: client, + request, + }) } } @@ -40178,6 +46386,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40187,39 +46399,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/hardware/disks", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/hardware/disks", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::PhysicalDiskList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/disks` @@ -40336,6 +46540,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40345,39 +46553,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/hardware/racks", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/hardware/racks", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::RackList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/racks` @@ -40466,34 +46666,27 @@ pub mod builder { ///Sends a `GET` request to `/system/hardware/racks/{rack_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, rack_id } = self; let rack_id = rack_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/hardware/racks/{}", - client.baseurl, - encode_path(&rack_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/hardware/racks/{}", + client.baseurl, + encode_path(&rack_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::RackView { + client: client, + request, + }) } } @@ -40554,6 +46747,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40563,39 +46760,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/hardware/sleds", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/hardware/sleds", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SledList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/sleds` @@ -40684,34 +46873,27 @@ pub mod builder { ///Sends a `GET` request to `/system/hardware/sleds/{sled_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, sled_id } = self; let sled_id = sled_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/hardware/sleds/{}", - client.baseurl, - encode_path(&sled_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/hardware/sleds/{}", + client.baseurl, + encode_path(&sled_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SledView { + client: client, + request, + }) } } @@ -40784,6 +46966,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, sled_id, @@ -40795,43 +46981,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/hardware/sleds/{}/disks", - client.baseurl, - encode_path(&sled_id.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/hardware/sleds/{}/disks", + client.baseurl, + encode_path(&sled_id.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SledPhysicalDiskList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/sleds/{sled_id}/disks` @@ -40948,6 +47126,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40957,39 +47139,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/images", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/images", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemImageList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/images` @@ -41090,33 +47264,29 @@ pub mod builder { ///Sends a `POST` request to `/system/images` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::GlobalImageCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/images", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/images", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SystemImageCreate { + client: client, + request, + }) } } @@ -41149,34 +47319,27 @@ pub mod builder { ///Sends a `GET` request to `/system/images/{image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, image_name } = self; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/images/{}", - client.baseurl, - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/images/{}", + client.baseurl, + encode_path(&image_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemImageView { + client: client, + request, + }) } } @@ -41209,34 +47372,27 @@ pub mod builder { ///Sends a `DELETE` request to `/system/images/{image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, image_name } = self; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/images/{}", - client.baseurl, - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/images/{}", + client.baseurl, + encode_path(&image_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemImageDelete { + client: client, + request, + }) } } @@ -41297,6 +47453,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -41306,39 +47466,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::IpPoolList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/ip-pools` @@ -41437,33 +47589,29 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::IpPoolCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolCreate { + client: client, + request, + }) } } @@ -41496,34 +47644,27 @@ pub mod builder { ///Sends a `GET` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolView { + client: client, + request, + }) } } @@ -41578,6 +47719,10 @@ pub mod builder { ///Sends a `PUT` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41587,33 +47732,25 @@ pub mod builder { let body = body .and_then(|v| types::IpPoolUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolUpdate { + client: client, + request, + }) } } @@ -41646,34 +47783,27 @@ pub mod builder { ///Sends a `DELETE` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolDelete { + client: client, + request, + }) } } @@ -41733,6 +47863,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41742,40 +47876,32 @@ pub mod builder { let pool_name = pool_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}/ranges", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}/ranges", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::IpPoolRangeList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/ip-pools/{pool_name}/ranges` @@ -41875,6 +48001,10 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools/{pool_name}/ranges/add` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41882,33 +48012,25 @@ pub mod builder { } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}/ranges/add", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}/ranges/add", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolRangeAdd { + client: client, + request, + }) } } @@ -41954,6 +48076,10 @@ pub mod builder { ///Sends a `POST` request to /// `/system/ip-pools/{pool_name}/ranges/remove` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41961,33 +48087,25 @@ pub mod builder { } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}/ranges/remove", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}/ranges/remove", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolRangeRemove { + client: client, + request, + }) } } @@ -42006,29 +48124,22 @@ pub mod builder { ///Sends a `GET` request to `/system/ip-pools-service` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/system/ip-pools-service", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/system/ip-pools-service", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolServiceView { + client: client, + request, + }) } } @@ -42076,6 +48187,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -42083,36 +48198,28 @@ pub mod builder { } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools-service/ranges", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools-service/ranges", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::IpPoolServiceRangeList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/ip-pools-service/ranges` @@ -42200,31 +48307,27 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools-service/ranges/add` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools-service/ranges/add", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools-service/ranges/add", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolServiceRangeAdd { + client: client, + request, + }) } } @@ -42257,31 +48360,27 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools-service/ranges/remove` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools-service/ranges/remove", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools-service/ranges/remove", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolServiceRangeRemove { + client: client, + request, + }) } } @@ -42380,6 +48479,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, metric_name, @@ -42395,47 +48498,39 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let start_time = start_time.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/metrics/{}", - client.baseurl, - encode_path(&metric_name.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &end_time { - query.push(("end_time", v.to_string())); - } - query.push(("id", id.to_string())); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &start_time { - query.push(("start_time", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/metrics/{}", + client.baseurl, + encode_path(&metric_name.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &end_time { + query.push(("end_time", v.to_string())); + } + query.push(("id", id.to_string())); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &start_time { + query.push(("start_time", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemMetric { + client: client, + request, + }) } } @@ -42456,29 +48551,22 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/system/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/system/policy", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemPolicyView { + client: client, + request, + }) } } @@ -42523,33 +48611,29 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::FleetRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/policy", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SystemPolicyUpdate { + client: client, + request, + }) } } @@ -42610,6 +48694,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -42619,39 +48707,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/sagas", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/sagas", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SagaList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/sagas` @@ -42740,34 +48820,27 @@ pub mod builder { ///Sends a `GET` request to `/system/sagas/{saga_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, saga_id } = self; let saga_id = saga_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/sagas/{}", - client.baseurl, - encode_path(&saga_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/sagas/{}", + client.baseurl, + encode_path(&saga_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SagaView { + client: client, + request, + }) } } @@ -42828,6 +48901,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -42837,39 +48914,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/silos", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/silos", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SiloList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/silos` @@ -42968,33 +49037,29 @@ pub mod builder { ///Sends a `POST` request to `/system/silos` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SiloCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/silos", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/silos", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SiloCreate { + client: client, + request, + }) } } @@ -43027,34 +49092,27 @@ pub mod builder { ///Sends a `GET` request to `/system/silos/{silo_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloView { + client: client, + request, + }) } } @@ -43087,34 +49145,27 @@ pub mod builder { ///Sends a `DELETE` request to `/system/silos/{silo_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloDelete { + client: client, + request, + }) } } @@ -43189,6 +49240,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43200,43 +49255,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SiloIdentityProviderList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -43349,6 +49396,10 @@ pub mod builder { ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/local/users` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43358,33 +49409,25 @@ pub mod builder { let body = body .and_then(|v| types::UserCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/local/users", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::LocalIdpUserCreate { + client: client, + request, + }) } } @@ -43430,6 +49473,10 @@ pub mod builder { ///Sends a `DELETE` request to /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43437,33 +49484,22 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/local/users/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::LocalIdpUserDelete { + client: client, + request, + }) } } @@ -43522,6 +49558,10 @@ pub mod builder { /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}/ /// set-password` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43531,34 +49571,26 @@ pub mod builder { let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/local/users/{}/set-password", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users/{}/set-password", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::LocalIdpUserSetPassword { + client: client, + request, + }) } } @@ -43621,6 +49653,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43632,33 +49668,25 @@ pub mod builder { types::SamlIdentityProviderCreate::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/saml", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/saml", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SamlIdentityProviderCreate { + client: client, + request, + }) } } @@ -43706,6 +49734,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43713,33 +49745,22 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/saml/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/saml/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SamlIdentityProviderView { + client: client, + request, + }) } } @@ -43774,34 +49795,27 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/policy", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/policy", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloPolicyView { + client: client, + request, + }) } } @@ -43858,6 +49872,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43867,33 +49885,25 @@ pub mod builder { let body = body .and_then(|v| types::SiloRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/policy", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/policy", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SiloPolicyUpdate { + client: client, + request, + }) } } @@ -43966,6 +49976,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43977,43 +49991,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/users/all", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/users/all", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SiloUsersList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/silos/{silo_name}/users/all` @@ -44115,6 +50121,10 @@ pub mod builder { ///Sends a `GET` request to /// `/system/silos/{silo_name}/users/id/{user_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -44122,33 +50132,22 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/users/id/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/users/id/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloUserView { + client: client, + request, + }) } } @@ -44209,6 +50208,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44218,39 +50221,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/user", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/user", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemUserList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/user` @@ -44339,34 +50334,27 @@ pub mod builder { ///Sends a `GET` request to `/system/user/{user_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, user_name } = self; let user_name = user_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/user/{}", - client.baseurl, - encode_path(&user_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/user/{}", + client.baseurl, + encode_path(&user_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUserView { + client: client, + request, + }) } } @@ -44415,6 +50403,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44422,36 +50414,28 @@ pub mod builder { } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!("{}/timeseries/schema", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/timeseries/schema", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::TimeseriesSchemaGet { + client: client, + request, + }) } ///Streams `GET` requests to `/timeseries/schema` @@ -44567,6 +50551,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44576,39 +50564,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/users", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/users", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::UserList { + client: client, + request, + }) } ///Streams `GET` requests to `/users` @@ -44751,6 +50731,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44764,45 +50748,37 @@ pub mod builder { let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/disks", client.baseurl,); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/disks", client.baseurl,); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/disks` @@ -44928,6 +50904,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/disks` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -44939,35 +50919,27 @@ pub mod builder { let body = body .and_then(|v| types::DiskCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/disks", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - query.push(("project", project.to_string())); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/disks", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + query.push(("project", project.to_string())); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::DiskCreateV1 { + client: client, + request, + }) } } @@ -45026,6 +50998,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/disks/{disk}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, disk, @@ -45035,40 +51011,32 @@ pub mod builder { let disk = disk.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/disks/{}", - client.baseurl, - encode_path(&disk.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/disks/{}", + client.baseurl, + encode_path(&disk.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskViewV1 { + client: client, + request, + }) } } @@ -45127,6 +51095,10 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/disks/{disk}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, disk, @@ -45136,40 +51108,32 @@ pub mod builder { let disk = disk.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/disks/{}", - client.baseurl, - encode_path(&disk.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/disks/{}", + client.baseurl, + encode_path(&disk.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskDeleteV1 { + client: client, + request, + }) } } @@ -45256,6 +51220,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -45269,45 +51237,37 @@ pub mod builder { let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/instances", client.baseurl,); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/instances", client.baseurl,); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/instances` @@ -45433,6 +51393,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -45444,35 +51408,27 @@ pub mod builder { let body = body .and_then(|v| types::InstanceCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/instances", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - query.push(("project", project.to_string())); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/instances", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + query.push(("project", project.to_string())); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceCreateV1 { + client: client, + request, + }) } } @@ -45531,6 +51487,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/instances/{instance}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45540,40 +51500,32 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceViewV1 { + client: client, + request, + }) } } @@ -45632,6 +51584,10 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/instances/{instance}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45641,40 +51597,32 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceDeleteV1 { + client: client, + request, + }) } } @@ -45773,6 +51721,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45788,49 +51740,41 @@ pub mod builder { let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/disks", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/disks", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceDiskListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/instances/{instance}/disks` @@ -45969,6 +51913,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/disks/attach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45982,41 +51930,33 @@ pub mod builder { let body = body .and_then(|v| types::DiskPath::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/disks/attach", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/disks/attach", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceDiskAttachV1 { + client: client, + request, + }) } } @@ -46097,6 +52037,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/disks/detach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46110,41 +52054,33 @@ pub mod builder { let body = body .and_then(|v| types::DiskPath::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/disks/detach", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/disks/detach", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceDiskDetachV1 { + client: client, + request, + }) } } @@ -46225,6 +52161,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/migrate` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46238,41 +52178,33 @@ pub mod builder { let body = body .and_then(|v| types::InstanceMigrate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/migrate", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/migrate", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceMigrateV1 { + client: client, + request, + }) } } @@ -46331,6 +52263,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/reboot` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46340,40 +52276,32 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/reboot", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/reboot", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceRebootV1 { + client: client, + request, + }) } } @@ -46473,6 +52401,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46488,49 +52420,41 @@ pub mod builder { let most_recent = most_recent.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/serial-console", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &from_start { - query.push(("from_start", v.to_string())); - } - if let Some(v) = &max_bytes { - query.push(("max_bytes", v.to_string())); - } - if let Some(v) = &most_recent { - query.push(("most_recent", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/serial-console", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &from_start { + query.push(("from_start", v.to_string())); + } + if let Some(v) = &max_bytes { + query.push(("max_bytes", v.to_string())); + } + if let Some(v) = &most_recent { + query.push(("most_recent", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceSerialConsoleV1 { + client: client, + request, + }) } } @@ -46592,6 +52516,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, instance, @@ -46601,41 +52531,38 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/serial-console/stream", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .query(&query) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 101u16 => ResponseValue::upgrade(response).await, - 200..=299 => ResponseValue::upgrade(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/serial-console/stream", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .query(&query) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + }; + Ok(built::InstanceSerialConsoleStreamV1 { + client: client, + request, + }) } } @@ -46694,6 +52621,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/start` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46703,40 +52634,32 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/start", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/start", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceStartV1 { + client: client, + request, + }) } } @@ -46795,6 +52718,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/stop` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46804,40 +52731,32 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/stop", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/stop", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceStopV1 { + client: client, + request, + }) } } @@ -46898,6 +52817,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -46907,39 +52830,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/organizations", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/organizations", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::OrganizationListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/organizations` @@ -47040,33 +52955,29 @@ pub mod builder { ///Sends a `POST` request to `/v1/organizations` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::OrganizationCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/organizations", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/organizations", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationCreateV1 { + client: client, + request, + }) } } @@ -47099,37 +53010,30 @@ pub mod builder { ///Sends a `GET` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/organizations/{}", + client.baseurl, + encode_path(&organization.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationViewV1 { + client: client, + request, + }) } } @@ -47186,6 +53090,10 @@ pub mod builder { ///Sends a `PUT` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -47195,33 +53103,25 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/organizations/{}", + client.baseurl, + encode_path(&organization.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationUpdateV1 { + client: client, + request, + }) } } @@ -47254,37 +53154,30 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/v1/organizations/{}", + client.baseurl, + encode_path(&organization.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationDeleteV1 { + client: client, + request, + }) } } @@ -47319,37 +53212,30 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}/policy", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/organizations/{}/policy", + client.baseurl, + encode_path(&organization.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationPolicyViewV1 { + client: client, + request, + }) } } @@ -47410,6 +53296,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -47419,33 +53309,25 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}/policy", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/organizations/{}/policy", + client.baseurl, + encode_path(&organization.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationPolicyUpdateV1 { + client: client, + request, + }) } } @@ -47519,6 +53401,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -47530,42 +53416,34 @@ pub mod builder { let organization = organization.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/projects", client.baseurl,); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/projects", client.baseurl,); + let mut query = Vec::with_capacity(4usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/projects` @@ -47677,6 +53555,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/projects` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -47686,32 +53568,24 @@ pub mod builder { let body = body .and_then(|v| types::ProjectCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/projects", client.baseurl,); - let mut query = Vec::with_capacity(1usize); - query.push(("organization", organization.to_string())); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/projects", client.baseurl,); + let mut query = Vec::with_capacity(1usize); + query.push(("organization", organization.to_string())); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::ProjectCreateV1 { + client: client, + request, + }) } } @@ -47757,6 +53631,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47764,37 +53642,29 @@ pub mod builder { } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectViewV1 { + client: client, + request, + }) } } @@ -47862,6 +53732,10 @@ pub mod builder { ///Sends a `PUT` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47873,38 +53747,30 @@ pub mod builder { let body = body .and_then(|v| types::ProjectUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::ProjectUpdateV1 { + client: client, + request, + }) } } @@ -47950,6 +53816,10 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47957,37 +53827,29 @@ pub mod builder { } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectDeleteV1 { + client: client, + request, + }) } } @@ -48035,6 +53897,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -48042,37 +53908,29 @@ pub mod builder { } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}/policy", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}/policy", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectPolicyViewV1 { + client: client, + request, + }) } } @@ -48144,6 +54002,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -48155,38 +54017,30 @@ pub mod builder { let body = body .and_then(|v| types::ProjectRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}/policy", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}/policy", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::ProjectPolicyUpdateV1 { + client: client, + request, + }) } } @@ -48248,6 +54102,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -48257,39 +54115,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/components", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/components", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemComponentVersionList { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/system/update/components` @@ -48408,6 +54258,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -48417,39 +54271,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/deployments", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/deployments", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::UpdateDeploymentsList { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/system/update/deployments` @@ -48540,34 +54386,27 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/update/deployments/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/system/update/deployments/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::UpdateDeploymentView { + client: client, + request, + }) } } @@ -48586,29 +54425,22 @@ pub mod builder { ///Sends a `POST` request to `/v1/system/update/refresh` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/update/refresh", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/v1/system/update/refresh", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateRefresh { + client: client, + request, + }) } } @@ -48655,33 +54487,29 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SystemUpdateStart::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/start", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/start", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SystemUpdateStart { + client: client, + request, + }) } } @@ -48700,29 +54528,22 @@ pub mod builder { ///Sends a `POST` request to `/v1/system/update/stop` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/update/stop", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/v1/system/update/stop", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateStop { + client: client, + request, + }) } } @@ -48783,6 +54604,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -48792,39 +54617,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/updates", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/updates", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemUpdateList { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/system/update/updates` @@ -48913,34 +54730,27 @@ pub mod builder { ///Sends a `GET` request to `/v1/system/update/updates/{version}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, version } = self; let version = version.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/update/updates/{}", - client.baseurl, - encode_path(&version.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/system/update/updates/{}", + client.baseurl, + encode_path(&version.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateView { + client: client, + request, + }) } } @@ -48976,34 +54786,27 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, version } = self; let version = version.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/update/updates/{}/components", - client.baseurl, - encode_path(&version.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/system/update/updates/{}/components", + client.baseurl, + encode_path(&version.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateComponentsList { + client: client, + request, + }) } } @@ -49024,29 +54827,22 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/update/version", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/system/update/version", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemVersion { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/nexus_builder_tagged.rs b/progenitor-impl/tests/output/src/nexus_builder_tagged.rs index a4016b67..6c1ddf8b 100644 --- a/progenitor-impl/tests/output/src/nexus_builder_tagged.rs +++ b/progenitor-impl/tests/output/src/nexus_builder_tagged.rs @@ -28597,9 +28597,6761 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; - ///Builder for [`ClientDisksExt::disk_view_by_id`] + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct DiskViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DeviceAuthRequest<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DeviceAuthRequest<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DeviceAuthConfirm<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DeviceAuthConfirm<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DeviceAccessToken<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DeviceAccessToken<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct GroupList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> GroupList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginSpoof<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginSpoof<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginLocal<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginLocal<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginSamlBegin<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginSamlBegin<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LoginSaml<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LoginSaml<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct Logout<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> Logout<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectUpdate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskMetricsList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskMetricsList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ImageDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ImageDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskAttach<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskAttach<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskDetach<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskDetach<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceExternalIpList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceExternalIpList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceMigrate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceMigrate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceNetworkInterfaceDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceNetworkInterfaceDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceReboot<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceReboot<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsole<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsole<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsoleStream<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsoleStream<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 101u16 => ResponseValue::upgrade(response).await, + 200..=299 => ResponseValue::upgrade(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStart<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStart<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStop<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStop<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SnapshotDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SnapshotDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcUpdate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcFirewallRulesView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcFirewallRulesView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcFirewallRulesUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcFirewallRulesUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcRouterRouteDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcRouterRouteDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct VpcSubnetListNetworkInterfaces<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> VpcSubnetListNetworkInterfaces<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct PolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> PolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct PolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> PolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RoleList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RoleList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RoleView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RoleView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionMe<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionMe<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionMeGroups<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionMeGroups<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SessionSshkeyDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SessionSshkeyDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageViewById<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloViewById<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloViewById<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct CertificateDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> CertificateDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct PhysicalDiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> PhysicalDiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RackList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RackList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct RackView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> RackView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SledList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SledList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SledView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SledView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SledPhysicalDiskList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SledPhysicalDiskList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemImageDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemImageDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolUpdate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolRangeList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolRangeList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolRangeAdd<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolRangeAdd<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolRangeRemove<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolRangeRemove<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceRangeList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceRangeList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceRangeAdd<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceRangeAdd<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct IpPoolServiceRangeRemove<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> IpPoolServiceRangeRemove<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemMetric<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemMetric<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SagaList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SagaList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SagaView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SagaView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloIdentityProviderList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloIdentityProviderList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LocalIdpUserCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LocalIdpUserCreate<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LocalIdpUserDelete<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LocalIdpUserDelete<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct LocalIdpUserSetPassword<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> LocalIdpUserSetPassword<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SamlIdentityProviderCreate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SamlIdentityProviderCreate<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SamlIdentityProviderView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SamlIdentityProviderView<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloPolicyView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloPolicyView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloPolicyUpdate<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloPolicyUpdate<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloUsersList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloUsersList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SiloUserView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SiloUserView<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUserList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUserList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUserView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUserView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct TimeseriesSchemaGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> TimeseriesSchemaGet<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UserList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UserList<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskCreateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskViewV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct DiskDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DiskDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceCreateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceViewV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskAttachV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskAttachV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceDiskDetachV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceDiskDetachV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceMigrateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceMigrateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceRebootV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceRebootV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsoleV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsoleV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerialConsoleStreamV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerialConsoleStreamV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 101u16 => ResponseValue::upgrade(response).await, + 200..=299 => ResponseValue::upgrade(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStartV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStartV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStopV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStopV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationCreateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationViewV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationUpdateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyViewV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct OrganizationPolicyUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> OrganizationPolicyUpdateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectListV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectListV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectCreateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectCreateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectViewV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectUpdateV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectDeleteV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectDeleteV1<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyViewV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyViewV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct ProjectPolicyUpdateV1<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> ProjectPolicyUpdateV1<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemComponentVersionList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemComponentVersionList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UpdateDeploymentsList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UpdateDeploymentsList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct UpdateDeploymentView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> UpdateDeploymentView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateRefresh<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateRefresh<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateStart<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateStart<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 202u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateStop<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateStop<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateView<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateView<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemUpdateComponentsList<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemUpdateComponentsList<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct SystemVersion<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> SystemVersion<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + + ///Builder for [`Client::disk_view_by_id`] /// - ///[`ClientDisksExt::disk_view_by_id`]: super::ClientDisksExt::disk_view_by_id + ///[`Client::disk_view_by_id`]: super::Client::disk_view_by_id #[derive(Debug, Clone)] pub struct DiskViewById<'a> { client: &'a super::Client, @@ -28626,40 +35378,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/disks/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/disks/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/disks/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::DiskViewById { + client: client, + request, + }) } } - ///Builder for [`ClientImagesExt::image_view_by_id`] + ///Builder for [`Client::image_view_by_id`] /// - ///[`ClientImagesExt::image_view_by_id`]: super::ClientImagesExt::image_view_by_id + ///[`Client::image_view_by_id`]: super::Client::image_view_by_id #[derive(Debug, Clone)] pub struct ImageViewById<'a> { client: &'a super::Client, @@ -28686,40 +35431,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/images/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/images/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/images/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ImageViewById { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_view_by_id`] + ///Builder for [`Client::instance_view_by_id`] /// - ///[`ClientInstancesExt::instance_view_by_id`]: super::ClientInstancesExt::instance_view_by_id + ///[`Client::instance_view_by_id`]: super::Client::instance_view_by_id #[derive(Debug, Clone)] pub struct InstanceViewById<'a> { client: &'a super::Client, @@ -28746,41 +35484,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/instances/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/instances/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/instances/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceViewById { + client: client, + request, + }) } } - ///Builder for - /// [`ClientInstancesExt::instance_network_interface_view_by_id`] + ///Builder for [`Client::instance_network_interface_view_by_id`] /// - ///[`ClientInstancesExt::instance_network_interface_view_by_id`]: super::ClientInstancesExt::instance_network_interface_view_by_id + ///[`Client::instance_network_interface_view_by_id`]: super::Client::instance_network_interface_view_by_id #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceViewById<'a> { client: &'a super::Client, @@ -28809,40 +35539,35 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/network-interfaces/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/network-interfaces/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceNetworkInterfaceViewById { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_view_by_id`] + ///Builder for [`Client::organization_view_by_id`] /// - ///[`ClientOrganizationsExt::organization_view_by_id`]: super::ClientOrganizationsExt::organization_view_by_id + ///[`Client::organization_view_by_id`]: super::Client::organization_view_by_id #[derive(Debug, Clone)] pub struct OrganizationViewById<'a> { client: &'a super::Client, @@ -28869,40 +35594,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/organizations/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/organizations/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/organizations/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationViewById { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_view_by_id`] + ///Builder for [`Client::project_view_by_id`] /// - ///[`ClientProjectsExt::project_view_by_id`]: super::ClientProjectsExt::project_view_by_id + ///[`Client::project_view_by_id`]: super::Client::project_view_by_id #[derive(Debug, Clone)] pub struct ProjectViewById<'a> { client: &'a super::Client, @@ -28929,40 +35647,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/projects/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/projects/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/projects/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectViewById { + client: client, + request, + }) } } - ///Builder for [`ClientSnapshotsExt::snapshot_view_by_id`] + ///Builder for [`Client::snapshot_view_by_id`] /// - ///[`ClientSnapshotsExt::snapshot_view_by_id`]: super::ClientSnapshotsExt::snapshot_view_by_id + ///[`Client::snapshot_view_by_id`]: super::Client::snapshot_view_by_id #[derive(Debug, Clone)] pub struct SnapshotViewById<'a> { client: &'a super::Client, @@ -28989,40 +35700,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/snapshots/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/snapshots/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/snapshots/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SnapshotViewById { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_route_view_by_id`] + ///Builder for [`Client::vpc_router_route_view_by_id`] /// - ///[`ClientVpcsExt::vpc_router_route_view_by_id`]: super::ClientVpcsExt::vpc_router_route_view_by_id + ///[`Client::vpc_router_route_view_by_id`]: super::Client::vpc_router_route_view_by_id #[derive(Debug, Clone)] pub struct VpcRouterRouteViewById<'a> { client: &'a super::Client, @@ -29049,40 +35753,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpc-router-routes/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpc-router-routes/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpc-router-routes/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterRouteViewById { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_view_by_id`] + ///Builder for [`Client::vpc_router_view_by_id`] /// - ///[`ClientVpcsExt::vpc_router_view_by_id`]: super::ClientVpcsExt::vpc_router_view_by_id + ///[`Client::vpc_router_view_by_id`]: super::Client::vpc_router_view_by_id #[derive(Debug, Clone)] pub struct VpcRouterViewById<'a> { client: &'a super::Client, @@ -29109,40 +35806,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpc-routers/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpc-routers/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpc-routers/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterViewById { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_subnet_view_by_id`] + ///Builder for [`Client::vpc_subnet_view_by_id`] /// - ///[`ClientVpcsExt::vpc_subnet_view_by_id`]: super::ClientVpcsExt::vpc_subnet_view_by_id + ///[`Client::vpc_subnet_view_by_id`]: super::Client::vpc_subnet_view_by_id #[derive(Debug, Clone)] pub struct VpcSubnetViewById<'a> { client: &'a super::Client, @@ -29169,40 +35859,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpc-subnets/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpc-subnets/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpc-subnets/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcSubnetViewById { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_view_by_id`] + ///Builder for [`Client::vpc_view_by_id`] /// - ///[`ClientVpcsExt::vpc_view_by_id`]: super::ClientVpcsExt::vpc_view_by_id + ///[`Client::vpc_view_by_id`]: super::Client::vpc_view_by_id #[derive(Debug, Clone)] pub struct VpcViewById<'a> { client: &'a super::Client, @@ -29229,40 +35912,33 @@ pub mod builder { ///Sends a `GET` request to `/by-id/vpcs/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/by-id/vpcs/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/by-id/vpcs/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcViewById { + client: client, + request, + }) } } - ///Builder for [`ClientHiddenExt::device_auth_request`] + ///Builder for [`Client::device_auth_request`] /// - ///[`ClientHiddenExt::device_auth_request`]: super::ClientHiddenExt::device_auth_request + ///[`Client::device_auth_request`]: super::Client::device_auth_request #[derive(Debug, Clone)] pub struct DeviceAuthRequest<'a> { client: &'a super::Client, @@ -29301,25 +35977,28 @@ pub mod builder { ///Sends a `POST` request to `/device/auth` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::DeviceAuthRequest::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/device/auth", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).form_urlencoded(&body)?.build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), - } + let request = { + let url = format!("{}/device/auth", client.baseurl,); + client.client.post(url).form_urlencoded(&body)? + }; + Ok(built::DeviceAuthRequest { + client: client, + request, + }) } } - ///Builder for [`ClientHiddenExt::device_auth_confirm`] + ///Builder for [`Client::device_auth_confirm`] /// - ///[`ClientHiddenExt::device_auth_confirm`]: super::ClientHiddenExt::device_auth_confirm + ///[`Client::device_auth_confirm`]: super::Client::device_auth_confirm #[derive(Debug, Clone)] pub struct DeviceAuthConfirm<'a> { client: &'a super::Client, @@ -29358,39 +36037,35 @@ pub mod builder { ///Sends a `POST` request to `/device/confirm` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::DeviceAuthVerify::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/device/confirm", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/device/confirm", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::DeviceAuthConfirm { + client: client, + request, + }) } } - ///Builder for [`ClientHiddenExt::device_access_token`] + ///Builder for [`Client::device_access_token`] /// - ///[`ClientHiddenExt::device_access_token`]: super::ClientHiddenExt::device_access_token + ///[`Client::device_access_token`]: super::Client::device_access_token #[derive(Debug, Clone)] pub struct DeviceAccessToken<'a> { client: &'a super::Client, @@ -29431,27 +36106,30 @@ pub mod builder { ///Sends a `POST` request to `/device/token` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| { types::DeviceAccessTokenRequest::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/device/token", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).form_urlencoded(&body)?.build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), - } + let request = { + let url = format!("{}/device/token", client.baseurl,); + client.client.post(url).form_urlencoded(&body)? + }; + Ok(built::DeviceAccessToken { + client: client, + request, + }) } } - ///Builder for [`ClientSilosExt::group_list`] + ///Builder for [`Client::group_list`] /// - ///[`ClientSilosExt::group_list`]: super::ClientSilosExt::group_list + ///[`Client::group_list`]: super::Client::group_list #[derive(Debug, Clone)] pub struct GroupList<'a> { client: &'a super::Client, @@ -29506,6 +36184,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -29515,39 +36197,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/groups", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/groups", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::GroupList { + client: client, + request, + }) } ///Streams `GET` requests to `/groups` @@ -29607,9 +36281,9 @@ pub mod builder { } } - ///Builder for [`ClientHiddenExt::login_spoof`] + ///Builder for [`Client::login_spoof`] /// - ///[`ClientHiddenExt::login_spoof`]: super::ClientHiddenExt::login_spoof + ///[`Client::login_spoof`]: super::Client::login_spoof #[derive(Debug, Clone)] pub struct LoginSpoof<'a> { client: &'a super::Client, @@ -29646,39 +36320,35 @@ pub mod builder { ///Sends a `POST` request to `/login` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SpoofLoginBody::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/login", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/login", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::LoginSpoof { + client: client, + request, + }) } } - ///Builder for [`ClientLoginExt::login_local`] + ///Builder for [`Client::login_local`] /// - ///[`ClientLoginExt::login_local`]: super::ClientLoginExt::login_local + ///[`Client::login_local`]: super::Client::login_local #[derive(Debug, Clone)] pub struct LoginLocal<'a> { client: &'a super::Client, @@ -29732,6 +36402,10 @@ pub mod builder { ///Sends a `POST` request to `/login/{silo_name}/local` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -29743,31 +36417,24 @@ pub mod builder { types::UsernamePasswordCredentials::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/login/{}/local", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - ///Builder for [`ClientLoginExt::login_saml_begin`] - /// - ///[`ClientLoginExt::login_saml_begin`]: super::ClientLoginExt::login_saml_begin + let request = { + let url = format!( + "{}/login/{}/local", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.post(url).json(&body) + }; + Ok(built::LoginLocal { + client: client, + request, + }) + } + } + + ///Builder for [`Client::login_saml_begin`] + /// + ///[`Client::login_saml_begin`]: super::Client::login_saml_begin #[derive(Debug, Clone)] pub struct LoginSamlBegin<'a> { client: &'a super::Client, @@ -29806,6 +36473,10 @@ pub mod builder { ///Sends a `GET` request to `/login/{silo_name}/saml/{provider_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -29813,32 +36484,25 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/login/{}/saml/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client.client.get(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - ///Builder for [`ClientLoginExt::login_saml`] - /// - ///[`ClientLoginExt::login_saml`]: super::ClientLoginExt::login_saml + let request = { + let url = format!( + "{}/login/{}/saml/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + client.client.get(url) + }; + Ok(built::LoginSamlBegin { + client: client, + request, + }) + } + } + + ///Builder for [`Client::login_saml`] + /// + ///[`Client::login_saml`]: super::Client::login_saml #[derive(Debug)] pub struct LoginSaml<'a> { client: &'a super::Client, @@ -29889,6 +36553,10 @@ pub mod builder { ///Sends a `POST` request to `/login/{silo_name}/saml/{provider_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -29898,40 +36566,32 @@ pub mod builder { let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/login/{}/saml/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/login/{}/saml/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + }; + Ok(built::LoginSaml { + client: client, + request, + }) } } - ///Builder for [`ClientHiddenExt::logout`] + ///Builder for [`Client::logout`] /// - ///[`ClientHiddenExt::logout`]: super::ClientHiddenExt::logout + ///[`Client::logout`]: super::Client::logout #[derive(Debug, Clone)] pub struct Logout<'a> { client: &'a super::Client, @@ -29944,35 +36604,28 @@ pub mod builder { ///Sends a `POST` request to `/logout` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/logout", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/logout", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::Logout { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_list`] + ///Builder for [`Client::organization_list`] /// - ///[`ClientOrganizationsExt::organization_list`]: super::ClientOrganizationsExt::organization_list + ///[`Client::organization_list`]: super::Client::organization_list #[derive(Debug, Clone)] pub struct OrganizationList<'a> { client: &'a super::Client, @@ -30027,6 +36680,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -30036,39 +36693,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/organizations", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/organizations", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::OrganizationList { + client: client, + request, + }) } ///Streams `GET` requests to `/organizations` @@ -30128,9 +36777,9 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organization_create`] + ///Builder for [`Client::organization_create`] /// - ///[`ClientOrganizationsExt::organization_create`]: super::ClientOrganizationsExt::organization_create + ///[`Client::organization_create`]: super::Client::organization_create #[derive(Debug, Clone)] pub struct OrganizationCreate<'a> { client: &'a super::Client, @@ -30169,39 +36818,35 @@ pub mod builder { ///Sends a `POST` request to `/organizations` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::OrganizationCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/organizations", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/organizations", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationCreate { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_view`] + ///Builder for [`Client::organization_view`] /// - ///[`ClientOrganizationsExt::organization_view`]: super::ClientOrganizationsExt::organization_view + ///[`Client::organization_view`]: super::Client::organization_view #[derive(Debug, Clone)] pub struct OrganizationView<'a> { client: &'a super::Client, @@ -30228,43 +36873,36 @@ pub mod builder { ///Sends a `GET` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationView { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_update`] + ///Builder for [`Client::organization_update`] /// - ///[`ClientOrganizationsExt::organization_update`]: super::ClientOrganizationsExt::organization_update + ///[`Client::organization_update`]: super::Client::organization_update #[derive(Debug, Clone)] pub struct OrganizationUpdate<'a> { client: &'a super::Client, @@ -30315,6 +36953,10 @@ pub mod builder { ///Sends a `PUT` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30324,39 +36966,31 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_delete`] + ///Builder for [`Client::organization_delete`] /// - ///[`ClientOrganizationsExt::organization_delete`]: super::ClientOrganizationsExt::organization_delete + ///[`Client::organization_delete`]: super::Client::organization_delete #[derive(Debug, Clone)] pub struct OrganizationDelete<'a> { client: &'a super::Client, @@ -30383,43 +37017,36 @@ pub mod builder { ///Sends a `DELETE` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationDelete { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_policy_view`] + ///Builder for [`Client::organization_policy_view`] /// - ///[`ClientOrganizationsExt::organization_policy_view`]: super::ClientOrganizationsExt::organization_policy_view + ///[`Client::organization_policy_view`]: super::Client::organization_policy_view #[derive(Debug, Clone)] pub struct OrganizationPolicyView<'a> { client: &'a super::Client, @@ -30448,43 +37075,36 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationPolicyView { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_policy_update`] + ///Builder for [`Client::organization_policy_update`] /// - ///[`ClientOrganizationsExt::organization_policy_update`]: super::ClientOrganizationsExt::organization_policy_update + ///[`Client::organization_policy_update`]: super::Client::organization_policy_update #[derive(Debug, Clone)] pub struct OrganizationPolicyUpdate<'a> { client: &'a super::Client, @@ -30539,6 +37159,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30548,39 +37172,31 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationPolicyUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_list`] + ///Builder for [`Client::project_list`] /// - ///[`ClientProjectsExt::project_list`]: super::ClientProjectsExt::project_list + ///[`Client::project_list`]: super::Client::project_list #[derive(Debug, Clone)] pub struct ProjectList<'a> { client: &'a super::Client, @@ -30648,6 +37264,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30659,43 +37279,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -30756,9 +37368,9 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::project_create`] + ///Builder for [`Client::project_create`] /// - ///[`ClientProjectsExt::project_create`]: super::ClientProjectsExt::project_create + ///[`Client::project_create`]: super::Client::project_create #[derive(Debug, Clone)] pub struct ProjectCreate<'a> { client: &'a super::Client, @@ -30808,6 +37420,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30817,39 +37433,31 @@ pub mod builder { let body = body .and_then(|v| types::ProjectCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects", - client.baseurl, - encode_path(&organization_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects", + client.baseurl, + encode_path(&organization_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ProjectCreate { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_view`] + ///Builder for [`Client::project_view`] /// - ///[`ClientProjectsExt::project_view`]: super::ClientProjectsExt::project_view + ///[`Client::project_view`]: super::Client::project_view #[derive(Debug, Clone)] pub struct ProjectView<'a> { client: &'a super::Client, @@ -30889,6 +37497,10 @@ pub mod builder { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -30896,39 +37508,28 @@ pub mod builder { } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectView { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_update`] + ///Builder for [`Client::project_update`] /// - ///[`ClientProjectsExt::project_update`]: super::ClientProjectsExt::project_update + ///[`Client::project_update`]: super::Client::project_update #[derive(Debug, Clone)] pub struct ProjectUpdate<'a> { client: &'a super::Client, @@ -30990,6 +37591,10 @@ pub mod builder { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31001,40 +37606,32 @@ pub mod builder { let body = body .and_then(|v| types::ProjectUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ProjectUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_delete`] + ///Builder for [`Client::project_delete`] /// - ///[`ClientProjectsExt::project_delete`]: super::ClientProjectsExt::project_delete + ///[`Client::project_delete`]: super::Client::project_delete #[derive(Debug, Clone)] pub struct ProjectDelete<'a> { client: &'a super::Client, @@ -31074,6 +37671,10 @@ pub mod builder { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31081,39 +37682,28 @@ pub mod builder { } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectDelete { + client: client, + request, + }) } } - ///Builder for [`ClientDisksExt::disk_list`] + ///Builder for [`Client::disk_list`] /// - ///[`ClientDisksExt::disk_list`]: super::ClientDisksExt::disk_list + ///[`Client::disk_list`]: super::Client::disk_list #[derive(Debug, Clone)] pub struct DiskList<'a> { client: &'a super::Client, @@ -31193,6 +37783,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31206,44 +37800,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -31304,9 +37890,9 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::disk_create`] + ///Builder for [`Client::disk_create`] /// - ///[`ClientDisksExt::disk_create`]: super::ClientDisksExt::disk_create + ///[`Client::disk_create`]: super::Client::disk_create #[derive(Debug, Clone)] pub struct DiskCreate<'a> { client: &'a super::Client, @@ -31368,6 +37954,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/disks` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31379,40 +37969,32 @@ pub mod builder { let body = body .and_then(|v| types::DiskCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::DiskCreate { + client: client, + request, + }) } } - ///Builder for [`ClientDisksExt::disk_view`] + ///Builder for [`Client::disk_view`] /// - ///[`ClientDisksExt::disk_view`]: super::ClientDisksExt::disk_view + ///[`Client::disk_view`]: super::Client::disk_view #[derive(Debug, Clone)] pub struct DiskView<'a> { client: &'a super::Client, @@ -31465,6 +38047,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31474,40 +38060,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::DiskView { + client: client, + request, + }) } } - ///Builder for [`ClientDisksExt::disk_delete`] + ///Builder for [`Client::disk_delete`] /// - ///[`ClientDisksExt::disk_delete`]: super::ClientDisksExt::disk_delete + ///[`Client::disk_delete`]: super::Client::disk_delete #[derive(Debug, Clone)] pub struct DiskDelete<'a> { client: &'a super::Client, @@ -31560,6 +38135,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31569,40 +38148,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::DiskDelete { + client: client, + request, + }) } } - ///Builder for [`ClientDisksExt::disk_metrics_list`] + ///Builder for [`Client::disk_metrics_list`] /// - ///[`ClientDisksExt::disk_metrics_list`]: super::ClientDisksExt::disk_metrics_list + ///[`Client::disk_metrics_list`]: super::Client::disk_metrics_list #[derive(Debug, Clone)] pub struct DiskMetricsList<'a> { client: &'a super::Client, @@ -31721,6 +38289,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31740,49 +38312,41 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let start_time = start_time.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - encode_path(&metric_name.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &end_time { - query.push(("end_time", v.to_string())); - } - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &start_time { - query.push(("start_time", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + encode_path(&metric_name.to_string()), + ); + let mut query = Vec::with_capacity(4usize); + if let Some(v) = &end_time { + query.push(("end_time", v.to_string())); + } + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &start_time { + query.push(("start_time", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskMetricsList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -31845,9 +38409,9 @@ pub mod builder { } } - ///Builder for [`ClientImagesExt::image_list`] + ///Builder for [`Client::image_list`] /// - ///[`ClientImagesExt::image_list`]: super::ClientImagesExt::image_list + ///[`Client::image_list`]: super::Client::image_list #[derive(Debug, Clone)] pub struct ImageList<'a> { client: &'a super::Client, @@ -31927,6 +38491,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -31940,44 +38508,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ImageList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -32038,9 +38598,9 @@ pub mod builder { } } - ///Builder for [`ClientImagesExt::image_create`] + ///Builder for [`Client::image_create`] /// - ///[`ClientImagesExt::image_create`]: super::ClientImagesExt::image_create + ///[`Client::image_create`]: super::Client::image_create #[derive(Debug, Clone)] pub struct ImageCreate<'a> { client: &'a super::Client, @@ -32102,6 +38662,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/images` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32113,40 +38677,32 @@ pub mod builder { let body = body .and_then(|v| types::ImageCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ImageCreate { + client: client, + request, + }) } } - ///Builder for [`ClientImagesExt::image_view`] + ///Builder for [`Client::image_view`] /// - ///[`ClientImagesExt::image_view`]: super::ClientImagesExt::image_view + ///[`Client::image_view`]: super::Client::image_view #[derive(Debug, Clone)] pub struct ImageView<'a> { client: &'a super::Client, @@ -32199,6 +38755,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32208,40 +38768,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&image_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ImageView { + client: client, + request, + }) } } - ///Builder for [`ClientImagesExt::image_delete`] + ///Builder for [`Client::image_delete`] /// - ///[`ClientImagesExt::image_delete`]: super::ClientImagesExt::image_delete + ///[`Client::image_delete`]: super::Client::image_delete #[derive(Debug, Clone)] pub struct ImageDelete<'a> { client: &'a super::Client, @@ -32294,6 +38843,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32303,40 +38856,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/images/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/images/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&image_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ImageDelete { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_list`] + ///Builder for [`Client::instance_list`] /// - ///[`ClientInstancesExt::instance_list`]: super::ClientInstancesExt::instance_list + ///[`Client::instance_list`]: super::Client::instance_list #[derive(Debug, Clone)] pub struct InstanceList<'a> { client: &'a super::Client, @@ -32417,6 +38959,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32430,44 +38976,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -32529,9 +39067,9 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_create`] + ///Builder for [`Client::instance_create`] /// - ///[`ClientInstancesExt::instance_create`]: super::ClientInstancesExt::instance_create + ///[`Client::instance_create`]: super::Client::instance_create #[derive(Debug, Clone)] pub struct InstanceCreate<'a> { client: &'a super::Client, @@ -32594,6 +39132,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32605,40 +39147,32 @@ pub mod builder { let body = body .and_then(|v| types::InstanceCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceCreate { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_view`] + ///Builder for [`Client::instance_view`] /// - ///[`ClientInstancesExt::instance_view`]: super::ClientInstancesExt::instance_view + ///[`Client::instance_view`]: super::Client::instance_view #[derive(Debug, Clone)] pub struct InstanceView<'a> { client: &'a super::Client, @@ -32691,6 +39225,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32700,40 +39238,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceView { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_delete`] + ///Builder for [`Client::instance_delete`] /// - ///[`ClientInstancesExt::instance_delete`]: super::ClientInstancesExt::instance_delete + ///[`Client::instance_delete`]: super::Client::instance_delete #[derive(Debug, Clone)] pub struct InstanceDelete<'a> { client: &'a super::Client, @@ -32786,6 +39313,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32795,40 +39326,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceDelete { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_disk_list`] + ///Builder for [`Client::instance_disk_list`] /// - ///[`ClientInstancesExt::instance_disk_list`]: super::ClientInstancesExt::instance_disk_list + ///[`Client::instance_disk_list`]: super::Client::instance_disk_list #[derive(Debug, Clone)] pub struct InstanceDiskList<'a> { client: &'a super::Client, @@ -32921,6 +39441,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -32936,45 +39460,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceDiskList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -33036,9 +39552,9 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_disk_attach`] + ///Builder for [`Client::instance_disk_attach`] /// - ///[`ClientInstancesExt::instance_disk_attach`]: super::ClientInstancesExt::instance_disk_attach + ///[`Client::instance_disk_attach`]: super::Client::instance_disk_attach #[derive(Debug, Clone)] pub struct InstanceDiskAttach<'a> { client: &'a super::Client, @@ -33113,6 +39629,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks/attach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33126,41 +39646,33 @@ pub mod builder { let body = body .and_then(|v| types::DiskIdentifier::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks/attach", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks/attach", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceDiskAttach { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_disk_detach`] + ///Builder for [`Client::instance_disk_detach`] /// - ///[`ClientInstancesExt::instance_disk_detach`]: super::ClientInstancesExt::instance_disk_detach + ///[`Client::instance_disk_detach`]: super::Client::instance_disk_detach #[derive(Debug, Clone)] pub struct InstanceDiskDetach<'a> { client: &'a super::Client, @@ -33235,6 +39747,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks/detach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33248,41 +39764,33 @@ pub mod builder { let body = body .and_then(|v| types::DiskIdentifier::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks/detach", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks/detach", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceDiskDetach { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_external_ip_list`] + ///Builder for [`Client::instance_external_ip_list`] /// - ///[`ClientInstancesExt::instance_external_ip_list`]: super::ClientInstancesExt::instance_external_ip_list + ///[`Client::instance_external_ip_list`]: super::Client::instance_external_ip_list #[derive(Debug, Clone)] pub struct InstanceExternalIpList<'a> { client: &'a super::Client, @@ -33337,6 +39845,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33346,40 +39858,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/external-ips", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/external-ips", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceExternalIpList { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_migrate`] + ///Builder for [`Client::instance_migrate`] /// - ///[`ClientInstancesExt::instance_migrate`]: super::ClientInstancesExt::instance_migrate + ///[`Client::instance_migrate`]: super::Client::instance_migrate #[derive(Debug, Clone)] pub struct InstanceMigrate<'a> { client: &'a super::Client, @@ -33454,6 +39955,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/migrate` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33467,41 +39972,33 @@ pub mod builder { let body = body .and_then(|v| types::InstanceMigrate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/migrate", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/migrate", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceMigrate { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_network_interface_list`] + ///Builder for [`Client::instance_network_interface_list`] /// - ///[`ClientInstancesExt::instance_network_interface_list`]: super::ClientInstancesExt::instance_network_interface_list + ///[`Client::instance_network_interface_list`]: super::Client::instance_network_interface_list #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceList<'a> { client: &'a super::Client, @@ -33595,6 +40092,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33610,45 +40111,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceNetworkInterfaceList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -33710,9 +40203,9 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_network_interface_create`] + ///Builder for [`Client::instance_network_interface_create`] /// - ///[`ClientInstancesExt::instance_network_interface_create`]: super::ClientInstancesExt::instance_network_interface_create + ///[`Client::instance_network_interface_create`]: super::Client::instance_network_interface_create #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceCreate<'a> { client: &'a super::Client, @@ -33793,6 +40286,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -33806,41 +40305,33 @@ pub mod builder { let body = body .and_then(|v| types::NetworkInterfaceCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceNetworkInterfaceCreate { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_network_interface_view`] + ///Builder for [`Client::instance_network_interface_view`] /// - ///[`ClientInstancesExt::instance_network_interface_view`]: super::ClientInstancesExt::instance_network_interface_view + ///[`Client::instance_network_interface_view`]: super::Client::instance_network_interface_view #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceView<'a> { client: &'a super::Client, @@ -33907,6 +40398,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -33918,41 +40413,30 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceNetworkInterfaceView { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_network_interface_update`] + ///Builder for [`Client::instance_network_interface_update`] /// - ///[`ClientInstancesExt::instance_network_interface_update`]: super::ClientInstancesExt::instance_network_interface_update + ///[`Client::instance_network_interface_update`]: super::Client::instance_network_interface_update #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceUpdate<'a> { client: &'a super::Client, @@ -34045,6 +40529,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -34060,42 +40550,34 @@ pub mod builder { let body = body .and_then(|v| types::NetworkInterfaceUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceNetworkInterfaceUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_network_interface_delete`] + ///Builder for [`Client::instance_network_interface_delete`] /// - ///[`ClientInstancesExt::instance_network_interface_delete`]: super::ClientInstancesExt::instance_network_interface_delete + ///[`Client::instance_network_interface_delete`]: super::Client::instance_network_interface_delete #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceDelete<'a> { client: &'a super::Client, @@ -34160,6 +40642,12 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces/{interface_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -34171,41 +40659,30 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceNetworkInterfaceDelete { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_reboot`] + ///Builder for [`Client::instance_reboot`] /// - ///[`ClientInstancesExt::instance_reboot`]: super::ClientInstancesExt::instance_reboot + ///[`Client::instance_reboot`]: super::Client::instance_reboot #[derive(Debug, Clone)] pub struct InstanceReboot<'a> { client: &'a super::Client, @@ -34258,6 +40735,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/reboot` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34267,40 +40748,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/reboot", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/reboot", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceReboot { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_serial_console`] + ///Builder for [`Client::instance_serial_console`] /// - ///[`ClientInstancesExt::instance_serial_console`]: super::ClientInstancesExt::instance_serial_console + ///[`Client::instance_serial_console`]: super::Client::instance_serial_console #[derive(Debug, Clone)] pub struct InstanceSerialConsole<'a> { client: &'a super::Client, @@ -34394,6 +40864,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34409,51 +40883,43 @@ pub mod builder { let from_start = from_start.map_err(Error::InvalidRequest)?; let max_bytes = max_bytes.map_err(Error::InvalidRequest)?; let most_recent = most_recent.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/serial-console", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &from_start { - query.push(("from_start", v.to_string())); - } - if let Some(v) = &max_bytes { - query.push(("max_bytes", v.to_string())); - } - if let Some(v) = &most_recent { - query.push(("most_recent", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/serial-console", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &from_start { + query.push(("from_start", v.to_string())); + } + if let Some(v) = &max_bytes { + query.push(("max_bytes", v.to_string())); + } + if let Some(v) = &most_recent { + query.push(("most_recent", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceSerialConsole { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_serial_console_stream`] + ///Builder for [`Client::instance_serial_console_stream`] /// - ///[`ClientInstancesExt::instance_serial_console_stream`]: super::ClientInstancesExt::instance_serial_console_stream + ///[`Client::instance_serial_console_stream`]: super::Client::instance_serial_console_stream #[derive(Debug, Clone)] pub struct InstanceSerialConsoleStream<'a> { client: &'a super::Client, @@ -34508,6 +40974,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -34517,41 +40989,38 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 101u16 => ResponseValue::upgrade(response).await, - 200..=299 => ResponseValue::upgrade(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client + .client + .get(url) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + }; + Ok(built::InstanceSerialConsoleStream { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_start`] + ///Builder for [`Client::instance_start`] /// - ///[`ClientInstancesExt::instance_start`]: super::ClientInstancesExt::instance_start + ///[`Client::instance_start`]: super::Client::instance_start #[derive(Debug, Clone)] pub struct InstanceStart<'a> { client: &'a super::Client, @@ -34604,6 +41073,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/start` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34613,40 +41086,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/start", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/start", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceStart { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_stop`] + ///Builder for [`Client::instance_stop`] /// - ///[`ClientInstancesExt::instance_stop`]: super::ClientInstancesExt::instance_stop + ///[`Client::instance_stop`]: super::Client::instance_stop #[derive(Debug, Clone)] pub struct InstanceStop<'a> { client: &'a super::Client, @@ -34699,6 +41161,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/stop` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34708,40 +41174,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/stop", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/stop", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceStop { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_policy_view`] + ///Builder for [`Client::project_policy_view`] /// - ///[`ClientProjectsExt::project_policy_view`]: super::ClientProjectsExt::project_policy_view + ///[`Client::project_policy_view`]: super::Client::project_policy_view #[derive(Debug, Clone)] pub struct ProjectPolicyView<'a> { client: &'a super::Client, @@ -34783,6 +41238,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34790,39 +41249,28 @@ pub mod builder { } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::ProjectPolicyView { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_policy_update`] + ///Builder for [`Client::project_policy_update`] /// - ///[`ClientProjectsExt::project_policy_update`]: super::ClientProjectsExt::project_policy_update + ///[`Client::project_policy_update`]: super::Client::project_policy_update #[derive(Debug, Clone)] pub struct ProjectPolicyUpdate<'a> { client: &'a super::Client, @@ -34888,6 +41336,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -34899,40 +41351,32 @@ pub mod builder { let body = body .and_then(|v| types::ProjectRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/policy", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/policy", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::ProjectPolicyUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientSnapshotsExt::snapshot_list`] + ///Builder for [`Client::snapshot_list`] /// - ///[`ClientSnapshotsExt::snapshot_list`]: super::ClientSnapshotsExt::snapshot_list + ///[`Client::snapshot_list`]: super::Client::snapshot_list #[derive(Debug, Clone)] pub struct SnapshotList<'a> { client: &'a super::Client, @@ -35013,6 +41457,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35026,44 +41474,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SnapshotList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -35125,9 +41565,9 @@ pub mod builder { } } - ///Builder for [`ClientSnapshotsExt::snapshot_create`] + ///Builder for [`Client::snapshot_create`] /// - ///[`ClientSnapshotsExt::snapshot_create`]: super::ClientSnapshotsExt::snapshot_create + ///[`Client::snapshot_create`]: super::Client::snapshot_create #[derive(Debug, Clone)] pub struct SnapshotCreate<'a> { client: &'a super::Client, @@ -35190,6 +41630,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35201,40 +41645,32 @@ pub mod builder { let body = body .and_then(|v| types::SnapshotCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SnapshotCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSnapshotsExt::snapshot_view`] + ///Builder for [`Client::snapshot_view`] /// - ///[`ClientSnapshotsExt::snapshot_view`]: super::ClientSnapshotsExt::snapshot_view + ///[`Client::snapshot_view`]: super::Client::snapshot_view #[derive(Debug, Clone)] pub struct SnapshotView<'a> { client: &'a super::Client, @@ -35287,6 +41723,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots/{snapshot_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35296,40 +41736,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let snapshot_name = snapshot_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&snapshot_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&snapshot_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SnapshotView { + client: client, + request, + }) } } - ///Builder for [`ClientSnapshotsExt::snapshot_delete`] + ///Builder for [`Client::snapshot_delete`] /// - ///[`ClientSnapshotsExt::snapshot_delete`]: super::ClientSnapshotsExt::snapshot_delete + ///[`Client::snapshot_delete`]: super::Client::snapshot_delete #[derive(Debug, Clone)] pub struct SnapshotDelete<'a> { client: &'a super::Client, @@ -35382,6 +41811,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots/{snapshot_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35391,40 +41824,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let snapshot_name = snapshot_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/snapshots/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&snapshot_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&snapshot_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SnapshotDelete { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_list`] + ///Builder for [`Client::vpc_list`] /// - ///[`ClientVpcsExt::vpc_list`]: super::ClientVpcsExt::vpc_list + ///[`Client::vpc_list`]: super::Client::vpc_list #[derive(Debug, Clone)] pub struct VpcList<'a> { client: &'a super::Client, @@ -35504,6 +41926,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35517,44 +41943,36 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -35615,9 +42033,9 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::vpc_create`] + ///Builder for [`Client::vpc_create`] /// - ///[`ClientVpcsExt::vpc_create`]: super::ClientVpcsExt::vpc_create + ///[`Client::vpc_create`]: super::Client::vpc_create #[derive(Debug, Clone)] pub struct VpcCreate<'a> { client: &'a super::Client, @@ -35679,6 +42097,10 @@ pub mod builder { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35690,40 +42112,32 @@ pub mod builder { let body = body .and_then(|v| types::VpcCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcCreate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_view`] + ///Builder for [`Client::vpc_view`] /// - ///[`ClientVpcsExt::vpc_view`]: super::ClientVpcsExt::vpc_view + ///[`Client::vpc_view`]: super::Client::vpc_view #[derive(Debug, Clone)] pub struct VpcView<'a> { client: &'a super::Client, @@ -35776,6 +42190,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35785,40 +42203,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcView { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_update`] + ///Builder for [`Client::vpc_update`] /// - ///[`ClientVpcsExt::vpc_update`]: super::ClientVpcsExt::vpc_update + ///[`Client::vpc_update`]: super::Client::vpc_update #[derive(Debug, Clone)] pub struct VpcUpdate<'a> { client: &'a super::Client, @@ -35893,6 +42300,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -35906,41 +42317,33 @@ pub mod builder { let body = body .and_then(|v| types::VpcUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_delete`] + ///Builder for [`Client::vpc_delete`] /// - ///[`ClientVpcsExt::vpc_delete`]: super::ClientVpcsExt::vpc_delete + ///[`Client::vpc_delete`]: super::Client::vpc_delete #[derive(Debug, Clone)] pub struct VpcDelete<'a> { client: &'a super::Client, @@ -35993,6 +42396,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36002,40 +42409,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcDelete { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_firewall_rules_view`] + ///Builder for [`Client::vpc_firewall_rules_view`] /// - ///[`ClientVpcsExt::vpc_firewall_rules_view`]: super::ClientVpcsExt::vpc_firewall_rules_view + ///[`Client::vpc_firewall_rules_view`]: super::Client::vpc_firewall_rules_view #[derive(Debug, Clone)] pub struct VpcFirewallRulesView<'a> { client: &'a super::Client, @@ -36090,6 +42486,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36099,40 +42499,29 @@ pub mod builder { let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcFirewallRulesView { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_firewall_rules_update`] + ///Builder for [`Client::vpc_firewall_rules_update`] /// - ///[`ClientVpcsExt::vpc_firewall_rules_update`]: super::ClientVpcsExt::vpc_firewall_rules_update + ///[`Client::vpc_firewall_rules_update`]: super::Client::vpc_firewall_rules_update #[derive(Debug, Clone)] pub struct VpcFirewallRulesUpdate<'a> { client: &'a super::Client, @@ -36214,6 +42603,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36229,41 +42622,33 @@ pub mod builder { types::VpcFirewallRuleUpdateParams::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcFirewallRulesUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_list`] + ///Builder for [`Client::vpc_router_list`] /// - ///[`ClientVpcsExt::vpc_router_list`]: super::ClientVpcsExt::vpc_router_list + ///[`Client::vpc_router_list`]: super::Client::vpc_router_list #[derive(Debug, Clone)] pub struct VpcRouterList<'a> { client: &'a super::Client, @@ -36356,6 +42741,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36371,45 +42760,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcRouterList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -36471,9 +42852,9 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::vpc_router_create`] + ///Builder for [`Client::vpc_router_create`] /// - ///[`ClientVpcsExt::vpc_router_create`]: super::ClientVpcsExt::vpc_router_create + ///[`Client::vpc_router_create`]: super::Client::vpc_router_create #[derive(Debug, Clone)] pub struct VpcRouterCreate<'a> { client: &'a super::Client, @@ -36548,6 +42929,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36561,41 +42946,33 @@ pub mod builder { let body = body .and_then(|v| types::VpcRouterCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterCreate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_view`] + ///Builder for [`Client::vpc_router_view`] /// - ///[`ClientVpcsExt::vpc_router_view`]: super::ClientVpcsExt::vpc_router_view + ///[`Client::vpc_router_view`]: super::Client::vpc_router_view #[derive(Debug, Clone)] pub struct VpcRouterView<'a> { client: &'a super::Client, @@ -36660,6 +43037,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36671,41 +43052,30 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterView { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_update`] + ///Builder for [`Client::vpc_router_update`] /// - ///[`ClientVpcsExt::vpc_router_update`]: super::ClientVpcsExt::vpc_router_update + ///[`Client::vpc_router_update`]: super::Client::vpc_router_update #[derive(Debug, Clone)] pub struct VpcRouterUpdate<'a> { client: &'a super::Client, @@ -36792,6 +43162,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36807,42 +43181,34 @@ pub mod builder { let body = body .and_then(|v| types::VpcRouterUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_delete`] + ///Builder for [`Client::vpc_router_delete`] /// - ///[`ClientVpcsExt::vpc_router_delete`]: super::ClientVpcsExt::vpc_router_delete + ///[`Client::vpc_router_delete`]: super::Client::vpc_router_delete #[derive(Debug, Clone)] pub struct VpcRouterDelete<'a> { client: &'a super::Client, @@ -36907,6 +43273,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -36918,41 +43288,30 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterDelete { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_route_list`] + ///Builder for [`Client::vpc_router_route_list`] /// - ///[`ClientVpcsExt::vpc_router_route_list`]: super::ClientVpcsExt::vpc_router_route_list + ///[`Client::vpc_router_route_list`]: super::Client::vpc_router_route_list #[derive(Debug, Clone)] pub struct VpcRouterRouteList<'a> { client: &'a super::Client, @@ -37057,6 +43416,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37074,46 +43437,38 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcRouterRouteList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -37175,9 +43530,9 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::vpc_router_route_create`] + ///Builder for [`Client::vpc_router_route_create`] /// - ///[`ClientVpcsExt::vpc_router_route_create`]: super::ClientVpcsExt::vpc_router_route_create + ///[`Client::vpc_router_route_create`]: super::Client::vpc_router_route_create #[derive(Debug, Clone)] pub struct VpcRouterRouteCreate<'a> { client: &'a super::Client, @@ -37268,6 +43623,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37285,42 +43644,34 @@ pub mod builder { types::RouterRouteCreateParams::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterRouteCreate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_route_view`] + ///Builder for [`Client::vpc_router_route_view`] /// - ///[`ClientVpcsExt::vpc_router_route_view`]: super::ClientVpcsExt::vpc_router_route_view + ///[`Client::vpc_router_route_view`]: super::Client::vpc_router_route_view #[derive(Debug, Clone)] pub struct VpcRouterRouteView<'a> { client: &'a super::Client, @@ -37397,6 +43748,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37410,42 +43765,31 @@ pub mod builder { let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterRouteView { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_route_update`] + ///Builder for [`Client::vpc_router_route_update`] /// - ///[`ClientVpcsExt::vpc_router_route_update`]: super::ClientVpcsExt::vpc_router_route_update + ///[`Client::vpc_router_route_update`]: super::Client::vpc_router_route_update #[derive(Debug, Clone)] pub struct VpcRouterRouteUpdate<'a> { client: &'a super::Client, @@ -37548,6 +43892,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37567,43 +43915,35 @@ pub mod builder { types::RouterRouteUpdateParams::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcRouterRouteUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_router_route_delete`] + ///Builder for [`Client::vpc_router_route_delete`] /// - ///[`ClientVpcsExt::vpc_router_route_delete`]: super::ClientVpcsExt::vpc_router_route_delete + ///[`Client::vpc_router_route_delete`]: super::Client::vpc_router_route_delete #[derive(Debug, Clone)] pub struct VpcRouterRouteDelete<'a> { client: &'a super::Client, @@ -37680,6 +44020,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37693,42 +44037,31 @@ pub mod builder { let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcRouterRouteDelete { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_subnet_list`] + ///Builder for [`Client::vpc_subnet_list`] /// - ///[`ClientVpcsExt::vpc_subnet_list`]: super::ClientVpcsExt::vpc_subnet_list + ///[`Client::vpc_subnet_list`]: super::Client::vpc_subnet_list #[derive(Debug, Clone)] pub struct VpcSubnetList<'a> { client: &'a super::Client, @@ -37821,6 +44154,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -37836,45 +44173,37 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcSubnetList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -37936,9 +44265,9 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::vpc_subnet_create`] + ///Builder for [`Client::vpc_subnet_create`] /// - ///[`ClientVpcsExt::vpc_subnet_create`]: super::ClientVpcsExt::vpc_subnet_create + ///[`Client::vpc_subnet_create`]: super::Client::vpc_subnet_create #[derive(Debug, Clone)] pub struct VpcSubnetCreate<'a> { client: &'a super::Client, @@ -38013,6 +44342,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38026,41 +44359,33 @@ pub mod builder { let body = body .and_then(|v| types::VpcSubnetCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcSubnetCreate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_subnet_view`] + ///Builder for [`Client::vpc_subnet_view`] /// - ///[`ClientVpcsExt::vpc_subnet_view`]: super::ClientVpcsExt::vpc_subnet_view + ///[`Client::vpc_subnet_view`]: super::Client::vpc_subnet_view #[derive(Debug, Clone)] pub struct VpcSubnetView<'a> { client: &'a super::Client, @@ -38125,6 +44450,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38136,41 +44465,30 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcSubnetView { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_subnet_update`] + ///Builder for [`Client::vpc_subnet_update`] /// - ///[`ClientVpcsExt::vpc_subnet_update`]: super::ClientVpcsExt::vpc_subnet_update + ///[`Client::vpc_subnet_update`]: super::Client::vpc_subnet_update #[derive(Debug, Clone)] pub struct VpcSubnetUpdate<'a> { client: &'a super::Client, @@ -38257,6 +44575,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38272,42 +44594,34 @@ pub mod builder { let body = body .and_then(|v| types::VpcSubnetUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::VpcSubnetUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_subnet_delete`] + ///Builder for [`Client::vpc_subnet_delete`] /// - ///[`ClientVpcsExt::vpc_subnet_delete`]: super::ClientVpcsExt::vpc_subnet_delete + ///[`Client::vpc_subnet_delete`]: super::Client::vpc_subnet_delete #[derive(Debug, Clone)] pub struct VpcSubnetDelete<'a> { client: &'a super::Client, @@ -38372,6 +44686,10 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization_name, @@ -38383,41 +44701,30 @@ pub mod builder { let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::VpcSubnetDelete { + client: client, + request, + }) } } - ///Builder for [`ClientVpcsExt::vpc_subnet_list_network_interfaces`] + ///Builder for [`Client::vpc_subnet_list_network_interfaces`] /// - ///[`ClientVpcsExt::vpc_subnet_list_network_interfaces`]: super::ClientVpcsExt::vpc_subnet_list_network_interfaces + ///[`Client::vpc_subnet_list_network_interfaces`]: super::Client::vpc_subnet_list_network_interfaces #[derive(Debug, Clone)] pub struct VpcSubnetListNetworkInterfaces<'a> { client: &'a super::Client, @@ -38523,6 +44830,12 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, organization_name, @@ -38540,46 +44853,38 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", - client.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", + client.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::VpcSubnetListNetworkInterfaces { + client: client, + request, + }) } ///Streams `GET` requests to @@ -38641,9 +44946,9 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::policy_view`] + ///Builder for [`Client::policy_view`] /// - ///[`ClientSilosExt::policy_view`]: super::ClientSilosExt::policy_view + ///[`Client::policy_view`]: super::Client::policy_view #[derive(Debug, Clone)] pub struct PolicyView<'a> { client: &'a super::Client, @@ -38658,35 +44963,28 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/policy", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::PolicyView { + client: client, + request, + }) } } - ///Builder for [`ClientSilosExt::policy_update`] + ///Builder for [`Client::policy_update`] /// - ///[`ClientSilosExt::policy_update`]: super::ClientSilosExt::policy_update + ///[`Client::policy_update`]: super::Client::policy_update #[derive(Debug, Clone)] pub struct PolicyUpdate<'a> { client: &'a super::Client, @@ -38725,39 +45023,35 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SiloRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/policy", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::PolicyUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientRolesExt::role_list`] + ///Builder for [`Client::role_list`] /// - ///[`ClientRolesExt::role_list`]: super::ClientRolesExt::role_list + ///[`Client::role_list`]: super::Client::role_list #[derive(Debug, Clone)] pub struct RoleList<'a> { client: &'a super::Client, @@ -38799,6 +45093,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -38806,36 +45104,28 @@ pub mod builder { } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!("{}/roles", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/roles", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::RoleList { + client: client, + request, + }) } ///Streams `GET` requests to `/roles` @@ -38894,9 +45184,9 @@ pub mod builder { } } - ///Builder for [`ClientRolesExt::role_view`] + ///Builder for [`Client::role_view`] /// - ///[`ClientRolesExt::role_view`]: super::ClientRolesExt::role_view + ///[`Client::role_view`]: super::Client::role_view #[derive(Debug, Clone)] pub struct RoleView<'a> { client: &'a super::Client, @@ -38923,40 +45213,33 @@ pub mod builder { ///Sends a `GET` request to `/roles/{role_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, role_name } = self; let role_name = role_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/roles/{}", - client.baseurl, - encode_path(&role_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/roles/{}", + client.baseurl, + encode_path(&role_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::RoleView { + client: client, + request, + }) } } - ///Builder for [`ClientHiddenExt::session_me`] + ///Builder for [`Client::session_me`] /// - ///[`ClientHiddenExt::session_me`]: super::ClientHiddenExt::session_me + ///[`Client::session_me`]: super::Client::session_me #[derive(Debug, Clone)] pub struct SessionMe<'a> { client: &'a super::Client, @@ -38969,35 +45252,28 @@ pub mod builder { ///Sends a `GET` request to `/session/me` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/session/me", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/session/me", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SessionMe { + client: client, + request, + }) } } - ///Builder for [`ClientHiddenExt::session_me_groups`] + ///Builder for [`Client::session_me_groups`] /// - ///[`ClientHiddenExt::session_me_groups`]: super::ClientHiddenExt::session_me_groups + ///[`Client::session_me_groups`]: super::Client::session_me_groups #[derive(Debug, Clone)] pub struct SessionMeGroups<'a> { client: &'a super::Client, @@ -39052,6 +45328,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -39061,39 +45341,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/session/me/groups", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/session/me/groups", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SessionMeGroups { + client: client, + request, + }) } ///Streams `GET` requests to `/session/me/groups` @@ -39153,9 +45425,9 @@ pub mod builder { } } - ///Builder for [`ClientSessionExt::session_sshkey_list`] + ///Builder for [`Client::session_sshkey_list`] /// - ///[`ClientSessionExt::session_sshkey_list`]: super::ClientSessionExt::session_sshkey_list + ///[`Client::session_sshkey_list`]: super::Client::session_sshkey_list #[derive(Debug, Clone)] pub struct SessionSshkeyList<'a> { client: &'a super::Client, @@ -39210,6 +45482,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -39219,39 +45495,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/session/me/sshkeys", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/session/me/sshkeys", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SessionSshkeyList { + client: client, + request, + }) } ///Streams `GET` requests to `/session/me/sshkeys` @@ -39311,9 +45579,9 @@ pub mod builder { } } - ///Builder for [`ClientSessionExt::session_sshkey_create`] + ///Builder for [`Client::session_sshkey_create`] /// - ///[`ClientSessionExt::session_sshkey_create`]: super::ClientSessionExt::session_sshkey_create + ///[`Client::session_sshkey_create`]: super::Client::session_sshkey_create #[derive(Debug, Clone)] pub struct SessionSshkeyCreate<'a> { client: &'a super::Client, @@ -39350,39 +45618,35 @@ pub mod builder { ///Sends a `POST` request to `/session/me/sshkeys` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SshKeyCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/session/me/sshkeys", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/session/me/sshkeys", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SessionSshkeyCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSessionExt::session_sshkey_view`] + ///Builder for [`Client::session_sshkey_view`] /// - ///[`ClientSessionExt::session_sshkey_view`]: super::ClientSessionExt::session_sshkey_view + ///[`Client::session_sshkey_view`]: super::Client::session_sshkey_view #[derive(Debug, Clone)] pub struct SessionSshkeyView<'a> { client: &'a super::Client, @@ -39409,43 +45673,36 @@ pub mod builder { ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, ssh_key_name, } = self; let ssh_key_name = ssh_key_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/session/me/sshkeys/{}", - client.baseurl, - encode_path(&ssh_key_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/session/me/sshkeys/{}", + client.baseurl, + encode_path(&ssh_key_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SessionSshkeyView { + client: client, + request, + }) } } - ///Builder for [`ClientSessionExt::session_sshkey_delete`] + ///Builder for [`Client::session_sshkey_delete`] /// - ///[`ClientSessionExt::session_sshkey_delete`]: super::ClientSessionExt::session_sshkey_delete + ///[`Client::session_sshkey_delete`]: super::Client::session_sshkey_delete #[derive(Debug, Clone)] pub struct SessionSshkeyDelete<'a> { client: &'a super::Client, @@ -39472,43 +45729,36 @@ pub mod builder { ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, ssh_key_name, } = self; let ssh_key_name = ssh_key_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/session/me/sshkeys/{}", - client.baseurl, - encode_path(&ssh_key_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/session/me/sshkeys/{}", + client.baseurl, + encode_path(&ssh_key_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SessionSshkeyDelete { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_image_view_by_id`] + ///Builder for [`Client::system_image_view_by_id`] /// - ///[`ClientSystemExt::system_image_view_by_id`]: super::ClientSystemExt::system_image_view_by_id + ///[`Client::system_image_view_by_id`]: super::Client::system_image_view_by_id #[derive(Debug, Clone)] pub struct SystemImageViewById<'a> { client: &'a super::Client, @@ -39535,40 +45785,33 @@ pub mod builder { ///Sends a `GET` request to `/system/by-id/images/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/by-id/images/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/by-id/images/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemImageViewById { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_view_by_id`] + ///Builder for [`Client::ip_pool_view_by_id`] /// - ///[`ClientSystemExt::ip_pool_view_by_id`]: super::ClientSystemExt::ip_pool_view_by_id + ///[`Client::ip_pool_view_by_id`]: super::Client::ip_pool_view_by_id #[derive(Debug, Clone)] pub struct IpPoolViewById<'a> { client: &'a super::Client, @@ -39595,40 +45838,33 @@ pub mod builder { ///Sends a `GET` request to `/system/by-id/ip-pools/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/by-id/ip-pools/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/by-id/ip-pools/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolViewById { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_view_by_id`] + ///Builder for [`Client::silo_view_by_id`] /// - ///[`ClientSystemExt::silo_view_by_id`]: super::ClientSystemExt::silo_view_by_id + ///[`Client::silo_view_by_id`]: super::Client::silo_view_by_id #[derive(Debug, Clone)] pub struct SiloViewById<'a> { client: &'a super::Client, @@ -39655,40 +45891,33 @@ pub mod builder { ///Sends a `GET` request to `/system/by-id/silos/{id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/by-id/silos/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/by-id/silos/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloViewById { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::certificate_list`] + ///Builder for [`Client::certificate_list`] /// - ///[`ClientSystemExt::certificate_list`]: super::ClientSystemExt::certificate_list + ///[`Client::certificate_list`]: super::Client::certificate_list #[derive(Debug, Clone)] pub struct CertificateList<'a> { client: &'a super::Client, @@ -39743,6 +45972,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -39752,39 +45985,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/certificates", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/certificates", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::CertificateList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/certificates` @@ -39844,9 +46069,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::certificate_create`] + ///Builder for [`Client::certificate_create`] /// - ///[`ClientSystemExt::certificate_create`]: super::ClientSystemExt::certificate_create + ///[`Client::certificate_create`]: super::Client::certificate_create #[derive(Debug, Clone)] pub struct CertificateCreate<'a> { client: &'a super::Client, @@ -39885,39 +46110,35 @@ pub mod builder { ///Sends a `POST` request to `/system/certificates` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; - let body = body - .and_then(|v| types::CertificateCreate::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/certificates", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let body = body + .and_then(|v| types::CertificateCreate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let request = { + let url = format!("{}/system/certificates", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::CertificateCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::certificate_view`] + ///Builder for [`Client::certificate_view`] /// - ///[`ClientSystemExt::certificate_view`]: super::ClientSystemExt::certificate_view + ///[`Client::certificate_view`]: super::Client::certificate_view #[derive(Debug, Clone)] pub struct CertificateView<'a> { client: &'a super::Client, @@ -39944,43 +46165,36 @@ pub mod builder { ///Sends a `GET` request to `/system/certificates/{certificate}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, certificate, } = self; let certificate = certificate.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/certificates/{}", - client.baseurl, - encode_path(&certificate.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/certificates/{}", + client.baseurl, + encode_path(&certificate.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::CertificateView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::certificate_delete`] + ///Builder for [`Client::certificate_delete`] /// - ///[`ClientSystemExt::certificate_delete`]: super::ClientSystemExt::certificate_delete + ///[`Client::certificate_delete`]: super::Client::certificate_delete #[derive(Debug, Clone)] pub struct CertificateDelete<'a> { client: &'a super::Client, @@ -40007,43 +46221,36 @@ pub mod builder { ///Sends a `DELETE` request to `/system/certificates/{certificate}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, certificate, } = self; let certificate = certificate.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/certificates/{}", - client.baseurl, - encode_path(&certificate.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/certificates/{}", + client.baseurl, + encode_path(&certificate.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::CertificateDelete { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::physical_disk_list`] + ///Builder for [`Client::physical_disk_list`] /// - ///[`ClientSystemExt::physical_disk_list`]: super::ClientSystemExt::physical_disk_list + ///[`Client::physical_disk_list`]: super::Client::physical_disk_list #[derive(Debug, Clone)] pub struct PhysicalDiskList<'a> { client: &'a super::Client, @@ -40098,6 +46305,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40107,39 +46318,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/hardware/disks", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/hardware/disks", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::PhysicalDiskList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/disks` @@ -40199,9 +46402,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::rack_list`] + ///Builder for [`Client::rack_list`] /// - ///[`ClientSystemExt::rack_list`]: super::ClientSystemExt::rack_list + ///[`Client::rack_list`]: super::Client::rack_list #[derive(Debug, Clone)] pub struct RackList<'a> { client: &'a super::Client, @@ -40256,6 +46459,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40265,39 +46472,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/hardware/racks", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/hardware/racks", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::RackList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/racks` @@ -40357,9 +46556,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::rack_view`] + ///Builder for [`Client::rack_view`] /// - ///[`ClientSystemExt::rack_view`]: super::ClientSystemExt::rack_view + ///[`Client::rack_view`]: super::Client::rack_view #[derive(Debug, Clone)] pub struct RackView<'a> { client: &'a super::Client, @@ -40386,40 +46585,33 @@ pub mod builder { ///Sends a `GET` request to `/system/hardware/racks/{rack_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, rack_id } = self; let rack_id = rack_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/hardware/racks/{}", - client.baseurl, - encode_path(&rack_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/hardware/racks/{}", + client.baseurl, + encode_path(&rack_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::RackView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::sled_list`] + ///Builder for [`Client::sled_list`] /// - ///[`ClientSystemExt::sled_list`]: super::ClientSystemExt::sled_list + ///[`Client::sled_list`]: super::Client::sled_list #[derive(Debug, Clone)] pub struct SledList<'a> { client: &'a super::Client, @@ -40474,6 +46666,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40483,39 +46679,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/hardware/sleds", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/hardware/sleds", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SledList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/sleds` @@ -40575,9 +46763,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::sled_view`] + ///Builder for [`Client::sled_view`] /// - ///[`ClientSystemExt::sled_view`]: super::ClientSystemExt::sled_view + ///[`Client::sled_view`]: super::Client::sled_view #[derive(Debug, Clone)] pub struct SledView<'a> { client: &'a super::Client, @@ -40604,40 +46792,33 @@ pub mod builder { ///Sends a `GET` request to `/system/hardware/sleds/{sled_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, sled_id } = self; let sled_id = sled_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/hardware/sleds/{}", - client.baseurl, - encode_path(&sled_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/hardware/sleds/{}", + client.baseurl, + encode_path(&sled_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SledView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::sled_physical_disk_list`] + ///Builder for [`Client::sled_physical_disk_list`] /// - ///[`ClientSystemExt::sled_physical_disk_list`]: super::ClientSystemExt::sled_physical_disk_list + ///[`Client::sled_physical_disk_list`]: super::Client::sled_physical_disk_list #[derive(Debug, Clone)] pub struct SledPhysicalDiskList<'a> { client: &'a super::Client, @@ -40704,6 +46885,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, sled_id, @@ -40715,43 +46900,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/hardware/sleds/{}/disks", - client.baseurl, - encode_path(&sled_id.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/hardware/sleds/{}/disks", + client.baseurl, + encode_path(&sled_id.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SledPhysicalDiskList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/hardware/sleds/{sled_id}/disks` @@ -40811,9 +46988,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::system_image_list`] + ///Builder for [`Client::system_image_list`] /// - ///[`ClientSystemExt::system_image_list`]: super::ClientSystemExt::system_image_list + ///[`Client::system_image_list`]: super::Client::system_image_list #[derive(Debug, Clone)] pub struct SystemImageList<'a> { client: &'a super::Client, @@ -40868,6 +47045,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -40877,39 +47058,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/images", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/images", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemImageList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/images` @@ -40969,9 +47142,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::system_image_create`] + ///Builder for [`Client::system_image_create`] /// - ///[`ClientSystemExt::system_image_create`]: super::ClientSystemExt::system_image_create + ///[`Client::system_image_create`]: super::Client::system_image_create #[derive(Debug, Clone)] pub struct SystemImageCreate<'a> { client: &'a super::Client, @@ -41010,39 +47183,35 @@ pub mod builder { ///Sends a `POST` request to `/system/images` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::GlobalImageCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/images", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/images", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SystemImageCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_image_view`] + ///Builder for [`Client::system_image_view`] /// - ///[`ClientSystemExt::system_image_view`]: super::ClientSystemExt::system_image_view + ///[`Client::system_image_view`]: super::Client::system_image_view #[derive(Debug, Clone)] pub struct SystemImageView<'a> { client: &'a super::Client, @@ -41069,40 +47238,33 @@ pub mod builder { ///Sends a `GET` request to `/system/images/{image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, image_name } = self; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/images/{}", - client.baseurl, - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/images/{}", + client.baseurl, + encode_path(&image_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemImageView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_image_delete`] + ///Builder for [`Client::system_image_delete`] /// - ///[`ClientSystemExt::system_image_delete`]: super::ClientSystemExt::system_image_delete + ///[`Client::system_image_delete`]: super::Client::system_image_delete #[derive(Debug, Clone)] pub struct SystemImageDelete<'a> { client: &'a super::Client, @@ -41129,40 +47291,33 @@ pub mod builder { ///Sends a `DELETE` request to `/system/images/{image_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, image_name } = self; let image_name = image_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/images/{}", - client.baseurl, - encode_path(&image_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/images/{}", + client.baseurl, + encode_path(&image_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemImageDelete { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_list`] + ///Builder for [`Client::ip_pool_list`] /// - ///[`ClientSystemExt::ip_pool_list`]: super::ClientSystemExt::ip_pool_list + ///[`Client::ip_pool_list`]: super::Client::ip_pool_list #[derive(Debug, Clone)] pub struct IpPoolList<'a> { client: &'a super::Client, @@ -41217,6 +47372,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -41226,39 +47385,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::IpPoolList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/ip-pools` @@ -41318,9 +47469,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::ip_pool_create`] + ///Builder for [`Client::ip_pool_create`] /// - ///[`ClientSystemExt::ip_pool_create`]: super::ClientSystemExt::ip_pool_create + ///[`Client::ip_pool_create`]: super::Client::ip_pool_create #[derive(Debug, Clone)] pub struct IpPoolCreate<'a> { client: &'a super::Client, @@ -41357,39 +47508,35 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::IpPoolCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_view`] + ///Builder for [`Client::ip_pool_view`] /// - ///[`ClientSystemExt::ip_pool_view`]: super::ClientSystemExt::ip_pool_view + ///[`Client::ip_pool_view`]: super::Client::ip_pool_view #[derive(Debug, Clone)] pub struct IpPoolView<'a> { client: &'a super::Client, @@ -41416,40 +47563,33 @@ pub mod builder { ///Sends a `GET` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_update`] + ///Builder for [`Client::ip_pool_update`] /// - ///[`ClientSystemExt::ip_pool_update`]: super::ClientSystemExt::ip_pool_update + ///[`Client::ip_pool_update`]: super::Client::ip_pool_update #[derive(Debug, Clone)] pub struct IpPoolUpdate<'a> { client: &'a super::Client, @@ -41498,6 +47638,10 @@ pub mod builder { ///Sends a `PUT` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41507,39 +47651,31 @@ pub mod builder { let body = body .and_then(|v| types::IpPoolUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_delete`] + ///Builder for [`Client::ip_pool_delete`] /// - ///[`ClientSystemExt::ip_pool_delete`]: super::ClientSystemExt::ip_pool_delete + ///[`Client::ip_pool_delete`]: super::Client::ip_pool_delete #[derive(Debug, Clone)] pub struct IpPoolDelete<'a> { client: &'a super::Client, @@ -41566,40 +47702,33 @@ pub mod builder { ///Sends a `DELETE` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolDelete { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_range_list`] + ///Builder for [`Client::ip_pool_range_list`] /// - ///[`ClientSystemExt::ip_pool_range_list`]: super::ClientSystemExt::ip_pool_range_list + ///[`Client::ip_pool_range_list`]: super::Client::ip_pool_range_list #[derive(Debug, Clone)] pub struct IpPoolRangeList<'a> { client: &'a super::Client, @@ -41653,6 +47782,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41662,40 +47795,32 @@ pub mod builder { let pool_name = pool_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}/ranges", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}/ranges", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::IpPoolRangeList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/ip-pools/{pool_name}/ranges` @@ -41754,9 +47879,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::ip_pool_range_add`] + ///Builder for [`Client::ip_pool_range_add`] /// - ///[`ClientSystemExt::ip_pool_range_add`]: super::ClientSystemExt::ip_pool_range_add + ///[`Client::ip_pool_range_add`]: super::Client::ip_pool_range_add #[derive(Debug, Clone)] pub struct IpPoolRangeAdd<'a> { client: &'a super::Client, @@ -41795,6 +47920,10 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools/{pool_name}/ranges/add` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41802,39 +47931,31 @@ pub mod builder { } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}/ranges/add", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}/ranges/add", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolRangeAdd { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_range_remove`] + ///Builder for [`Client::ip_pool_range_remove`] /// - ///[`ClientSystemExt::ip_pool_range_remove`]: super::ClientSystemExt::ip_pool_range_remove + ///[`Client::ip_pool_range_remove`]: super::Client::ip_pool_range_remove #[derive(Debug, Clone)] pub struct IpPoolRangeRemove<'a> { client: &'a super::Client, @@ -41874,6 +47995,10 @@ pub mod builder { ///Sends a `POST` request to /// `/system/ip-pools/{pool_name}/ranges/remove` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, pool_name, @@ -41881,39 +48006,31 @@ pub mod builder { } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/ip-pools/{}/ranges/remove", - client.baseurl, - encode_path(&pool_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/ip-pools/{}/ranges/remove", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolRangeRemove { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_service_view`] + ///Builder for [`Client::ip_pool_service_view`] /// - ///[`ClientSystemExt::ip_pool_service_view`]: super::ClientSystemExt::ip_pool_service_view + ///[`Client::ip_pool_service_view`]: super::Client::ip_pool_service_view #[derive(Debug, Clone)] pub struct IpPoolServiceView<'a> { client: &'a super::Client, @@ -41926,35 +48043,28 @@ pub mod builder { ///Sends a `GET` request to `/system/ip-pools-service` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/system/ip-pools-service", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/system/ip-pools-service", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::IpPoolServiceView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_service_range_list`] + ///Builder for [`Client::ip_pool_service_range_list`] /// - ///[`ClientSystemExt::ip_pool_service_range_list`]: super::ClientSystemExt::ip_pool_service_range_list + ///[`Client::ip_pool_service_range_list`]: super::Client::ip_pool_service_range_list #[derive(Debug, Clone)] pub struct IpPoolServiceRangeList<'a> { client: &'a super::Client, @@ -41996,6 +48106,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -42003,36 +48117,28 @@ pub mod builder { } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools-service/ranges", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools-service/ranges", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::IpPoolServiceRangeList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/ip-pools-service/ranges` @@ -42091,9 +48197,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::ip_pool_service_range_add`] + ///Builder for [`Client::ip_pool_service_range_add`] /// - ///[`ClientSystemExt::ip_pool_service_range_add`]: super::ClientSystemExt::ip_pool_service_range_add + ///[`Client::ip_pool_service_range_add`]: super::Client::ip_pool_service_range_add #[derive(Debug, Clone)] pub struct IpPoolServiceRangeAdd<'a> { client: &'a super::Client, @@ -42120,37 +48226,33 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools-service/ranges/add` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools-service/ranges/add", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools-service/ranges/add", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolServiceRangeAdd { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::ip_pool_service_range_remove`] + ///Builder for [`Client::ip_pool_service_range_remove`] /// - ///[`ClientSystemExt::ip_pool_service_range_remove`]: super::ClientSystemExt::ip_pool_service_range_remove + ///[`Client::ip_pool_service_range_remove`]: super::Client::ip_pool_service_range_remove #[derive(Debug, Clone)] pub struct IpPoolServiceRangeRemove<'a> { client: &'a super::Client, @@ -42177,37 +48279,33 @@ pub mod builder { ///Sends a `POST` request to `/system/ip-pools-service/ranges/remove` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/ip-pools-service/ranges/remove", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/ip-pools-service/ranges/remove", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::IpPoolServiceRangeRemove { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_metric`] + ///Builder for [`Client::system_metric`] /// - ///[`ClientSystemExt::system_metric`]: super::ClientSystemExt::system_metric + ///[`Client::system_metric`]: super::Client::system_metric #[derive(Debug, Clone)] pub struct SystemMetric<'a> { client: &'a super::Client, @@ -42300,6 +48398,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, metric_name, @@ -42315,53 +48417,45 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let start_time = start_time.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/metrics/{}", - client.baseurl, - encode_path(&metric_name.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &end_time { - query.push(("end_time", v.to_string())); - } - query.push(("id", id.to_string())); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &start_time { - query.push(("start_time", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/metrics/{}", + client.baseurl, + encode_path(&metric_name.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &end_time { + query.push(("end_time", v.to_string())); + } + query.push(("id", id.to_string())); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &start_time { + query.push(("start_time", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemMetric { + client: client, + request, + }) } } - ///Builder for [`ClientPolicyExt::system_policy_view`] + ///Builder for [`Client::system_policy_view`] /// - ///[`ClientPolicyExt::system_policy_view`]: super::ClientPolicyExt::system_policy_view + ///[`Client::system_policy_view`]: super::Client::system_policy_view #[derive(Debug, Clone)] pub struct SystemPolicyView<'a> { client: &'a super::Client, @@ -42376,35 +48470,28 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/system/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/system/policy", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemPolicyView { + client: client, + request, + }) } } - ///Builder for [`ClientPolicyExt::system_policy_update`] + ///Builder for [`Client::system_policy_update`] /// - ///[`ClientPolicyExt::system_policy_update`]: super::ClientPolicyExt::system_policy_update + ///[`Client::system_policy_update`]: super::Client::system_policy_update #[derive(Debug, Clone)] pub struct SystemPolicyUpdate<'a> { client: &'a super::Client, @@ -42443,39 +48530,35 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::FleetRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/policy", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/policy", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SystemPolicyUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::saga_list`] + ///Builder for [`Client::saga_list`] /// - ///[`ClientSystemExt::saga_list`]: super::ClientSystemExt::saga_list + ///[`Client::saga_list`]: super::Client::saga_list #[derive(Debug, Clone)] pub struct SagaList<'a> { client: &'a super::Client, @@ -42530,6 +48613,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -42539,39 +48626,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/sagas", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/sagas", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SagaList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/sagas` @@ -42631,9 +48710,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::saga_view`] + ///Builder for [`Client::saga_view`] /// - ///[`ClientSystemExt::saga_view`]: super::ClientSystemExt::saga_view + ///[`Client::saga_view`]: super::Client::saga_view #[derive(Debug, Clone)] pub struct SagaView<'a> { client: &'a super::Client, @@ -42660,40 +48739,33 @@ pub mod builder { ///Sends a `GET` request to `/system/sagas/{saga_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, saga_id } = self; let saga_id = saga_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/sagas/{}", - client.baseurl, - encode_path(&saga_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/sagas/{}", + client.baseurl, + encode_path(&saga_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SagaView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_list`] + ///Builder for [`Client::silo_list`] /// - ///[`ClientSystemExt::silo_list`]: super::ClientSystemExt::silo_list + ///[`Client::silo_list`]: super::Client::silo_list #[derive(Debug, Clone)] pub struct SiloList<'a> { client: &'a super::Client, @@ -42748,6 +48820,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -42757,39 +48833,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/silos", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/silos", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SiloList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/silos` @@ -42849,9 +48917,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::silo_create`] + ///Builder for [`Client::silo_create`] /// - ///[`ClientSystemExt::silo_create`]: super::ClientSystemExt::silo_create + ///[`Client::silo_create`]: super::Client::silo_create #[derive(Debug, Clone)] pub struct SiloCreate<'a> { client: &'a super::Client, @@ -42888,39 +48956,35 @@ pub mod builder { ///Sends a `POST` request to `/system/silos` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SiloCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/system/silos", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/silos", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SiloCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_view`] + ///Builder for [`Client::silo_view`] /// - ///[`ClientSystemExt::silo_view`]: super::ClientSystemExt::silo_view + ///[`Client::silo_view`]: super::Client::silo_view #[derive(Debug, Clone)] pub struct SiloView<'a> { client: &'a super::Client, @@ -42947,40 +49011,33 @@ pub mod builder { ///Sends a `GET` request to `/system/silos/{silo_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_delete`] + ///Builder for [`Client::silo_delete`] /// - ///[`ClientSystemExt::silo_delete`]: super::ClientSystemExt::silo_delete + ///[`Client::silo_delete`]: super::Client::silo_delete #[derive(Debug, Clone)] pub struct SiloDelete<'a> { client: &'a super::Client, @@ -43007,40 +49064,33 @@ pub mod builder { ///Sends a `DELETE` request to `/system/silos/{silo_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloDelete { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_identity_provider_list`] + ///Builder for [`Client::silo_identity_provider_list`] /// - ///[`ClientSystemExt::silo_identity_provider_list`]: super::ClientSystemExt::silo_identity_provider_list + ///[`Client::silo_identity_provider_list`]: super::Client::silo_identity_provider_list #[derive(Debug, Clone)] pub struct SiloIdentityProviderList<'a> { client: &'a super::Client, @@ -43109,6 +49159,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43120,43 +49174,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SiloIdentityProviderList { + client: client, + request, + }) } ///Streams `GET` requests to @@ -43217,9 +49263,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::local_idp_user_create`] + ///Builder for [`Client::local_idp_user_create`] /// - ///[`ClientSystemExt::local_idp_user_create`]: super::ClientSystemExt::local_idp_user_create + ///[`Client::local_idp_user_create`]: super::Client::local_idp_user_create #[derive(Debug, Clone)] pub struct LocalIdpUserCreate<'a> { client: &'a super::Client, @@ -43269,6 +49315,10 @@ pub mod builder { ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/local/users` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43278,39 +49328,31 @@ pub mod builder { let body = body .and_then(|v| types::UserCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/local/users", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::LocalIdpUserCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::local_idp_user_delete`] + ///Builder for [`Client::local_idp_user_delete`] /// - ///[`ClientSystemExt::local_idp_user_delete`]: super::ClientSystemExt::local_idp_user_delete + ///[`Client::local_idp_user_delete`]: super::Client::local_idp_user_delete #[derive(Debug, Clone)] pub struct LocalIdpUserDelete<'a> { client: &'a super::Client, @@ -43350,6 +49392,10 @@ pub mod builder { ///Sends a `DELETE` request to /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43357,39 +49403,28 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/local/users/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::LocalIdpUserDelete { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::local_idp_user_set_password`] + ///Builder for [`Client::local_idp_user_set_password`] /// - ///[`ClientSystemExt::local_idp_user_set_password`]: super::ClientSystemExt::local_idp_user_set_password + ///[`Client::local_idp_user_set_password`]: super::Client::local_idp_user_set_password #[derive(Debug, Clone)] pub struct LocalIdpUserSetPassword<'a> { client: &'a super::Client, @@ -43442,6 +49477,10 @@ pub mod builder { /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}/ /// set-password` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43451,40 +49490,32 @@ pub mod builder { let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/local/users/{}/set-password", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users/{}/set-password", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::LocalIdpUserSetPassword { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::saml_identity_provider_create`] + ///Builder for [`Client::saml_identity_provider_create`] /// - ///[`ClientSystemExt::saml_identity_provider_create`]: super::ClientSystemExt::saml_identity_provider_create + ///[`Client::saml_identity_provider_create`]: super::Client::saml_identity_provider_create #[derive(Debug, Clone)] pub struct SamlIdentityProviderCreate<'a> { client: &'a super::Client, @@ -43541,6 +49572,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43552,39 +49587,31 @@ pub mod builder { types::SamlIdentityProviderCreate::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/saml", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/saml", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SamlIdentityProviderCreate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::saml_identity_provider_view`] + ///Builder for [`Client::saml_identity_provider_view`] /// - ///[`ClientSystemExt::saml_identity_provider_view`]: super::ClientSystemExt::saml_identity_provider_view + ///[`Client::saml_identity_provider_view`]: super::Client::saml_identity_provider_view #[derive(Debug, Clone)] pub struct SamlIdentityProviderView<'a> { client: &'a super::Client, @@ -43626,6 +49653,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43633,39 +49664,28 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/identity-providers/saml/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/identity-providers/saml/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SamlIdentityProviderView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_policy_view`] + ///Builder for [`Client::silo_policy_view`] /// - ///[`ClientSystemExt::silo_policy_view`]: super::ClientSystemExt::silo_policy_view + ///[`Client::silo_policy_view`]: super::Client::silo_policy_view #[derive(Debug, Clone)] pub struct SiloPolicyView<'a> { client: &'a super::Client, @@ -43694,40 +49714,33 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/policy", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/policy", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloPolicyView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_policy_update`] + ///Builder for [`Client::silo_policy_update`] /// - ///[`ClientSystemExt::silo_policy_update`]: super::ClientSystemExt::silo_policy_update + ///[`Client::silo_policy_update`]: super::Client::silo_policy_update #[derive(Debug, Clone)] pub struct SiloPolicyUpdate<'a> { client: &'a super::Client, @@ -43778,6 +49791,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43787,39 +49804,31 @@ pub mod builder { let body = body .and_then(|v| types::SiloRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/policy", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/policy", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SiloPolicyUpdate { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::silo_users_list`] + ///Builder for [`Client::silo_users_list`] /// - ///[`ClientSystemExt::silo_users_list`]: super::ClientSystemExt::silo_users_list + ///[`Client::silo_users_list`]: super::Client::silo_users_list #[derive(Debug, Clone)] pub struct SiloUsersList<'a> { client: &'a super::Client, @@ -43886,6 +49895,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -43897,43 +49910,35 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/users/all", - client.baseurl, - encode_path(&silo_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/system/silos/{}/users/all", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SiloUsersList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/silos/{silo_name}/users/all` @@ -43993,9 +49998,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::silo_user_view`] + ///Builder for [`Client::silo_user_view`] /// - ///[`ClientSystemExt::silo_user_view`]: super::ClientSystemExt::silo_user_view + ///[`Client::silo_user_view`]: super::Client::silo_user_view #[derive(Debug, Clone)] pub struct SiloUserView<'a> { client: &'a super::Client, @@ -44035,6 +50040,10 @@ pub mod builder { ///Sends a `GET` request to /// `/system/silos/{silo_name}/users/id/{user_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, silo_name, @@ -44042,39 +50051,28 @@ pub mod builder { } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/silos/{}/users/id/{}", - client.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/silos/{}/users/id/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SiloUserView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_user_list`] + ///Builder for [`Client::system_user_list`] /// - ///[`ClientSystemExt::system_user_list`]: super::ClientSystemExt::system_user_list + ///[`Client::system_user_list`]: super::Client::system_user_list #[derive(Debug, Clone)] pub struct SystemUserList<'a> { client: &'a super::Client, @@ -44129,6 +50127,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44138,39 +50140,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/system/user", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/system/user", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemUserList { + client: client, + request, + }) } ///Streams `GET` requests to `/system/user` @@ -44230,9 +50224,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::system_user_view`] + ///Builder for [`Client::system_user_view`] /// - ///[`ClientSystemExt::system_user_view`]: super::ClientSystemExt::system_user_view + ///[`Client::system_user_view`]: super::Client::system_user_view #[derive(Debug, Clone)] pub struct SystemUserView<'a> { client: &'a super::Client, @@ -44259,40 +50253,33 @@ pub mod builder { ///Sends a `GET` request to `/system/user/{user_name}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, user_name } = self; let user_name = user_name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/system/user/{}", - client.baseurl, - encode_path(&user_name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/system/user/{}", + client.baseurl, + encode_path(&user_name.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUserView { + client: client, + request, + }) } } - ///Builder for [`ClientMetricsExt::timeseries_schema_get`] + ///Builder for [`Client::timeseries_schema_get`] /// - ///[`ClientMetricsExt::timeseries_schema_get`]: super::ClientMetricsExt::timeseries_schema_get + ///[`Client::timeseries_schema_get`]: super::Client::timeseries_schema_get #[derive(Debug, Clone)] pub struct TimeseriesSchemaGet<'a> { client: &'a super::Client, @@ -44335,6 +50322,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44342,36 +50333,28 @@ pub mod builder { } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let url = format!("{}/timeseries/schema", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/timeseries/schema", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::TimeseriesSchemaGet { + client: client, + request, + }) } ///Streams `GET` requests to `/timeseries/schema` @@ -44430,9 +50413,9 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::user_list`] + ///Builder for [`Client::user_list`] /// - ///[`ClientSilosExt::user_list`]: super::ClientSilosExt::user_list + ///[`Client::user_list`]: super::Client::user_list #[derive(Debug, Clone)] pub struct UserList<'a> { client: &'a super::Client, @@ -44487,6 +50470,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44496,39 +50483,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/users", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/users", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::UserList { + client: client, + request, + }) } ///Streams `GET` requests to `/users` @@ -44588,9 +50567,9 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::disk_list_v1`] + ///Builder for [`Client::disk_list_v1`] /// - ///[`ClientDisksExt::disk_list_v1`]: super::ClientDisksExt::disk_list_v1 + ///[`Client::disk_list_v1`]: super::Client::disk_list_v1 #[derive(Debug, Clone)] pub struct DiskListV1<'a> { client: &'a super::Client, @@ -44671,6 +50650,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -44684,45 +50667,37 @@ pub mod builder { let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/disks", client.baseurl,); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/disks", client.baseurl,); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/disks` @@ -44784,9 +50759,9 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::disk_create_v1`] + ///Builder for [`Client::disk_create_v1`] /// - ///[`ClientDisksExt::disk_create_v1`]: super::ClientDisksExt::disk_create_v1 + ///[`Client::disk_create_v1`]: super::Client::disk_create_v1 #[derive(Debug, Clone)] pub struct DiskCreateV1<'a> { client: &'a super::Client, @@ -44848,6 +50823,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/disks` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -44859,41 +50838,33 @@ pub mod builder { let body = body .and_then(|v| types::DiskCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/disks", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - query.push(("project", project.to_string())); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/disks", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + query.push(("project", project.to_string())); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::DiskCreateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientDisksExt::disk_view_v1`] + ///Builder for [`Client::disk_view_v1`] /// - ///[`ClientDisksExt::disk_view_v1`]: super::ClientDisksExt::disk_view_v1 + ///[`Client::disk_view_v1`]: super::Client::disk_view_v1 #[derive(Debug, Clone)] pub struct DiskViewV1<'a> { client: &'a super::Client, @@ -44946,6 +50917,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/disks/{disk}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, disk, @@ -44955,46 +50930,38 @@ pub mod builder { let disk = disk.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/disks/{}", - client.baseurl, - encode_path(&disk.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/disks/{}", + client.baseurl, + encode_path(&disk.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskViewV1 { + client: client, + request, + }) } } - ///Builder for [`ClientDisksExt::disk_delete_v1`] + ///Builder for [`Client::disk_delete_v1`] /// - ///[`ClientDisksExt::disk_delete_v1`]: super::ClientDisksExt::disk_delete_v1 + ///[`Client::disk_delete_v1`]: super::Client::disk_delete_v1 #[derive(Debug, Clone)] pub struct DiskDeleteV1<'a> { client: &'a super::Client, @@ -45047,6 +51014,10 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/disks/{disk}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, disk, @@ -45056,46 +51027,38 @@ pub mod builder { let disk = disk.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/disks/{}", - client.baseurl, - encode_path(&disk.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/disks/{}", + client.baseurl, + encode_path(&disk.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::DiskDeleteV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_list_v1`] + ///Builder for [`Client::instance_list_v1`] /// - ///[`ClientInstancesExt::instance_list_v1`]: super::ClientInstancesExt::instance_list_v1 + ///[`Client::instance_list_v1`]: super::Client::instance_list_v1 #[derive(Debug, Clone)] pub struct InstanceListV1<'a> { client: &'a super::Client, @@ -45176,6 +51139,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -45189,45 +51156,37 @@ pub mod builder { let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/instances", client.baseurl,); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/instances", client.baseurl,); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/instances` @@ -45289,9 +51248,9 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_create_v1`] + ///Builder for [`Client::instance_create_v1`] /// - ///[`ClientInstancesExt::instance_create_v1`]: super::ClientInstancesExt::instance_create_v1 + ///[`Client::instance_create_v1`]: super::Client::instance_create_v1 #[derive(Debug, Clone)] pub struct InstanceCreateV1<'a> { client: &'a super::Client, @@ -45353,6 +51312,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -45364,41 +51327,33 @@ pub mod builder { let body = body .and_then(|v| types::InstanceCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/instances", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - query.push(("project", project.to_string())); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/instances", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + query.push(("project", project.to_string())); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceCreateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_view_v1`] + ///Builder for [`Client::instance_view_v1`] /// - ///[`ClientInstancesExt::instance_view_v1`]: super::ClientInstancesExt::instance_view_v1 + ///[`Client::instance_view_v1`]: super::Client::instance_view_v1 #[derive(Debug, Clone)] pub struct InstanceViewV1<'a> { client: &'a super::Client, @@ -45451,6 +51406,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/instances/{instance}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45460,46 +51419,38 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceViewV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_delete_v1`] + ///Builder for [`Client::instance_delete_v1`] /// - ///[`ClientInstancesExt::instance_delete_v1`]: super::ClientInstancesExt::instance_delete_v1 + ///[`Client::instance_delete_v1`]: super::Client::instance_delete_v1 #[derive(Debug, Clone)] pub struct InstanceDeleteV1<'a> { client: &'a super::Client, @@ -45552,6 +51503,10 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/instances/{instance}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45561,46 +51516,38 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceDeleteV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_disk_list_v1`] + ///Builder for [`Client::instance_disk_list_v1`] /// - ///[`ClientInstancesExt::instance_disk_list_v1`]: super::ClientInstancesExt::instance_disk_list_v1 + ///[`Client::instance_disk_list_v1`]: super::Client::instance_disk_list_v1 #[derive(Debug, Clone)] pub struct InstanceDiskListV1<'a> { client: &'a super::Client, @@ -45693,6 +51640,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45708,49 +51659,41 @@ pub mod builder { let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/disks", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/disks", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceDiskListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/instances/{instance}/disks` @@ -45812,9 +51755,9 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_disk_attach_v1`] + ///Builder for [`Client::instance_disk_attach_v1`] /// - ///[`ClientInstancesExt::instance_disk_attach_v1`]: super::ClientInstancesExt::instance_disk_attach_v1 + ///[`Client::instance_disk_attach_v1`]: super::Client::instance_disk_attach_v1 #[derive(Debug, Clone)] pub struct InstanceDiskAttachV1<'a> { client: &'a super::Client, @@ -45889,6 +51832,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/disks/attach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -45902,47 +51849,39 @@ pub mod builder { let body = body .and_then(|v| types::DiskPath::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/disks/attach", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/disks/attach", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceDiskAttachV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_disk_detach_v1`] + ///Builder for [`Client::instance_disk_detach_v1`] /// - ///[`ClientInstancesExt::instance_disk_detach_v1`]: super::ClientInstancesExt::instance_disk_detach_v1 + ///[`Client::instance_disk_detach_v1`]: super::Client::instance_disk_detach_v1 #[derive(Debug, Clone)] pub struct InstanceDiskDetachV1<'a> { client: &'a super::Client, @@ -46017,6 +51956,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/disks/detach` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46030,47 +51973,39 @@ pub mod builder { let body = body .and_then(|v| types::DiskPath::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/disks/detach", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/disks/detach", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceDiskDetachV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_migrate_v1`] + ///Builder for [`Client::instance_migrate_v1`] /// - ///[`ClientInstancesExt::instance_migrate_v1`]: super::ClientInstancesExt::instance_migrate_v1 + ///[`Client::instance_migrate_v1`]: super::Client::instance_migrate_v1 #[derive(Debug, Clone)] pub struct InstanceMigrateV1<'a> { client: &'a super::Client, @@ -46145,6 +52080,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/migrate` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46158,47 +52097,39 @@ pub mod builder { let body = body .and_then(|v| types::InstanceMigrate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/migrate", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/migrate", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::InstanceMigrateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_reboot_v1`] + ///Builder for [`Client::instance_reboot_v1`] /// - ///[`ClientInstancesExt::instance_reboot_v1`]: super::ClientInstancesExt::instance_reboot_v1 + ///[`Client::instance_reboot_v1`]: super::Client::instance_reboot_v1 #[derive(Debug, Clone)] pub struct InstanceRebootV1<'a> { client: &'a super::Client, @@ -46251,6 +52182,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/reboot` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46260,46 +52195,38 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/reboot", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/reboot", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceRebootV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_serial_console_v1`] + ///Builder for [`Client::instance_serial_console_v1`] /// - ///[`ClientInstancesExt::instance_serial_console_v1`]: super::ClientInstancesExt::instance_serial_console_v1 + ///[`Client::instance_serial_console_v1`]: super::Client::instance_serial_console_v1 #[derive(Debug, Clone)] pub struct InstanceSerialConsoleV1<'a> { client: &'a super::Client, @@ -46393,6 +52320,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46408,55 +52339,47 @@ pub mod builder { let most_recent = most_recent.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/serial-console", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &from_start { - query.push(("from_start", v.to_string())); - } - if let Some(v) = &max_bytes { - query.push(("max_bytes", v.to_string())); - } - if let Some(v) = &most_recent { - query.push(("most_recent", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/serial-console", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &from_start { + query.push(("from_start", v.to_string())); + } + if let Some(v) = &max_bytes { + query.push(("max_bytes", v.to_string())); + } + if let Some(v) = &most_recent { + query.push(("most_recent", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceSerialConsoleV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_serial_console_stream_v1`] + ///Builder for [`Client::instance_serial_console_stream_v1`] /// - ///[`ClientInstancesExt::instance_serial_console_stream_v1`]: super::ClientInstancesExt::instance_serial_console_stream_v1 + ///[`Client::instance_serial_console_stream_v1`]: super::Client::instance_serial_console_stream_v1 #[derive(Debug, Clone)] pub struct InstanceSerialConsoleStreamV1<'a> { client: &'a super::Client, @@ -46512,6 +52435,12 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, instance, @@ -46521,47 +52450,44 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/serial-console/stream", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .query(&query) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 101u16 => ResponseValue::upgrade(response).await, - 200..=299 => ResponseValue::upgrade(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/serial-console/stream", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .get(url) + .query(&query) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + }; + Ok(built::InstanceSerialConsoleStreamV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_start_v1`] + ///Builder for [`Client::instance_start_v1`] /// - ///[`ClientInstancesExt::instance_start_v1`]: super::ClientInstancesExt::instance_start_v1 + ///[`Client::instance_start_v1`]: super::Client::instance_start_v1 #[derive(Debug, Clone)] pub struct InstanceStartV1<'a> { client: &'a super::Client, @@ -46614,6 +52540,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/start` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46623,46 +52553,38 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/start", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/start", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceStartV1 { + client: client, + request, + }) } } - ///Builder for [`ClientInstancesExt::instance_stop_v1`] + ///Builder for [`Client::instance_stop_v1`] /// - ///[`ClientInstancesExt::instance_stop_v1`]: super::ClientInstancesExt::instance_stop_v1 + ///[`Client::instance_stop_v1`]: super::Client::instance_stop_v1 #[derive(Debug, Clone)] pub struct InstanceStopV1<'a> { client: &'a super::Client, @@ -46715,6 +52637,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/instances/{instance}/stop` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, instance, @@ -46724,46 +52650,38 @@ pub mod builder { let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/instances/{}/stop", - client.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/instances/{}/stop", + client.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::InstanceStopV1 { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_list_v1`] + ///Builder for [`Client::organization_list_v1`] /// - ///[`ClientOrganizationsExt::organization_list_v1`]: super::ClientOrganizationsExt::organization_list_v1 + ///[`Client::organization_list_v1`]: super::Client::organization_list_v1 #[derive(Debug, Clone)] pub struct OrganizationListV1<'a> { client: &'a super::Client, @@ -46818,6 +52736,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -46827,39 +52749,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/organizations", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/organizations", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::OrganizationListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/organizations` @@ -46919,9 +52833,9 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organization_create_v1`] + ///Builder for [`Client::organization_create_v1`] /// - ///[`ClientOrganizationsExt::organization_create_v1`]: super::ClientOrganizationsExt::organization_create_v1 + ///[`Client::organization_create_v1`]: super::Client::organization_create_v1 #[derive(Debug, Clone)] pub struct OrganizationCreateV1<'a> { client: &'a super::Client, @@ -46960,39 +52874,35 @@ pub mod builder { ///Sends a `POST` request to `/v1/organizations` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::OrganizationCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/organizations", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/organizations", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationCreateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_view_v1`] + ///Builder for [`Client::organization_view_v1`] /// - ///[`ClientOrganizationsExt::organization_view_v1`]: super::ClientOrganizationsExt::organization_view_v1 + ///[`Client::organization_view_v1`]: super::Client::organization_view_v1 #[derive(Debug, Clone)] pub struct OrganizationViewV1<'a> { client: &'a super::Client, @@ -47019,43 +52929,36 @@ pub mod builder { ///Sends a `GET` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/organizations/{}", + client.baseurl, + encode_path(&organization.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationViewV1 { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_update_v1`] + ///Builder for [`Client::organization_update_v1`] /// - ///[`ClientOrganizationsExt::organization_update_v1`]: super::ClientOrganizationsExt::organization_update_v1 + ///[`Client::organization_update_v1`]: super::Client::organization_update_v1 #[derive(Debug, Clone)] pub struct OrganizationUpdateV1<'a> { client: &'a super::Client, @@ -47106,6 +53009,10 @@ pub mod builder { ///Sends a `PUT` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -47115,39 +53022,31 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/organizations/{}", + client.baseurl, + encode_path(&organization.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationUpdateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_delete_v1`] + ///Builder for [`Client::organization_delete_v1`] /// - ///[`ClientOrganizationsExt::organization_delete_v1`]: super::ClientOrganizationsExt::organization_delete_v1 + ///[`Client::organization_delete_v1`]: super::Client::organization_delete_v1 #[derive(Debug, Clone)] pub struct OrganizationDeleteV1<'a> { client: &'a super::Client, @@ -47174,43 +53073,36 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( + let request = { + let url = format!( + "{}/v1/organizations/{}", + client.baseurl, + encode_path(&organization.to_string()), + ); + client.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationDeleteV1 { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_policy_view_v1`] + ///Builder for [`Client::organization_policy_view_v1`] /// - ///[`ClientOrganizationsExt::organization_policy_view_v1`]: super::ClientOrganizationsExt::organization_policy_view_v1 + ///[`Client::organization_policy_view_v1`]: super::Client::organization_policy_view_v1 #[derive(Debug, Clone)] pub struct OrganizationPolicyViewV1<'a> { client: &'a super::Client, @@ -47239,43 +53131,36 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}/policy", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/organizations/{}/policy", + client.baseurl, + encode_path(&organization.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::OrganizationPolicyViewV1 { + client: client, + request, + }) } } - ///Builder for [`ClientOrganizationsExt::organization_policy_update_v1`] + ///Builder for [`Client::organization_policy_update_v1`] /// - ///[`ClientOrganizationsExt::organization_policy_update_v1`]: super::ClientOrganizationsExt::organization_policy_update_v1 + ///[`Client::organization_policy_update_v1`]: super::Client::organization_policy_update_v1 #[derive(Debug, Clone)] pub struct OrganizationPolicyUpdateV1<'a> { client: &'a super::Client, @@ -47330,6 +53215,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -47339,39 +53228,31 @@ pub mod builder { let body = body .and_then(|v| types::OrganizationRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/organizations/{}/policy", - client.baseurl, - encode_path(&organization.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/organizations/{}/policy", + client.baseurl, + encode_path(&organization.to_string()), + ); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::OrganizationPolicyUpdateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_list_v1`] + ///Builder for [`Client::project_list_v1`] /// - ///[`ClientProjectsExt::project_list_v1`]: super::ClientProjectsExt::project_list_v1 + ///[`Client::project_list_v1`]: super::Client::project_list_v1 #[derive(Debug, Clone)] pub struct ProjectListV1<'a> { client: &'a super::Client, @@ -47439,6 +53320,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -47450,42 +53335,34 @@ pub mod builder { let organization = organization.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/projects", client.baseurl,); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/projects", client.baseurl,); + let mut query = Vec::with_capacity(4usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectListV1 { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/projects` @@ -47546,9 +53423,9 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::project_create_v1`] + ///Builder for [`Client::project_create_v1`] /// - ///[`ClientProjectsExt::project_create_v1`]: super::ClientProjectsExt::project_create_v1 + ///[`Client::project_create_v1`]: super::Client::project_create_v1 #[derive(Debug, Clone)] pub struct ProjectCreateV1<'a> { client: &'a super::Client, @@ -47597,6 +53474,10 @@ pub mod builder { ///Sends a `POST` request to `/v1/projects` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, organization, @@ -47606,38 +53487,30 @@ pub mod builder { let body = body .and_then(|v| types::ProjectCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/projects", client.baseurl,); - let mut query = Vec::with_capacity(1usize); - query.push(("organization", organization.to_string())); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/projects", client.baseurl,); + let mut query = Vec::with_capacity(1usize); + query.push(("organization", organization.to_string())); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::ProjectCreateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_view_v1`] + ///Builder for [`Client::project_view_v1`] /// - ///[`ClientProjectsExt::project_view_v1`]: super::ClientProjectsExt::project_view_v1 + ///[`Client::project_view_v1`]: super::Client::project_view_v1 #[derive(Debug, Clone)] pub struct ProjectViewV1<'a> { client: &'a super::Client, @@ -47677,6 +53550,10 @@ pub mod builder { ///Sends a `GET` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47684,43 +53561,35 @@ pub mod builder { } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectViewV1 { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_update_v1`] + ///Builder for [`Client::project_update_v1`] /// - ///[`ClientProjectsExt::project_update_v1`]: super::ClientProjectsExt::project_update_v1 + ///[`Client::project_update_v1`]: super::Client::project_update_v1 #[derive(Debug, Clone)] pub struct ProjectUpdateV1<'a> { client: &'a super::Client, @@ -47782,6 +53651,10 @@ pub mod builder { ///Sends a `PUT` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47793,44 +53666,36 @@ pub mod builder { let body = body .and_then(|v| types::ProjectUpdate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::ProjectUpdateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_delete_v1`] + ///Builder for [`Client::project_delete_v1`] /// - ///[`ClientProjectsExt::project_delete_v1`]: super::ClientProjectsExt::project_delete_v1 + ///[`Client::project_delete_v1`]: super::Client::project_delete_v1 #[derive(Debug, Clone)] pub struct ProjectDeleteV1<'a> { client: &'a super::Client, @@ -47870,6 +53735,10 @@ pub mod builder { ///Sends a `DELETE` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47877,43 +53746,35 @@ pub mod builder { } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectDeleteV1 { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_policy_view_v1`] + ///Builder for [`Client::project_policy_view_v1`] /// - ///[`ClientProjectsExt::project_policy_view_v1`]: super::ClientProjectsExt::project_policy_view_v1 + ///[`Client::project_policy_view_v1`]: super::Client::project_policy_view_v1 #[derive(Debug, Clone)] pub struct ProjectPolicyViewV1<'a> { client: &'a super::Client, @@ -47955,6 +53816,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -47962,43 +53827,35 @@ pub mod builder { } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}/policy", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}/policy", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::ProjectPolicyViewV1 { + client: client, + request, + }) } } - ///Builder for [`ClientProjectsExt::project_policy_update_v1`] + ///Builder for [`Client::project_policy_update_v1`] /// - ///[`ClientProjectsExt::project_policy_update_v1`]: super::ClientProjectsExt::project_policy_update_v1 + ///[`Client::project_policy_update_v1`]: super::Client::project_policy_update_v1 #[derive(Debug, Clone)] pub struct ProjectPolicyUpdateV1<'a> { client: &'a super::Client, @@ -48064,6 +53921,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, project, @@ -48075,44 +53936,36 @@ pub mod builder { let body = body .and_then(|v| types::ProjectRolePolicy::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/projects/{}/policy", - client.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!( + "{}/v1/projects/{}/policy", + client.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + }; + Ok(built::ProjectPolicyUpdateV1 { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_component_version_list`] + ///Builder for [`Client::system_component_version_list`] /// - ///[`ClientSystemExt::system_component_version_list`]: super::ClientSystemExt::system_component_version_list + ///[`Client::system_component_version_list`]: super::Client::system_component_version_list #[derive(Debug, Clone)] pub struct SystemComponentVersionList<'a> { client: &'a super::Client, @@ -48168,6 +54021,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -48177,39 +54034,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/components", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/components", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemComponentVersionList { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/system/update/components` @@ -48270,9 +54119,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::update_deployments_list`] + ///Builder for [`Client::update_deployments_list`] /// - ///[`ClientSystemExt::update_deployments_list`]: super::ClientSystemExt::update_deployments_list + ///[`Client::update_deployments_list`]: super::Client::update_deployments_list #[derive(Debug, Clone)] pub struct UpdateDeploymentsList<'a> { client: &'a super::Client, @@ -48328,6 +54177,10 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -48337,39 +54190,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/deployments", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/deployments", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::UpdateDeploymentsList { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/system/update/deployments` @@ -48429,9 +54274,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::update_deployment_view`] + ///Builder for [`Client::update_deployment_view`] /// - ///[`ClientSystemExt::update_deployment_view`]: super::ClientSystemExt::update_deployment_view + ///[`Client::update_deployment_view`]: super::Client::update_deployment_view #[derive(Debug, Clone)] pub struct UpdateDeploymentView<'a> { client: &'a super::Client, @@ -48460,40 +54305,33 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/update/deployments/{}", - client.baseurl, - encode_path(&id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/system/update/deployments/{}", + client.baseurl, + encode_path(&id.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::UpdateDeploymentView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_update_refresh`] + ///Builder for [`Client::system_update_refresh`] /// - ///[`ClientSystemExt::system_update_refresh`]: super::ClientSystemExt::system_update_refresh + ///[`Client::system_update_refresh`]: super::Client::system_update_refresh #[derive(Debug, Clone)] pub struct SystemUpdateRefresh<'a> { client: &'a super::Client, @@ -48506,35 +54344,28 @@ pub mod builder { ///Sends a `POST` request to `/v1/system/update/refresh` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/update/refresh", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/v1/system/update/refresh", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateRefresh { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_update_start`] + ///Builder for [`Client::system_update_start`] /// - ///[`ClientSystemExt::system_update_start`]: super::ClientSystemExt::system_update_start + ///[`Client::system_update_start`]: super::Client::system_update_start #[derive(Debug, Clone)] pub struct SystemUpdateStart<'a> { client: &'a super::Client, @@ -48575,39 +54406,35 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::SystemUpdateStart::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/start", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 202u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/start", client.baseurl,); + client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::SystemUpdateStart { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_update_stop`] + ///Builder for [`Client::system_update_stop`] /// - ///[`ClientSystemExt::system_update_stop`]: super::ClientSystemExt::system_update_stop + ///[`Client::system_update_stop`]: super::Client::system_update_stop #[derive(Debug, Clone)] pub struct SystemUpdateStop<'a> { client: &'a super::Client, @@ -48620,35 +54447,28 @@ pub mod builder { ///Sends a `POST` request to `/v1/system/update/stop` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/update/stop", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!("{}/v1/system/update/stop", client.baseurl,); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateStop { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_update_list`] + ///Builder for [`Client::system_update_list`] /// - ///[`ClientSystemExt::system_update_list`]: super::ClientSystemExt::system_update_list + ///[`Client::system_update_list`]: super::Client::system_update_list #[derive(Debug, Clone)] pub struct SystemUpdateList<'a> { client: &'a super::Client, @@ -48703,6 +54523,10 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, limit, @@ -48712,39 +54536,31 @@ pub mod builder { let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/update/updates", client.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/v1/system/update/updates", client.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + }; + Ok(built::SystemUpdateList { + client: client, + request, + }) } ///Streams `GET` requests to `/v1/system/update/updates` @@ -48804,9 +54620,9 @@ pub mod builder { } } - ///Builder for [`ClientSystemExt::system_update_view`] + ///Builder for [`Client::system_update_view`] /// - ///[`ClientSystemExt::system_update_view`]: super::ClientSystemExt::system_update_view + ///[`Client::system_update_view`]: super::Client::system_update_view #[derive(Debug, Clone)] pub struct SystemUpdateView<'a> { client: &'a super::Client, @@ -48833,40 +54649,33 @@ pub mod builder { ///Sends a `GET` request to `/v1/system/update/updates/{version}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, version } = self; let version = version.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/update/updates/{}", - client.baseurl, - encode_path(&version.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/system/update/updates/{}", + client.baseurl, + encode_path(&version.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateView { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_update_components_list`] + ///Builder for [`Client::system_update_components_list`] /// - ///[`ClientSystemExt::system_update_components_list`]: super::ClientSystemExt::system_update_components_list + ///[`Client::system_update_components_list`]: super::Client::system_update_components_list #[derive(Debug, Clone)] pub struct SystemUpdateComponentsList<'a> { client: &'a super::Client, @@ -48896,40 +54705,33 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, version } = self; let version = version.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/update/updates/{}/components", - client.baseurl, - encode_path(&version.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!( + "{}/v1/system/update/updates/{}/components", + client.baseurl, + encode_path(&version.to_string()), + ); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemUpdateComponentsList { + client: client, + request, + }) } } - ///Builder for [`ClientSystemExt::system_version`] + ///Builder for [`Client::system_version`] /// - ///[`ClientSystemExt::system_version`]: super::ClientSystemExt::system_version + ///[`Client::system_version`]: super::Client::system_version #[derive(Debug, Clone)] pub struct SystemVersion<'a> { client: &'a super::Client, @@ -48944,29 +54746,22 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/update/version", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/v1/system/update/version", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::SystemVersion { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/nexus_positional.rs b/progenitor-impl/tests/output/src/nexus_positional.rs index 6f19d355..9ed26ca0 100644 --- a/progenitor-impl/tests/output/src/nexus_positional.rs +++ b/progenitor-impl/tests/output/src/nexus_positional.rs @@ -13432,20 +13432,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/disks/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/disks/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13467,20 +13467,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/images/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/images/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13502,20 +13502,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/instances/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/instances/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13537,20 +13537,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/network-interfaces/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/network-interfaces/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13574,20 +13574,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/organizations/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/organizations/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13611,20 +13611,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/projects/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/projects/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13646,20 +13646,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/snapshots/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/snapshots/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13681,20 +13681,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/vpc-router-routes/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/vpc-router-routes/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13716,20 +13716,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/vpc-routers/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/vpc-routers/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13751,20 +13751,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/vpc-subnets/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/vpc-subnets/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13786,20 +13786,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/by-id/vpcs/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/by-id/vpcs/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13825,9 +13825,13 @@ impl Client { &'a self, body: &'a types::DeviceAuthRequest, ) -> Result, Error> { - let url = format!("{}/device/auth", self.baseurl,); #[allow(unused_mut)] - let mut request = self.client.post(url).form_urlencoded(&body)?.build()?; + let mut request = { + let url = format!("{}/device/auth", self.baseurl,); + self.client.post(url).form_urlencoded(&body)? + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13848,17 +13852,19 @@ impl Client { &'a self, body: &'a types::DeviceAuthVerify, ) -> Result, Error> { - let url = format!("{}/device/confirm", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/device/confirm", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13883,9 +13889,13 @@ impl Client { &'a self, body: &'a types::DeviceAccessTokenRequest, ) -> Result, Error> { - let url = format!("{}/device/token", self.baseurl,); #[allow(unused_mut)] - let mut request = self.client.post(url).form_urlencoded(&body)?.build()?; + let mut request = { + let url = format!("{}/device/token", self.baseurl,); + self.client.post(url).form_urlencoded(&body)? + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13909,30 +13919,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/groups", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/groups", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -13997,17 +14006,19 @@ impl Client { &'a self, body: &'a types::SpoofLoginBody, ) -> Result, Error> { - let url = format!("{}/login", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/login", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14030,13 +14041,17 @@ impl Client { silo_name: &'a types::Name, body: &'a types::UsernamePasswordCredentials, ) -> Result, Error> { - let url = format!( - "{}/login/{}/local", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self.client.post(url).json(&body).build()?; + let mut request = { + let url = format!( + "{}/login/{}/local", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client.post(url).json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14062,14 +14077,18 @@ impl Client { silo_name: &'a types::Name, provider_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/login/{}/saml/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self.client.get(url).build()?; + let mut request = { + let url = format!( + "{}/login/{}/saml/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + self.client.get(url) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14093,22 +14112,24 @@ impl Client { provider_name: &'a types::Name, body: B, ) -> Result, Error> { - let url = format!( - "{}/login/{}/saml/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .build()?; + let mut request = { + let url = format!( + "{}/login/{}/saml/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14125,16 +14146,16 @@ impl Client { ///Sends a `POST` request to `/logout` pub async fn logout<'a>(&'a self) -> Result, Error> { - let url = format!("{}/logout", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!("{}/logout", self.baseurl,); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14166,30 +14187,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/organizations", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/organizations", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14261,17 +14281,19 @@ impl Client { &'a self, body: &'a types::OrganizationCreate, ) -> Result, Error> { - let url = format!("{}/organizations", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/organizations", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14298,20 +14320,20 @@ impl Client { &'a self, organization_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14340,21 +14362,23 @@ impl Client { organization_name: &'a types::Name, body: &'a types::OrganizationUpdate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14381,20 +14405,20 @@ impl Client { &'a self, organization_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14421,20 +14445,20 @@ impl Client { &'a self, organization_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/policy", - self.baseurl, - encode_path(&organization_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/policy", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14463,21 +14487,23 @@ impl Client { organization_name: &'a types::Name, body: &'a types::OrganizationRolePolicy, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/policy", - self.baseurl, - encode_path(&organization_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/policy", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14511,34 +14537,33 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects", - self.baseurl, - encode_path(&organization_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14617,21 +14642,23 @@ impl Client { organization_name: &'a types::Name, body: &'a types::ProjectCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects", - self.baseurl, - encode_path(&organization_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects", + self.baseurl, + encode_path(&organization_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14661,21 +14688,21 @@ impl Client { organization_name: &'a types::Name, project_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14707,22 +14734,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::ProjectUpdate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14752,21 +14781,21 @@ impl Client { organization_name: &'a types::Name, project_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14803,35 +14832,34 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/disks", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14919,22 +14947,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::DiskCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/disks", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -14962,22 +14992,22 @@ impl Client { project_name: &'a types::Name, disk_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15003,22 +15033,22 @@ impl Client { project_name: &'a types::Name, disk_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15060,41 +15090,39 @@ impl Client { page_token: Option<&'a str>, start_time: Option<&'a chrono::DateTime>, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&disk_name.to_string()), - encode_path(&metric_name.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &end_time { - query.push(("end_time", v.to_string())); - } - - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &start_time { - query.push(("start_time", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&disk_name.to_string()), + encode_path(&metric_name.to_string()), + ); + let mut query = Vec::with_capacity(4usize); + if let Some(v) = &end_time { + query.push(("end_time", v.to_string())); + } + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &start_time { + query.push(("start_time", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15207,35 +15235,34 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/images", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/images", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15326,22 +15353,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::ImageCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/images", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/images", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15369,22 +15398,22 @@ impl Client { project_name: &'a types::Name, image_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/images/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&image_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/images/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&image_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15414,22 +15443,22 @@ impl Client { project_name: &'a types::Name, image_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/images/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&image_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/images/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&image_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15464,35 +15493,34 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15581,22 +15609,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::InstanceCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15624,22 +15654,22 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15665,22 +15695,22 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15720,36 +15750,35 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15846,23 +15875,25 @@ impl Client { instance_name: &'a types::Name, body: &'a types::DiskIdentifier, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks/attach", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks/attach", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15891,23 +15922,25 @@ impl Client { instance_name: &'a types::Name, body: &'a types::DiskIdentifier, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/disks/detach", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/disks/detach", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15933,22 +15966,22 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/external-ips", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/external-ips", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -15977,23 +16010,25 @@ impl Client { instance_name: &'a types::Name, body: &'a types::InstanceMigrate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/migrate", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/migrate", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16031,36 +16066,35 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16154,23 +16188,25 @@ impl Client { instance_name: &'a types::Name, body: &'a types::NetworkInterfaceCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16197,23 +16233,23 @@ impl Client { instance_name: &'a types::Name, interface_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16241,24 +16277,26 @@ impl Client { interface_name: &'a types::Name, body: &'a types::NetworkInterfaceUpdate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16290,23 +16328,23 @@ impl Client { instance_name: &'a types::Name, interface_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - encode_path(&interface_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + encode_path(&interface_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16334,22 +16372,22 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/reboot", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/reboot", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16396,36 +16434,35 @@ impl Client { max_bytes: Option, most_recent: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/serial-console", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &from_start { - query.push(("from_start", v.to_string())); - } - - if let Some(v) = &max_bytes { - query.push(("max_bytes", v.to_string())); - } - - if let Some(v) = &most_recent { - query.push(("most_recent", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/serial-console", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &from_start { + query.push(("from_start", v.to_string())); + } + if let Some(v) = &max_bytes { + query.push(("max_bytes", v.to_string())); + } + if let Some(v) = &most_recent { + query.push(("most_recent", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16453,28 +16490,30 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client + .get(url) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16497,22 +16536,22 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/start", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/start", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16540,22 +16579,22 @@ impl Client { project_name: &'a types::Name, instance_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/instances/{}/stop", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&instance_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/instances/{}/stop", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&instance_name.to_string()), + ); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16585,21 +16624,21 @@ impl Client { organization_name: &'a types::Name, project_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/policy", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/policy", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16629,22 +16668,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::ProjectRolePolicy, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/policy", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/policy", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16679,35 +16720,34 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/snapshots", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16796,22 +16836,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::SnapshotCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/snapshots", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16837,22 +16879,22 @@ impl Client { project_name: &'a types::Name, snapshot_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/snapshots/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&snapshot_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&snapshot_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16878,22 +16920,22 @@ impl Client { project_name: &'a types::Name, snapshot_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/snapshots/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&snapshot_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/snapshots/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&snapshot_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -16928,35 +16970,34 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17042,22 +17083,24 @@ impl Client { project_name: &'a types::Name, body: &'a types::VpcCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17083,22 +17126,22 @@ impl Client { project_name: &'a types::Name, vpc_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17125,23 +17168,25 @@ impl Client { vpc_name: &'a types::Name, body: &'a types::VpcUpdate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17167,22 +17212,22 @@ impl Client { project_name: &'a types::Name, vpc_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17208,22 +17253,22 @@ impl Client { project_name: &'a types::Name, vpc_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17250,23 +17295,25 @@ impl Client { vpc_name: &'a types::Name, body: &'a types::VpcFirewallRuleUpdateParams, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17304,36 +17351,35 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17427,23 +17473,25 @@ impl Client { vpc_name: &'a types::Name, body: &'a types::VpcRouterCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17470,23 +17518,23 @@ impl Client { vpc_name: &'a types::Name, router_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17514,24 +17562,26 @@ impl Client { router_name: &'a types::Name, body: &'a types::VpcRouterUpdate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17558,23 +17608,23 @@ impl Client { vpc_name: &'a types::Name, router_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17616,37 +17666,36 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17748,24 +17797,26 @@ impl Client { router_name: &'a types::Name, body: &'a types::RouterRouteCreateParams, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17793,24 +17844,24 @@ impl Client { router_name: &'a types::Name, route_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17839,25 +17890,27 @@ impl Client { route_name: &'a types::Name, body: &'a types::RouterRouteUpdateParams, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17885,24 +17938,24 @@ impl Client { router_name: &'a types::Name, route_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&router_name.to_string()), - encode_path(&route_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&router_name.to_string()), + encode_path(&route_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -17940,36 +17993,35 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18063,23 +18115,25 @@ impl Client { vpc_name: &'a types::Name, body: &'a types::VpcSubnetCreate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18106,23 +18160,23 @@ impl Client { vpc_name: &'a types::Name, subnet_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18150,24 +18204,26 @@ impl Client { subnet_name: &'a types::Name, body: &'a types::VpcSubnetUpdate, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18194,23 +18250,23 @@ impl Client { vpc_name: &'a types::Name, subnet_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18250,37 +18306,36 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", - self.baseurl, - encode_path(&organization_name.to_string()), - encode_path(&project_name.to_string()), - encode_path(&vpc_name.to_string()), - encode_path(&subnet_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", + self.baseurl, + encode_path(&organization_name.to_string()), + encode_path(&project_name.to_string()), + encode_path(&vpc_name.to_string()), + encode_path(&subnet_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18373,16 +18428,16 @@ impl Client { pub async fn policy_view<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/policy", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/policy", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18404,17 +18459,19 @@ impl Client { &'a self, body: &'a types::SiloRolePolicy, ) -> Result, Error> { - let url = format!("{}/policy", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/policy", self.baseurl,); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18442,26 +18499,26 @@ impl Client { limit: Option, page_token: Option<&'a str>, ) -> Result, Error> { - let url = format!("{}/roles", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/roles", self.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18529,20 +18586,20 @@ impl Client { &'a self, role_name: &'a str, ) -> Result, Error> { - let url = format!( - "{}/roles/{}", - self.baseurl, - encode_path(&role_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/roles/{}", + self.baseurl, + encode_path(&role_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18563,16 +18620,16 @@ impl Client { pub async fn session_me<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/session/me", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/session/me", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18602,30 +18659,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/session/me/groups", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/session/me/groups", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18702,30 +18758,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/session/me/sshkeys", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/session/me/sshkeys", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18796,17 +18851,19 @@ impl Client { &'a self, body: &'a types::SshKeyCreate, ) -> Result, Error> { - let url = format!("{}/session/me/sshkeys", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/session/me/sshkeys", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18831,20 +18888,20 @@ impl Client { &'a self, ssh_key_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/session/me/sshkeys/{}", - self.baseurl, - encode_path(&ssh_key_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/session/me/sshkeys/{}", + self.baseurl, + encode_path(&ssh_key_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18869,20 +18926,20 @@ impl Client { &'a self, ssh_key_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/session/me/sshkeys/{}", - self.baseurl, - encode_path(&ssh_key_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/session/me/sshkeys/{}", + self.baseurl, + encode_path(&ssh_key_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18904,20 +18961,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/by-id/images/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/by-id/images/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18939,20 +18996,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/by-id/ip-pools/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/by-id/ip-pools/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -18974,20 +19031,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/by-id/silos/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/by-id/silos/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19021,30 +19078,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/certificates", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/certificates", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19119,17 +19175,19 @@ impl Client { &'a self, body: &'a types::CertificateCreate, ) -> Result, Error> { - let url = format!("{}/system/certificates", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/certificates", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19153,20 +19211,20 @@ impl Client { &'a self, certificate: &'a types::NameOrId, ) -> Result, Error> { - let url = format!( - "{}/system/certificates/{}", - self.baseurl, - encode_path(&certificate.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/certificates/{}", + self.baseurl, + encode_path(&certificate.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19190,20 +19248,20 @@ impl Client { &'a self, certificate: &'a types::NameOrId, ) -> Result, Error> { - let url = format!( - "{}/system/certificates/{}", - self.baseurl, - encode_path(&certificate.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/system/certificates/{}", + self.baseurl, + encode_path(&certificate.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19233,30 +19291,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/hardware/disks", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/hardware/disks", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19332,30 +19389,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/hardware/racks", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/hardware/racks", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19425,20 +19481,20 @@ impl Client { &'a self, rack_id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/hardware/racks/{}", - self.baseurl, - encode_path(&rack_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/hardware/racks/{}", + self.baseurl, + encode_path(&rack_id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19468,30 +19524,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/hardware/sleds", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/hardware/sleds", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19561,20 +19616,20 @@ impl Client { &'a self, sled_id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/hardware/sleds/{}", - self.baseurl, - encode_path(&sled_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/hardware/sleds/{}", + self.baseurl, + encode_path(&sled_id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19606,34 +19661,33 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/system/hardware/sleds/{}/disks", - self.baseurl, - encode_path(&sled_id.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/system/hardware/sleds/{}/disks", + self.baseurl, + encode_path(&sled_id.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19716,30 +19770,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/images", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/images", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19814,17 +19867,19 @@ impl Client { &'a self, body: &'a types::GlobalImageCreate, ) -> Result, Error> { - let url = format!("{}/system/images", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/images", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19848,20 +19903,20 @@ impl Client { &'a self, image_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/images/{}", - self.baseurl, - encode_path(&image_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/images/{}", + self.baseurl, + encode_path(&image_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19887,20 +19942,20 @@ impl Client { &'a self, image_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/images/{}", - self.baseurl, - encode_path(&image_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/system/images/{}", + self.baseurl, + encode_path(&image_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -19930,30 +19985,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/ip-pools", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/ip-pools", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20020,17 +20074,19 @@ impl Client { &'a self, body: &'a types::IpPoolCreate, ) -> Result, Error> { - let url = format!("{}/system/ip-pools", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/ip-pools", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20052,20 +20108,20 @@ impl Client { &'a self, pool_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/ip-pools/{}", - self.baseurl, - encode_path(&pool_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/ip-pools/{}", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20088,21 +20144,23 @@ impl Client { pool_name: &'a types::Name, body: &'a types::IpPoolUpdate, ) -> Result, Error> { - let url = format!( - "{}/system/ip-pools/{}", - self.baseurl, - encode_path(&pool_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/ip-pools/{}", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20124,20 +20182,20 @@ impl Client { &'a self, pool_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/ip-pools/{}", - self.baseurl, - encode_path(&pool_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/system/ip-pools/{}", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20169,30 +20227,30 @@ impl Client { limit: Option, page_token: Option<&'a str>, ) -> Result, Error> { - let url = format!( - "{}/system/ip-pools/{}/ranges", - self.baseurl, - encode_path(&pool_name.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/system/ip-pools/{}/ranges", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20263,21 +20321,23 @@ impl Client { pool_name: &'a types::Name, body: &'a types::IpRange, ) -> Result, Error> { - let url = format!( - "{}/system/ip-pools/{}/ranges/add", - self.baseurl, - encode_path(&pool_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/ip-pools/{}/ranges/add", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20300,21 +20360,23 @@ impl Client { pool_name: &'a types::Name, body: &'a types::IpRange, ) -> Result, Error> { - let url = format!( - "{}/system/ip-pools/{}/ranges/remove", - self.baseurl, - encode_path(&pool_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/ip-pools/{}/ranges/remove", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20335,16 +20397,16 @@ impl Client { pub async fn ip_pool_service_view<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/system/ip-pools-service", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/system/ip-pools-service", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20374,26 +20436,26 @@ impl Client { limit: Option, page_token: Option<&'a str>, ) -> Result, Error> { - let url = format!("{}/system/ip-pools-service/ranges", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/ip-pools-service/ranges", self.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20461,17 +20523,19 @@ impl Client { &'a self, body: &'a types::IpRange, ) -> Result, Error> { - let url = format!("{}/system/ip-pools-service/ranges/add", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/ip-pools-service/ranges/add", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20493,17 +20557,19 @@ impl Client { &'a self, body: &'a types::IpRange, ) -> Result, Error> { - let url = format!("{}/system/ip-pools-service/ranges/remove", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/ip-pools-service/ranges/remove", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20539,39 +20605,37 @@ impl Client { page_token: Option<&'a str>, start_time: Option<&'a chrono::DateTime>, ) -> Result, Error> { - let url = format!( - "{}/system/metrics/{}", - self.baseurl, - encode_path(&metric_name.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &end_time { - query.push(("end_time", v.to_string())); - } - - query.push(("id", id.to_string())); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &start_time { - query.push(("start_time", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/system/metrics/{}", + self.baseurl, + encode_path(&metric_name.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &end_time { + query.push(("end_time", v.to_string())); + } + query.push(("id", id.to_string())); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &start_time { + query.push(("start_time", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20592,16 +20656,16 @@ impl Client { pub async fn system_policy_view<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/system/policy", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/system/policy", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20623,17 +20687,19 @@ impl Client { &'a self, body: &'a types::FleetRolePolicy, ) -> Result, Error> { - let url = format!("{}/system/policy", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/policy", self.baseurl,); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20663,30 +20729,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/sagas", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/sagas", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20753,20 +20818,20 @@ impl Client { &'a self, saga_id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/sagas/{}", - self.baseurl, - encode_path(&saga_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/sagas/{}", + self.baseurl, + encode_path(&saga_id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20798,30 +20863,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/silos", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/silos", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20890,17 +20954,19 @@ impl Client { &'a self, body: &'a types::SiloCreate, ) -> Result, Error> { - let url = format!("{}/system/silos", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/system/silos", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20927,20 +20993,20 @@ impl Client { &'a self, silo_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/silos/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -20967,20 +21033,20 @@ impl Client { &'a self, silo_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/system/silos/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21012,34 +21078,33 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/identity-providers", - self.baseurl, - encode_path(&silo_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/system/silos/{}/identity-providers", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21120,21 +21185,23 @@ impl Client { silo_name: &'a types::Name, body: &'a types::UserCreate, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/identity-providers/local/users", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21162,21 +21229,21 @@ impl Client { silo_name: &'a types::Name, user_id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/identity-providers/local/users/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21210,22 +21277,24 @@ impl Client { user_id: &'a uuid::Uuid, body: &'a types::UserPassword, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/identity-providers/local/users/{}/set-password", - self.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/silos/{}/identity-providers/local/users/{}/set-password", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21253,21 +21322,23 @@ impl Client { silo_name: &'a types::Name, body: &'a types::SamlIdentityProviderCreate, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/identity-providers/saml", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/silos/{}/identity-providers/saml", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21295,21 +21366,21 @@ impl Client { silo_name: &'a types::Name, provider_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/identity-providers/saml/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&provider_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/silos/{}/identity-providers/saml/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21334,20 +21405,20 @@ impl Client { &'a self, silo_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/policy", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/silos/{}/policy", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21374,21 +21445,23 @@ impl Client { silo_name: &'a types::Name, body: &'a types::SiloRolePolicy, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/policy", - self.baseurl, - encode_path(&silo_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/system/silos/{}/policy", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21420,34 +21493,33 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/users/all", - self.baseurl, - encode_path(&silo_name.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/system/silos/{}/users/all", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21521,21 +21593,21 @@ impl Client { silo_name: &'a types::Name, user_id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/system/silos/{}/users/id/{}", - self.baseurl, - encode_path(&silo_name.to_string()), - encode_path(&user_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/silos/{}/users/id/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&user_id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21565,30 +21637,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/system/user", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/system/user", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21659,20 +21730,20 @@ impl Client { &'a self, user_name: &'a types::Name, ) -> Result, Error> { - let url = format!( - "{}/system/user/{}", - self.baseurl, - encode_path(&user_name.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/system/user/{}", + self.baseurl, + encode_path(&user_name.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21700,26 +21771,26 @@ impl Client { limit: Option, page_token: Option<&'a str>, ) -> Result, Error> { - let url = format!("{}/timeseries/schema", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/timeseries/schema", self.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21793,30 +21864,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/users", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/users", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21895,38 +21965,35 @@ impl Client { project: Option<&'a types::NameOrId>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/disks", self.baseurl,); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/disks", self.baseurl,); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -21999,24 +22066,25 @@ impl Client { project: &'a types::NameOrId, body: &'a types::DiskCreate, ) -> Result, Error> { - let url = format!("{}/v1/disks", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - query.push(("project", project.to_string())); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + let mut request = { + let url = format!("{}/v1/disks", self.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + query.push(("project", project.to_string())); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22040,30 +22108,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/disks/{}", - self.baseurl, - encode_path(&disk.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/disks/{}", + self.baseurl, + encode_path(&disk.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22087,30 +22155,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/disks/{}", - self.baseurl, - encode_path(&disk.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/disks/{}", + self.baseurl, + encode_path(&disk.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22144,38 +22212,35 @@ impl Client { project: Option<&'a types::NameOrId>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/instances", self.baseurl,); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/instances", self.baseurl,); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22249,24 +22314,25 @@ impl Client { project: &'a types::NameOrId, body: &'a types::InstanceCreate, ) -> Result, Error> { - let url = format!("{}/v1/instances", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - query.push(("project", project.to_string())); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + let mut request = { + let url = format!("{}/v1/instances", self.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + query.push(("project", project.to_string())); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22290,30 +22356,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22337,30 +22403,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22396,42 +22462,39 @@ impl Client { project: Option<&'a types::NameOrId>, sort_by: Option, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/disks", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/disks", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22514,31 +22577,31 @@ impl Client { project: Option<&'a types::NameOrId>, body: &'a types::DiskPath, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/disks/attach", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/disks/attach", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22563,31 +22626,31 @@ impl Client { project: Option<&'a types::NameOrId>, body: &'a types::DiskPath, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/disks/detach", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/disks/detach", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22612,31 +22675,31 @@ impl Client { project: Option<&'a types::NameOrId>, body: &'a types::InstanceMigrate, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/migrate", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/migrate", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22660,30 +22723,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/reboot", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/reboot", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22726,42 +22789,39 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/serial-console", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &from_start { - query.push(("from_start", v.to_string())); - } - - if let Some(v) = &max_bytes { - query.push(("max_bytes", v.to_string())); - } - - if let Some(v) = &most_recent { - query.push(("most_recent", v.to_string())); - } - - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/serial-console", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(5usize); + if let Some(v) = &from_start { + query.push(("from_start", v.to_string())); + } + if let Some(v) = &max_bytes { + query.push(("max_bytes", v.to_string())); + } + if let Some(v) = &most_recent { + query.push(("most_recent", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22786,36 +22846,36 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/serial-console/stream", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); - } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .query(&query) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; + let mut request = { + let url = format!( + "{}/v1/instances/{}/serial-console/stream", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .get(url) + .query(&query) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22834,30 +22894,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/start", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/start", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22881,30 +22941,30 @@ impl Client { organization: Option<&'a types::NameOrId>, project: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/instances/{}/stop", - self.baseurl, - encode_path(&instance.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &project { - query.push(("project", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/instances/{}/stop", + self.baseurl, + encode_path(&instance.to_string()), + ); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -22934,30 +22994,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/organizations", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/organizations", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23025,17 +23084,19 @@ impl Client { &'a self, body: &'a types::OrganizationCreate, ) -> Result, Error> { - let url = format!("{}/v1/organizations", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/v1/organizations", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23057,20 +23118,20 @@ impl Client { &'a self, organization: &'a types::NameOrId, ) -> Result, Error> { - let url = format!( - "{}/v1/organizations/{}", - self.baseurl, - encode_path(&organization.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/organizations/{}", + self.baseurl, + encode_path(&organization.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23093,21 +23154,23 @@ impl Client { organization: &'a types::NameOrId, body: &'a types::OrganizationUpdate, ) -> Result, Error> { - let url = format!( - "{}/v1/organizations/{}", - self.baseurl, - encode_path(&organization.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/v1/organizations/{}", + self.baseurl, + encode_path(&organization.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23129,20 +23192,20 @@ impl Client { &'a self, organization: &'a types::NameOrId, ) -> Result, Error> { - let url = format!( - "{}/v1/organizations/{}", - self.baseurl, - encode_path(&organization.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( + let mut request = { + let url = format!( + "{}/v1/organizations/{}", + self.baseurl, + encode_path(&organization.to_string()), + ); + self.client.delete(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23164,20 +23227,20 @@ impl Client { &'a self, organization: &'a types::NameOrId, ) -> Result, Error> { - let url = format!( - "{}/v1/organizations/{}/policy", - self.baseurl, - encode_path(&organization.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/organizations/{}/policy", + self.baseurl, + encode_path(&organization.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23200,21 +23263,23 @@ impl Client { organization: &'a types::NameOrId, body: &'a types::OrganizationRolePolicy, ) -> Result, Error> { - let url = format!( - "{}/v1/organizations/{}/policy", - self.baseurl, - encode_path(&organization.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!( + "{}/v1/organizations/{}/policy", + self.baseurl, + encode_path(&organization.to_string()), + ); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23246,34 +23311,32 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/projects", self.baseurl,); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &organization { - query.push(("organization", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/projects", self.baseurl,); + let mut query = Vec::with_capacity(4usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23343,20 +23406,22 @@ impl Client { organization: &'a types::NameOrId, body: &'a types::ProjectCreate, ) -> Result, Error> { - let url = format!("{}/v1/projects", self.baseurl,); - let mut query = Vec::with_capacity(1usize); - query.push(("organization", organization.to_string())); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + let mut request = { + let url = format!("{}/v1/projects", self.baseurl,); + let mut query = Vec::with_capacity(1usize); + query.push(("organization", organization.to_string())); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23379,26 +23444,27 @@ impl Client { project: &'a types::NameOrId, organization: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/projects/{}", - self.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/projects/{}", + self.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23422,27 +23488,28 @@ impl Client { organization: Option<&'a types::NameOrId>, body: &'a types::ProjectUpdate, ) -> Result, Error> { - let url = format!( - "{}/v1/projects/{}", - self.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/projects/{}", + self.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23465,26 +23532,27 @@ impl Client { project: &'a types::NameOrId, organization: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/projects/{}", - self.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/projects/{}", + self.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + self.client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23507,26 +23575,27 @@ impl Client { project: &'a types::NameOrId, organization: Option<&'a types::NameOrId>, ) -> Result, Error> { - let url = format!( - "{}/v1/projects/{}/policy", - self.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/projects/{}/policy", + self.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23550,27 +23619,28 @@ impl Client { organization: Option<&'a types::NameOrId>, body: &'a types::ProjectRolePolicy, ) -> Result, Error> { - let url = format!( - "{}/v1/projects/{}/policy", - self.baseurl, - encode_path(&project.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &organization { - query.push(("organization", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!( + "{}/v1/projects/{}/policy", + self.baseurl, + encode_path(&project.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &organization { + query.push(("organization", v.to_string())); + } + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23600,30 +23670,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/system/update/components", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/system/update/components", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23699,30 +23768,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/system/update/deployments", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/system/update/deployments", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23790,20 +23858,20 @@ impl Client { &'a self, id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/v1/system/update/deployments/{}", - self.baseurl, - encode_path(&id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/system/update/deployments/{}", + self.baseurl, + encode_path(&id.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23824,16 +23892,16 @@ impl Client { pub async fn system_update_refresh<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/v1/system/update/refresh", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!("{}/v1/system/update/refresh", self.baseurl,); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23855,17 +23923,19 @@ impl Client { &'a self, body: &'a types::SystemUpdateStart, ) -> Result, Error> { - let url = format!("{}/v1/system/update/start", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/v1/system/update/start", self.baseurl,); + self.client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23888,16 +23958,16 @@ impl Client { pub async fn system_update_stop<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/v1/system/update/stop", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!("{}/v1/system/update/stop", self.baseurl,); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -23927,30 +23997,29 @@ impl Client { page_token: Option<&'a str>, sort_by: Option, ) -> Result, Error> { - let url = format!("{}/v1/system/update/updates", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - - if let Some(v) = &page_token { - query.push(("page_token", v.to_string())); - } - - if let Some(v) = &sort_by { - query.push(("sort_by", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/v1/system/update/updates", self.baseurl,); + let mut query = Vec::with_capacity(3usize); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + if let Some(v) = &sort_by { + query.push(("sort_by", v.to_string())); + } + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) } - #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -24018,20 +24087,20 @@ impl Client { &'a self, version: &'a types::SemverVersion, ) -> Result, Error> { - let url = format!( - "{}/v1/system/update/updates/{}", - self.baseurl, - encode_path(&version.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/system/update/updates/{}", + self.baseurl, + encode_path(&version.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -24054,20 +24123,20 @@ impl Client { &'a self, version: &'a types::SemverVersion, ) -> Result, Error> { - let url = format!( - "{}/v1/system/update/updates/{}/components", - self.baseurl, - encode_path(&version.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!( + "{}/v1/system/update/updates/{}/components", + self.baseurl, + encode_path(&version.to_string()), + ); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -24088,16 +24157,16 @@ impl Client { pub async fn system_version<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/v1/system/update/version", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/v1/system/update/version", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/param_collision_builder.rs b/progenitor-impl/tests/output/src/param_collision_builder.rs index b79b3ee7..302a6ee4 100644 --- a/progenitor-impl/tests/output/src/param_collision_builder.rs +++ b/progenitor-impl/tests/output/src/param_collision_builder.rs @@ -139,6 +139,42 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct KeyGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> KeyGet<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let _result = client.client.execute(request).await; + let _response = _result?; + match _response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(_response)), + _ => Err(Error::UnexpectedResponse(_response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::key_get`] /// ///[`Client::key_get`]: super::Client::key_get @@ -228,6 +264,10 @@ pub mod builder { ///Sends a `GET` request to `/key/{query}` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { _client, query, @@ -243,25 +283,20 @@ pub mod builder { let response = response.map_err(Error::InvalidRequest)?; let result = result.map_err(Error::InvalidRequest)?; let url = url.map_err(Error::InvalidRequest)?; - let _url = format!( - "{}/key/{}", - _client.baseurl, - encode_path(&query.to_string()), - ); - let mut _query = Vec::with_capacity(5usize); - _query.push(("client", client.to_string())); - _query.push(("request", request.to_string())); - _query.push(("response", response.to_string())); - _query.push(("result", result.to_string())); - _query.push(("url", url.to_string())); - #[allow(unused_mut)] - let mut _request = _client.client.get(_url).query(&_query).build()?; - let _result = _client.client.execute(_request).await; - let _response = _result?; - match _response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(_response)), - _ => Err(Error::UnexpectedResponse(_response)), - } + let request = { + let _url = format!("{}/key/{}", client.baseurl, encode_path(&query.to_string()),); + let mut _query = Vec::with_capacity(5usize); + _query.push(("client", client.to_string())); + _query.push(("request", request.to_string())); + _query.push(("response", response.to_string())); + _query.push(("result", result.to_string())); + _query.push(("url", url.to_string())); + client.client.get(_url).query(&_query) + }; + Ok(built::KeyGet { + client: _client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/param_collision_builder_tagged.rs b/progenitor-impl/tests/output/src/param_collision_builder_tagged.rs index c32e270b..1eeef60c 100644 --- a/progenitor-impl/tests/output/src/param_collision_builder_tagged.rs +++ b/progenitor-impl/tests/output/src/param_collision_builder_tagged.rs @@ -139,6 +139,42 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct KeyGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> KeyGet<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let _result = client.client.execute(request).await; + let _response = _result?; + match _response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(_response)), + _ => Err(Error::UnexpectedResponse(_response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::key_get`] /// ///[`Client::key_get`]: super::Client::key_get @@ -228,6 +264,10 @@ pub mod builder { ///Sends a `GET` request to `/key/{query}` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { _client, query, @@ -243,25 +283,20 @@ pub mod builder { let response = response.map_err(Error::InvalidRequest)?; let result = result.map_err(Error::InvalidRequest)?; let url = url.map_err(Error::InvalidRequest)?; - let _url = format!( - "{}/key/{}", - _client.baseurl, - encode_path(&query.to_string()), - ); - let mut _query = Vec::with_capacity(5usize); - _query.push(("client", client.to_string())); - _query.push(("request", request.to_string())); - _query.push(("response", response.to_string())); - _query.push(("result", result.to_string())); - _query.push(("url", url.to_string())); - #[allow(unused_mut)] - let mut _request = _client.client.get(_url).query(&_query).build()?; - let _result = _client.client.execute(_request).await; - let _response = _result?; - match _response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(_response)), - _ => Err(Error::UnexpectedResponse(_response)), - } + let request = { + let _url = format!("{}/key/{}", client.baseurl, encode_path(&query.to_string()),); + let mut _query = Vec::with_capacity(5usize); + _query.push(("client", client.to_string())); + _query.push(("request", request.to_string())); + _query.push(("response", response.to_string())); + _query.push(("result", result.to_string())); + _query.push(("url", url.to_string())); + client.client.get(_url).query(&_query) + }; + Ok(built::KeyGet { + client: _client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/param_collision_positional.rs b/progenitor-impl/tests/output/src/param_collision_positional.rs index 3599c21c..334055ed 100644 --- a/progenitor-impl/tests/output/src/param_collision_positional.rs +++ b/progenitor-impl/tests/output/src/param_collision_positional.rs @@ -125,16 +125,20 @@ impl Client { result: bool, url: bool, ) -> Result, Error<()>> { - let _url = format!("{}/key/{}", self.baseurl, encode_path(&query.to_string()),); - let mut _query = Vec::with_capacity(5usize); - _query.push(("client", client.to_string())); - _query.push(("request", request.to_string())); - _query.push(("response", response.to_string())); - _query.push(("result", result.to_string())); - _query.push(("url", url.to_string())); #[allow(unused_mut)] - let mut _request = self.client.get(_url).query(&_query).build()?; - let _result = self.client.execute(_request).await; + let mut request = { + let _url = format!("{}/key/{}", self.baseurl, encode_path(&query.to_string()),); + let mut _query = Vec::with_capacity(5usize); + _query.push(("client", client.to_string())); + _query.push(("request", request.to_string())); + _query.push(("response", response.to_string())); + _query.push(("result", result.to_string())); + _query.push(("url", url.to_string())); + self.client.get(_url).query(&_query) + } + + .build()?; + let _result = self.client.execute(request).await; let _response = _result?; match _response.status().as_u16() { 200u16 => Ok(ResponseValue::empty(_response)), diff --git a/progenitor-impl/tests/output/src/param_overrides_builder.rs b/progenitor-impl/tests/output/src/param_overrides_builder.rs index 97af623f..f851fc8f 100644 --- a/progenitor-impl/tests/output/src/param_overrides_builder.rs +++ b/progenitor-impl/tests/output/src/param_overrides_builder.rs @@ -133,6 +133,42 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct KeyGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> KeyGet<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::key_get`] /// ///[`Client::key_get`]: super::Client::key_get @@ -176,6 +212,10 @@ pub mod builder { ///Sends a `GET` request to `/key` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, key, @@ -183,22 +223,21 @@ pub mod builder { } = self; let key = key.map_err(Error::InvalidRequest)?; let unique_key = unique_key.map_err(Error::InvalidRequest)?; - let url = format!("{}/key", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &key { - query.push(("key", v.to_string())); - } - if let Some(v) = &unique_key { - query.push(("uniqueKey", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client.client.get(url).query(&query).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/key", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &key { + query.push(("key", v.to_string())); + } + if let Some(v) = &unique_key { + query.push(("uniqueKey", v.to_string())); + } + client.client.get(url).query(&query) + }; + Ok(built::KeyGet { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/param_overrides_builder_tagged.rs b/progenitor-impl/tests/output/src/param_overrides_builder_tagged.rs index b40de589..6802ee01 100644 --- a/progenitor-impl/tests/output/src/param_overrides_builder_tagged.rs +++ b/progenitor-impl/tests/output/src/param_overrides_builder_tagged.rs @@ -133,6 +133,42 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct KeyGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> KeyGet<'a> { + pub async fn send(self) -> Result, Error<()>> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => Ok(ResponseValue::empty(response)), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::key_get`] /// ///[`Client::key_get`]: super::Client::key_get @@ -176,6 +212,10 @@ pub mod builder { ///Sends a `GET` request to `/key` pub async fn send(self) -> Result, Error<()>> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error<()>> { let Self { client, key, @@ -183,22 +223,21 @@ pub mod builder { } = self; let key = key.map_err(Error::InvalidRequest)?; let unique_key = unique_key.map_err(Error::InvalidRequest)?; - let url = format!("{}/key", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &key { - query.push(("key", v.to_string())); - } - if let Some(v) = &unique_key { - query.push(("uniqueKey", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client.client.get(url).query(&query).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/key", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &key { + query.push(("key", v.to_string())); + } + if let Some(v) = &unique_key { + query.push(("uniqueKey", v.to_string())); + } + client.client.get(url).query(&query) + }; + Ok(built::KeyGet { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/param_overrides_positional.rs b/progenitor-impl/tests/output/src/param_overrides_positional.rs index 905fb7ea..8e8e706b 100644 --- a/progenitor-impl/tests/output/src/param_overrides_positional.rs +++ b/progenitor-impl/tests/output/src/param_overrides_positional.rs @@ -119,18 +119,20 @@ impl Client { key: Option, unique_key: Option<&'a str>, ) -> Result, Error<()>> { - let url = format!("{}/key", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &key { - query.push(("key", v.to_string())); - } - - if let Some(v) = &unique_key { - query.push(("uniqueKey", v.to_string())); + #[allow(unused_mut)] + let mut request = { + let url = format!("{}/key", self.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &key { + query.push(("key", v.to_string())); + } + if let Some(v) = &unique_key { + query.push(("uniqueKey", v.to_string())); + } + self.client.get(url).query(&query) } - #[allow(unused_mut)] - let mut request = self.client.get(url).query(&query).build()?; + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/propolis_server_builder.rs b/progenitor-impl/tests/output/src/propolis_server_builder.rs index 498706cb..799c02d3 100644 --- a/progenitor-impl/tests/output/src/propolis_server_builder.rs +++ b/progenitor-impl/tests/output/src/propolis_server_builder.rs @@ -2984,6 +2984,261 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct InstanceGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceGet<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceEnsure<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceEnsure<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceIssueCrucibleSnapshotRequest<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceMigrateStatus<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceMigrateStatus<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerial<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerial<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 101u16 => ResponseValue::upgrade(response).await, + 200..=299 => ResponseValue::upgrade(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStatePut<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStatePut<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStateMonitor<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStateMonitor<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::instance_get`] /// ///[`Client::instance_get`]: super::Client::instance_get @@ -3001,29 +3256,22 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/instance", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/instance", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceGet { + client: client, + request, + }) } } @@ -3072,33 +3320,29 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::InstanceEnsureRequest::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/instance", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceEnsure { + client: client, + request, + }) } } @@ -3144,6 +3388,12 @@ pub mod builder { ///Sends a `POST` request to /// `/instance/disk/{id}/snapshot/{snapshot_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, id, @@ -3151,33 +3401,22 @@ pub mod builder { } = self; let id = id.map_err(Error::InvalidRequest)?; let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/instance/disk/{}/snapshot/{}", - client.baseurl, - encode_path(&id.to_string()), - encode_path(&snapshot_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/instance/disk/{}/snapshot/{}", + client.baseurl, + encode_path(&id.to_string()), + encode_path(&snapshot_id.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceIssueCrucibleSnapshotRequest { + client: client, + request, + }) } } @@ -3228,35 +3467,31 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| { types::InstanceMigrateStatusRequest::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/instance/migrate/status", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/migrate/status", client.baseurl,); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceMigrateStatus { + client: client, + request, + }) } } @@ -3277,30 +3512,31 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/instance/serial", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 101u16 => ResponseValue::upgrade(response).await, - 200..=299 => ResponseValue::upgrade(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/serial", client.baseurl,); + client + .client + .get(url) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + }; + Ok(built::InstanceSerial { + client: client, + request, + }) } } @@ -3333,31 +3569,27 @@ pub mod builder { ///Sends a `PUT` request to `/instance/state` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/instance/state", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/state", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceStatePut { + client: client, + request, + }) } } @@ -3408,35 +3640,31 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| { types::InstanceStateMonitorRequest::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/instance/state-monitor", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/state-monitor", client.baseurl,); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceStateMonitor { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/propolis_server_builder_tagged.rs b/progenitor-impl/tests/output/src/propolis_server_builder_tagged.rs index d95a91cf..c352d8b3 100644 --- a/progenitor-impl/tests/output/src/propolis_server_builder_tagged.rs +++ b/progenitor-impl/tests/output/src/propolis_server_builder_tagged.rs @@ -2948,6 +2948,261 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct InstanceGet<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceGet<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceEnsure<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceEnsure<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceIssueCrucibleSnapshotRequest<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceMigrateStatus<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceMigrateStatus<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceSerial<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceSerial<'a> { + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 101u16 => ResponseValue::upgrade(response).await, + 200..=299 => ResponseValue::upgrade(response).await, + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStatePut<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStatePut<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + + pub struct InstanceStateMonitor<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> InstanceStateMonitor<'a> { + pub async fn send( + self, + ) -> Result, Error> + { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::instance_get`] /// ///[`Client::instance_get`]: super::Client::instance_get @@ -2965,29 +3220,22 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/instance", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( + let request = { + let url = format!("{}/instance", client.baseurl,); + client.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceGet { + client: client, + request, + }) } } @@ -3036,33 +3284,29 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::InstanceEnsureRequest::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/instance", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceEnsure { + client: client, + request, + }) } } @@ -3108,6 +3352,12 @@ pub mod builder { ///Sends a `POST` request to /// `/instance/disk/{id}/snapshot/{snapshot_id}` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build( + self, + ) -> Result, Error> { let Self { client, id, @@ -3115,33 +3365,22 @@ pub mod builder { } = self; let id = id.map_err(Error::InvalidRequest)?; let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/instance/disk/{}/snapshot/{}", - client.baseurl, - encode_path(&id.to_string()), - encode_path(&snapshot_id.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .post(url) - .header( + let request = { + let url = format!( + "{}/instance/disk/{}/snapshot/{}", + client.baseurl, + encode_path(&id.to_string()), + encode_path(&snapshot_id.to_string()), + ); + client.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + }; + Ok(built::InstanceIssueCrucibleSnapshotRequest { + client: client, + request, + }) } } @@ -3192,35 +3431,31 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| { types::InstanceMigrateStatusRequest::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/instance/migrate/status", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/migrate/status", client.baseurl,); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceMigrateStatus { + client: client, + request, + }) } } @@ -3241,30 +3476,31 @@ pub mod builder { pub async fn send( self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/instance/serial", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 101u16 => ResponseValue::upgrade(response).await, - 200..=299 => ResponseValue::upgrade(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/serial", client.baseurl,); + client + .client + .get(url) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + }; + Ok(built::InstanceSerial { + client: client, + request, + }) } } @@ -3297,31 +3533,27 @@ pub mod builder { ///Sends a `PUT` request to `/instance/state` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; - let url = format!("{}/instance/state", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/state", client.baseurl,); + client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceStatePut { + client: client, + request, + }) } } @@ -3372,35 +3604,31 @@ pub mod builder { self, ) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| { types::InstanceStateMonitorRequest::try_from(v).map_err(|e| e.to_string()) }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/instance/state-monitor", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } + let request = { + let url = format!("{}/instance/state-monitor", client.baseurl,); + client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + }; + Ok(built::InstanceStateMonitor { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/propolis_server_positional.rs b/progenitor-impl/tests/output/src/propolis_server_positional.rs index 8d7f3a6d..ed14489d 100644 --- a/progenitor-impl/tests/output/src/propolis_server_positional.rs +++ b/progenitor-impl/tests/output/src/propolis_server_positional.rs @@ -1491,16 +1491,16 @@ impl Client { pub async fn instance_get<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/instance", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( + let mut request = { + let url = format!("{}/instance", self.baseurl,); + self.client.get(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1520,17 +1520,19 @@ impl Client { &'a self, body: &'a types::InstanceEnsureRequest, ) -> Result, Error> { - let url = format!("{}/instance", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/instance", self.baseurl,); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1553,21 +1555,21 @@ impl Client { id: &'a uuid::Uuid, snapshot_id: &'a uuid::Uuid, ) -> Result, Error> { - let url = format!( - "{}/instance/disk/{}/snapshot/{}", - self.baseurl, - encode_path(&id.to_string()), - encode_path(&snapshot_id.to_string()), - ); #[allow(unused_mut)] - let mut request = self - .client - .post(url) - .header( + let mut request = { + let url = format!( + "{}/instance/disk/{}/snapshot/{}", + self.baseurl, + encode_path(&id.to_string()), + encode_path(&snapshot_id.to_string()), + ); + self.client.post(url).header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .build()?; + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1587,17 +1589,19 @@ impl Client { &'a self, body: &'a types::InstanceMigrateStatusRequest, ) -> Result, Error> { - let url = format!("{}/instance/migrate/status", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/instance/migrate/status", self.baseurl,); + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1616,22 +1620,24 @@ impl Client { pub async fn instance_serial<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/instance/serial", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header(reqwest::header::CONNECTION, "Upgrade") - .header(reqwest::header::UPGRADE, "websocket") - .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") - .header( - reqwest::header::SEC_WEBSOCKET_KEY, - base64::Engine::encode( - &base64::engine::general_purpose::STANDARD, - rand::random::<[u8; 16]>(), - ), - ) - .build()?; + let mut request = { + let url = format!("{}/instance/serial", self.baseurl,); + self.client + .get(url) + .header(reqwest::header::CONNECTION, "Upgrade") + .header(reqwest::header::UPGRADE, "websocket") + .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") + .header( + reqwest::header::SEC_WEBSOCKET_KEY, + base64::Engine::encode( + &base64::engine::general_purpose::STANDARD, + rand::random::<[u8; 16]>(), + ), + ) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1646,17 +1652,19 @@ impl Client { &'a self, body: types::InstanceStateRequested, ) -> Result, Error> { - let url = format!("{}/instance/state", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/instance/state", self.baseurl,); + self.client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { @@ -1676,17 +1684,19 @@ impl Client { &'a self, body: &'a types::InstanceStateMonitorRequest, ) -> Result, Error> { - let url = format!("{}/instance/state-monitor", self.baseurl,); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; + let mut request = { + let url = format!("{}/instance/state-monitor", self.baseurl,); + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/test_default_params_builder.rs b/progenitor-impl/tests/output/src/test_default_params_builder.rs index 5b347367..6c69a956 100644 --- a/progenitor-impl/tests/output/src/test_default_params_builder.rs +++ b/progenitor-impl/tests/output/src/test_default_params_builder.rs @@ -401,6 +401,42 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; + pub mod built { + use super::super::types; + #[allow(unused_imports)] + use super::super::{ + encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, + ResponseValue, + }; + pub struct DefaultParams<'a> { + pub(crate) client: &'a super::super::Client, + pub(crate) request: reqwest::RequestBuilder, + } + + impl<'a> DefaultParams<'a> { + pub async fn send(self) -> Result, Error> { + let Self { client, request } = self; + #[allow(unused_mut)] + let mut request = request.build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + pub fn map_request(self, f: F) -> Self + where + F: Fn(reqwest::RequestBuilder) -> reqwest::RequestBuilder, + { + Self { + client: self.client, + request: f(self.request), + } + } + } + } + ///Builder for [`Client::default_params`] /// ///[`Client::default_params`]: super::Client::default_params @@ -442,19 +478,22 @@ pub mod builder { ///Sends a `POST` request to `/` pub async fn send(self) -> Result, Error> { + self.build()?.send().await + } + + pub fn build(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(|v| types::BodyWithDefaults::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/", client.baseurl,); - #[allow(unused_mut)] - let mut request = client.client.post(url).json(&body).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200..=299 => Ok(ResponseValue::stream(response)), - _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), - } + let request = { + let url = format!("{}/", client.baseurl,); + client.client.post(url).json(&body) + }; + Ok(built::DefaultParams { + client: client, + request, + }) } } } diff --git a/progenitor-impl/tests/output/src/test_default_params_positional.rs b/progenitor-impl/tests/output/src/test_default_params_positional.rs index 2b8e6fe9..b05ca241 100644 --- a/progenitor-impl/tests/output/src/test_default_params_positional.rs +++ b/progenitor-impl/tests/output/src/test_default_params_positional.rs @@ -215,9 +215,13 @@ impl Client { &'a self, body: &'a types::BodyWithDefaults, ) -> Result, Error> { - let url = format!("{}/", self.baseurl,); #[allow(unused_mut)] - let mut request = self.client.post(url).json(&body).build()?; + let mut request = { + let url = format!("{}/", self.baseurl,); + self.client.post(url).json(&body) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/test_freeform_response.rs b/progenitor-impl/tests/output/src/test_freeform_response.rs index d3b053b5..d9e1c67c 100644 --- a/progenitor-impl/tests/output/src/test_freeform_response.rs +++ b/progenitor-impl/tests/output/src/test_freeform_response.rs @@ -147,9 +147,13 @@ impl Client { pub async fn freeform_response<'a>( &'a self, ) -> Result, Error> { - let url = format!("{}/", self.baseurl,); #[allow(unused_mut)] - let mut request = self.client.get(url).build()?; + let mut request = { + let url = format!("{}/", self.baseurl,); + self.client.get(url) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() { diff --git a/progenitor-impl/tests/output/src/test_renamed_parameters.rs b/progenitor-impl/tests/output/src/test_renamed_parameters.rs index feb3b081..fa8ad515 100644 --- a/progenitor-impl/tests/output/src/test_renamed_parameters.rs +++ b/progenitor-impl/tests/output/src/test_renamed_parameters.rs @@ -153,27 +153,29 @@ impl Client { in_: &'a str, use_: &'a str, ) -> Result, Error> { - let url = format!( - "{}/{}/{}/{}", - self.baseurl, - encode_path(&ref_.to_string()), - encode_path(&type_.to_string()), - encode_path(&trait_.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - query.push(("if", if_.to_string())); - query.push(("in", in_.to_string())); - query.push(("use", use_.to_string())); #[allow(unused_mut)] - let mut request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; + let mut request = { + let url = format!( + "{}/{}/{}/{}", + self.baseurl, + encode_path(&ref_.to_string()), + encode_path(&type_.to_string()), + encode_path(&trait_.to_string()), + ); + let mut query = Vec::with_capacity(3usize); + query.push(("if", if_.to_string())); + query.push(("in", in_.to_string())); + query.push(("use", use_.to_string())); + self.client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + } + + .build()?; let result = self.client.execute(request).await; let response = result?; match response.status().as_u16() {