From 03e2cfad3c4d637918b9e4a267f6a0ef426b0186 Mon Sep 17 00:00:00 2001 From: Adam Leventhal Date: Thu, 7 Jul 2022 18:35:36 -0700 Subject: [PATCH] add support for application/x-www-form-urlencoded bodies (#109) * add support for application/x-www-form-urlencoded bodies * self review * alphabetizing * remove commented code * update changelog --- CHANGELOG.adoc | 1 + Cargo.lock | 1 + progenitor-client/Cargo.toml | 1 + progenitor-client/src/progenitor_client.rs | 31 +- progenitor-impl/src/lib.rs | 28 +- progenitor-impl/src/method.rs | 329 +- .../tests/output/buildomat-builder-tagged.out | 16 +- .../tests/output/buildomat-builder.out | 16 +- .../tests/output/buildomat-positional.out | 12 +- .../tests/output/keeper-builder-tagged.out | 6 +- .../tests/output/keeper-builder.out | 6 +- .../tests/output/keeper-positional.out | 2 +- .../tests/output/nexus-builder-tagged.out | 4977 ++++++++++++----- .../tests/output/nexus-builder.out | 3928 ++++++++++--- .../tests/output/nexus-positional.out | 1730 +++++- .../tests/output/test_default_params.out | 2 +- .../tests/output/test_freeform_response.out | 2 +- .../tests/output/test_renamed_parameters.out | 2 +- progenitor/src/main.rs | 1 - progenitor/tests/build_nexus.rs | 6 +- sample_openapi/nexus.json | 2204 +++++++- 21 files changed, 10364 insertions(+), 2937 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 50d4df8..08344f1 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -16,6 +16,7 @@ https://github.com/oxidecomputer/progenitor/compare/v0.1.1\...HEAD[Full list of commits] * Add support for a builder-style generation in addition to the positional style (#86) +* Add support for body parameters with application/x-www-form-urlencoded media type (#109) == 0.1.1 (released 2022-05-13) diff --git a/Cargo.lock b/Cargo.lock index fcf30da..7e23d2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -975,6 +975,7 @@ dependencies = [ "reqwest", "serde", "serde_json", + "serde_urlencoded", ] [[package]] diff --git a/progenitor-client/Cargo.toml b/progenitor-client/Cargo.toml index 9996acd..bc712ae 100644 --- a/progenitor-client/Cargo.toml +++ b/progenitor-client/Cargo.toml @@ -13,3 +13,4 @@ percent-encoding = "2.1" reqwest = { version = "0.11", default-features = false, features = ["json", "stream"] } serde = "1.0" serde_json = "1.0" +serde_urlencoded = "0.7.1" diff --git a/progenitor-client/src/progenitor_client.rs b/progenitor-client/src/progenitor_client.rs index 51014fc..a4d3e76 100644 --- a/progenitor-client/src/progenitor_client.rs +++ b/progenitor-client/src/progenitor_client.rs @@ -11,7 +11,8 @@ use std::{ use bytes::Bytes; use futures_core::Stream; -use serde::de::DeserializeOwned; +use reqwest::RequestBuilder; +use serde::{de::DeserializeOwned, Serialize}; /// Represents an untyped byte stream for both success and error responses. pub type ByteStream = @@ -140,7 +141,7 @@ pub enum Error { /// The request did not conform to API requirements. InvalidRequest(String), - /// A server error either with the data, or with the connection. + /// A server error either due to the data, or with the connection. CommunicationError(reqwest::Error), /// A documented, expected error response. @@ -247,3 +248,29 @@ const PATH_SET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS pub fn encode_path(pc: &str) -> String { percent_encoding::utf8_percent_encode(pc, PATH_SET).to_string() } + +#[doc(hidden)] +pub trait RequestBuilderExt { + fn form_urlencoded( + self, + body: &T, + ) -> Result>; +} + +impl RequestBuilderExt for RequestBuilder { + fn form_urlencoded( + self, + body: &T, + ) -> Result> { + Ok(self + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static( + "application/x-www-form-urlencoded", + ), + ) + .body(serde_json::to_vec(&body).map_err(|_| { + Error::InvalidRequest("failed to serialize body".to_string()) + })?)) + } +} diff --git a/progenitor-impl/src/lib.rs b/progenitor-impl/src/lib.rs index 44820e6..bf974ce 100644 --- a/progenitor-impl/src/lib.rs +++ b/progenitor-impl/src/lib.rs @@ -24,7 +24,7 @@ pub enum Error { UnexpectedFormat(String), #[error("invalid operation path")] InvalidPath(String), - #[error("invalid operation path")] + #[error("internal error")] InternalError(String), } @@ -206,7 +206,7 @@ impl Generator { // public interface of Client. pub use progenitor_client::{ByteStream, Error, ResponseValue}; #[allow(unused_imports)] - use progenitor_client::encode_path; + use progenitor_client::{encode_path, RequestBuilderExt}; pub mod types { use serde::{Deserialize, Serialize}; @@ -254,7 +254,6 @@ impl Generator { pub fn client(&self) -> &reqwest::Client { &self.client } - } #operation_code @@ -301,9 +300,13 @@ impl Generator { pub mod builder { use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; - #[allow(unused_imports)] - use super::encode_path; + use super::{ + encode_path, + ByteStream, + Error, + RequestBuilderExt, + ResponseValue, + }; #(#builder_struct)* } @@ -329,9 +332,13 @@ impl Generator { pub mod builder { use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; - #[allow(unused_imports)] - use super::encode_path; + use super::{ + encode_path, + ByteStream, + Error, + RequestBuilderExt, + ResponseValue, + }; #(#builder_struct)* } @@ -391,8 +398,9 @@ impl Generator { "bytes = \"1.1.0\"", "futures-core = \"0.3.21\"", "percent-encoding = \"2.1\"", - "serde = { version = \"1.0\", features = [\"derive\"] }", "reqwest = { version = \"0.11\", features = [\"json\", \"stream\"] }", + "serde = { version = \"1.0\", features = [\"derive\"] }", + "serde_urlencoded = 0.7", ]; if self.type_space.uses_uuid() { deps.push( diff --git a/progenitor-impl/src/method.rs b/progenitor-impl/src/method.rs index 50ed518..f2c4386 100644 --- a/progenitor-impl/src/method.rs +++ b/progenitor-impl/src/method.rs @@ -27,7 +27,6 @@ pub(crate) struct OperationMethod { summary: Option, description: Option, params: Vec, - raw_body_param: bool, responses: Vec, dropshot_paginated: Option, } @@ -91,12 +90,6 @@ struct DropshotPagination { item: TypeId, } -#[derive(Debug, PartialEq, Eq)] -enum OperationParameterKind { - Path, - Query(bool), - Body, -} struct OperationParameter { /// Sanitized parameter name. name: String, @@ -112,6 +105,37 @@ enum OperationParameterType { Type(TypeId), RawBody, } + +#[derive(Debug, PartialEq, Eq)] +enum OperationParameterKind { + Path, + Query(bool), + Body(BodyContentType), +} + +#[derive(Debug, PartialEq, Eq)] +enum BodyContentType { + OctetStream, + Json, + FormUrlencoded, +} + +impl FromStr for BodyContentType { + type Err = Error; + + fn from_str(s: &str) -> Result { + match s { + "application/octet-stream" => Ok(Self::OctetStream), + "application/json" => Ok(Self::Json), + "application/x-www-form-urlencoded" => Ok(Self::FormUrlencoded), + _ => Err(Error::UnexpectedFormat(format!( + "unexpected content type: {}", + s + ))), + } + } +} + #[derive(Debug)] struct OperationResponse { status_code: OperationResponseStatus, @@ -313,44 +337,11 @@ impl Generator { } }) .collect::>>()?; - let mut raw_body_param = false; - if let Some(b) = &operation.request_body { - let b = b.item(components)?; - let typ = if b.is_binary(components)? { - raw_body_param = true; - OperationParameterType::RawBody - } else { - let mt = b.content_json()?; - if !mt.encoding.is_empty() { - todo!("media type encoding not empty: {:#?}", mt); - } - if let Some(s) = &mt.schema { - let schema = s.to_schema(); - let name = sanitize( - &format!( - "{}-body", - operation.operation_id.as_ref().unwrap(), - ), - Case::Pascal, - ); - let typ = self - .type_space - .add_type_with_name(&schema, Some(name))?; - OperationParameterType::Type(typ) - } else { - todo!("media type encoding, no schema: {:#?}", mt); - } - }; - - params.push(OperationParameter { - name: "body".to_string(), - api_name: "body".to_string(), - description: b.description.clone(), - typ, - kind: OperationParameterKind::Body, - }); + if let Some(body_param) = self.get_body_param(operation, components)? { + params.push(body_param); } + let tmp = crate::template::parse(path)?; let names = tmp.names(); @@ -472,7 +463,6 @@ impl Generator { .clone() .filter(|s| !s.is_empty()), params, - raw_body_param, responses, dropshot_paginated, }) @@ -506,7 +496,12 @@ impl Generator { }) .collect::>(); - let bounds = if method.raw_body_param { + let raw_body_param = method + .params + .iter() + .any(|param| param.typ == OperationParameterType::RawBody); + + let bounds = if raw_body_param { quote! { <'a, B: Into > } } else { quote! { <'a> } @@ -724,19 +719,44 @@ impl Generator { .collect(); let url_path = method.path.compile(url_renames, client.clone()); - // Generate code to handle the body... - let body_func = - method.params.iter().filter_map(|param| match ¶m.kind { - OperationParameterKind::Body => match ¶m.typ { - OperationParameterType::Type(_) => { - Some(quote! { .json(&body) }) - } - OperationParameterType::RawBody => { - Some(quote! { .body(body) }) - } - }, + // Generate code to handle the body param. + let body_func = method.params.iter().filter_map(|param| { + match (¶m.kind, ¶m.typ) { + ( + OperationParameterKind::Body(BodyContentType::OctetStream), + OperationParameterType::RawBody, + ) => Some(quote! { + // Set the content type (this is handled by helper + // functions for other MIME types). + .header( + reqwest::header::CONTENT_TYPE, + reqwest::header::HeaderValue::from_static("application/octet-stream"), + ) + .body(body) + }), + ( + OperationParameterKind::Body(BodyContentType::Json), + OperationParameterType::Type(_), + ) => Some(quote! { + // Serialization errors are deferred. + .json(&body) + }), + ( + OperationParameterKind::Body( + BodyContentType::FormUrlencoded, + ), + OperationParameterType::Type(_), + ) => Some(quote! { + // This uses progenitor_client::RequestBuilderExt which + // returns an error in the case of a serialization failure. + .form_urlencoded(&body)? + }), + (OperationParameterKind::Body(_), _) => { + unreachable!("invalid body kind/type combination") + } _ => None, - }); + } + }); // ... and there can be at most one body. assert!(body_func.clone().count() <= 1); @@ -1277,7 +1297,7 @@ impl Generator { .filter_map(|param| match param.kind { OperationParameterKind::Path | OperationParameterKind::Query(true) - | OperationParameterKind::Body => { + | OperationParameterKind::Body(_) => { Some(format_ident!("{}", param.name)) } OperationParameterKind::Query(false) => None, @@ -1655,6 +1675,100 @@ impl Generator { impl_body } + + fn get_body_param( + &mut self, + operation: &openapiv3::Operation, + components: &Option, + ) -> Result> { + let body = match &operation.request_body { + Some(body) => body.item(components)?, + None => return Ok(None), + }; + + let (content_str, media_type) = + match (body.content.first(), body.content.len()) { + (None, _) => return Ok(None), + (Some(first), 1) => first, + (_, n) => todo!("more media types than expected: {}", n), + }; + + let schema = media_type.schema.as_ref().ok_or_else(|| { + Error::UnexpectedFormat( + "No schema specified for request body".to_string(), + ) + })?; + + let content_type = BodyContentType::from_str(content_str)?; + + let typ = match content_type { + BodyContentType::OctetStream => { + // For an octet stream, we expect a simple, specific schema: + // "schema": { + // "type": "string", + // "format": "binary" + // } + match schema.item(components)? { + openapiv3::Schema { + schema_data: + openapiv3::SchemaData { + nullable: false, + discriminator: None, + default: None, + // Other fields that describe or document the + // schema are fine. + .. + }, + schema_kind: + openapiv3::SchemaKind::Type(openapiv3::Type::String( + openapiv3::StringType { + format: + openapiv3::VariantOrUnknownOrEmpty::Item( + openapiv3::StringFormat::Binary, + ), + pattern: None, + enumeration, + min_length: None, + max_length: None, + }, + )), + } if enumeration.is_empty() => Ok(()), + _ => Err(Error::UnexpectedFormat(format!( + "invalid schema for application/octet-stream: {:?}", + schema + ))), + }?; + OperationParameterType::RawBody + } + BodyContentType::Json | BodyContentType::FormUrlencoded => { + // TODO it would be legal to have the encoding field set for + // application/x-www-form-urlencoded content, but I'm not sure + // how to interpret the values. + if !media_type.encoding.is_empty() { + todo!("media type encoding not empty: {:#?}", media_type); + } + let name = sanitize( + &format!( + "{}-body", + operation.operation_id.as_ref().unwrap(), + ), + Case::Pascal, + ); + let typ = self + .type_space + .add_type_with_name(&schema.to_schema(), Some(name))?; + OperationParameterType::Type(typ) + } + }; + + Ok(Some(OperationParameter { + name: "body".to_string(), + api_name: "body".to_string(), + description: body.description.clone(), + typ, + kind: OperationParameterKind::Body(content_type), + })) + } } fn make_doc_comment(method: &OperationMethod) -> String { @@ -1810,13 +1924,13 @@ fn sort_params(raw_params: &mut [OperationParameter], names: &[String]) { ) => Ordering::Less, ( OperationParameterKind::Path, - OperationParameterKind::Body, + OperationParameterKind::Body(_), ) => Ordering::Less, // Query params are in lexicographic order. ( OperationParameterKind::Query(_), - OperationParameterKind::Body, + OperationParameterKind::Body(_), ) => Ordering::Less, ( OperationParameterKind::Query(_), @@ -1829,16 +1943,16 @@ fn sort_params(raw_params: &mut [OperationParameter], names: &[String]) { // Body params are last and should be singular. ( - OperationParameterKind::Body, + OperationParameterKind::Body(_), OperationParameterKind::Path, ) => Ordering::Greater, ( - OperationParameterKind::Body, + OperationParameterKind::Body(_), OperationParameterKind::Query(_), ) => Ordering::Greater, ( - OperationParameterKind::Body, - OperationParameterKind::Body, + OperationParameterKind::Body(_), + OperationParameterKind::Body(_), ) => { panic!("should only be one body") } @@ -1861,90 +1975,3 @@ impl ParameterDataExt for openapiv3::ParameterData { } } } - -// TODO do I want/need this? -trait ExtractJsonMediaType { - fn is_binary(&self, components: &Option) -> Result; - fn content_json(&self) -> Result; -} - -impl ExtractJsonMediaType for openapiv3::RequestBody { - fn content_json(&self) -> Result { - if self.content.len() != 1 { - todo!("expected one content entry, found {}", self.content.len()); - } - - if let Some(mt) = self.content.get("application/json") { - Ok(mt.clone()) - } else { - todo!( - "could not find application/json, only found {}", - self.content.keys().next().unwrap() - ); - } - } - - fn is_binary(&self, components: &Option) -> Result { - if self.content.is_empty() { - /* - * XXX If there are no content types, I guess it is not binary? - */ - return Ok(false); - } - - if self.content.len() != 1 { - todo!("expected one content entry, found {}", self.content.len()); - } - - if let Some(mt) = self.content.get("application/octet-stream") { - if !mt.encoding.is_empty() { - todo!("XXX encoding"); - } - - if let Some(s) = &mt.schema { - use openapiv3::{ - SchemaKind, StringFormat, Type, - VariantOrUnknownOrEmpty::Item, - }; - - let s = s.item(components)?; - if s.schema_data.nullable { - todo!("XXX nullable binary?"); - } - if s.schema_data.default.is_some() { - todo!("XXX default binary?"); - } - if s.schema_data.discriminator.is_some() { - todo!("XXX binary discriminator?"); - } - match &s.schema_kind { - SchemaKind::Type(Type::String(st)) => { - if st.min_length.is_some() || st.max_length.is_some() { - todo!("binary min/max length"); - } - if !matches!(st.format, Item(StringFormat::Binary)) { - todo!( - "expected binary format string, got {:?}", - st.format - ); - } - if st.pattern.is_some() { - todo!("XXX pattern"); - } - if !st.enumeration.is_empty() { - todo!("XXX enumeration"); - } - return Ok(true); - } - x => { - todo!("XXX schemakind type {:?}", x); - } - } - } else { - todo!("binary thing had no schema?"); - } - } - - Ok(false) - } -} diff --git a/progenitor-impl/tests/output/buildomat-builder-tagged.out b/progenitor-impl/tests/output/buildomat-builder-tagged.out index 6d8d4e6..65c0424 100644 --- a/progenitor-impl/tests/output/buildomat-builder-tagged.out +++ b/progenitor-impl/tests/output/buildomat-builder-tagged.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -365,11 +365,9 @@ impl Client { } pub mod builder { - #[allow(unused_imports)] - use super::encode_path; use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; + use super::{encode_path, ByteStream, Error, RequestBuilderExt, ResponseValue}; ///Builder for [`Client::control_hold`] /// ///[`Client::control_hold`]: super::Client::control_hold @@ -994,7 +992,15 @@ pub mod builder { client.baseurl, encode_path(&task.to_string()), ); - let request = client.client.post(url).body(body).build()?; + let 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() { diff --git a/progenitor-impl/tests/output/buildomat-builder.out b/progenitor-impl/tests/output/buildomat-builder.out index d1f3d00..a46e5de 100644 --- a/progenitor-impl/tests/output/buildomat-builder.out +++ b/progenitor-impl/tests/output/buildomat-builder.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -365,11 +365,9 @@ impl Client { } pub mod builder { - #[allow(unused_imports)] - use super::encode_path; use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; + use super::{encode_path, ByteStream, Error, RequestBuilderExt, ResponseValue}; ///Builder for [`Client::control_hold`] /// ///[`Client::control_hold`]: super::Client::control_hold @@ -994,7 +992,15 @@ pub mod builder { client.baseurl, encode_path(&task.to_string()), ); - let request = client.client.post(url).body(body).build()?; + let 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() { diff --git a/progenitor-impl/tests/output/buildomat-positional.out b/progenitor-impl/tests/output/buildomat-positional.out index badf83b..4338f56 100644 --- a/progenitor-impl/tests/output/buildomat-positional.out +++ b/progenitor-impl/tests/output/buildomat-positional.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -388,7 +388,15 @@ impl Client { self.baseurl, encode_path(&task.to_string()), ); - let request = self.client.post(url).body(body).build()?; + let request = 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() { diff --git a/progenitor-impl/tests/output/keeper-builder-tagged.out b/progenitor-impl/tests/output/keeper-builder-tagged.out index 4719912..cae14fe 100644 --- a/progenitor-impl/tests/output/keeper-builder-tagged.out +++ b/progenitor-impl/tests/output/keeper-builder-tagged.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -173,11 +173,9 @@ impl Client { } pub mod builder { - #[allow(unused_imports)] - use super::encode_path; use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; + use super::{encode_path, ByteStream, Error, RequestBuilderExt, ResponseValue}; ///Builder for [`Client::enrol`] /// ///[`Client::enrol`]: super::Client::enrol diff --git a/progenitor-impl/tests/output/keeper-builder.out b/progenitor-impl/tests/output/keeper-builder.out index 99710ed..13869d9 100644 --- a/progenitor-impl/tests/output/keeper-builder.out +++ b/progenitor-impl/tests/output/keeper-builder.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -173,11 +173,9 @@ impl Client { } pub mod builder { - #[allow(unused_imports)] - use super::encode_path; use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; + use super::{encode_path, ByteStream, Error, RequestBuilderExt, ResponseValue}; ///Builder for [`Client::enrol`] /// ///[`Client::enrol`]: super::Client::enrol diff --git a/progenitor-impl/tests/output/keeper-positional.out b/progenitor-impl/tests/output/keeper-positional.out index 9fb0fac..cbfe253 100644 --- a/progenitor-impl/tests/output/keeper-positional.out +++ b/progenitor-impl/tests/output/keeper-positional.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; diff --git a/progenitor-impl/tests/output/nexus-builder-tagged.out b/progenitor-impl/tests/output/nexus-builder-tagged.out index 86c048b..aed8767 100644 --- a/progenitor-impl/tests/output/nexus-builder-tagged.out +++ b/progenitor-impl/tests/output/nexus-builder-tagged.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -78,6 +78,31 @@ pub mod types { } } + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DerEncodedKeyPair { + ///request signing private key (base64 encoded der file) + pub private_key: String, + ///request signing public certificate (base64 encoded der file) + pub public_cert: String, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DeviceAccessTokenRequest { + pub client_id: uuid::Uuid, + pub device_code: String, + pub grant_type: String, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DeviceAuthRequest { + pub client_id: uuid::Uuid, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DeviceAuthVerify { + pub user_code: String, + } + #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Digest { #[serde(rename = "type")] @@ -99,7 +124,7 @@ pub mod types { } } - ///Client view of an [`Disk`] + ///Client view of a [`Disk`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Disk { pub block_size: ByteCount, @@ -197,6 +222,15 @@ pub mod types { Faulted, } + ///OS image distribution + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct Distribution { + ///The name of the distribution (e.g. "alpine" or "ubuntu") + pub name: Name, + ///The version of the distribution (e.g. "3.10" or "18.04") + pub version: String, + } + ///Error information from a response. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Error { @@ -260,7 +294,7 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum FleetRoles { + pub enum FleetRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -269,12 +303,12 @@ pub mod types { Viewer, } - impl ToString for FleetRoles { + impl ToString for FleetRole { fn to_string(&self) -> String { match *self { - FleetRoles::Admin => "admin".to_string(), - FleetRoles::Collaborator => "collaborator".to_string(), - FleetRoles::Viewer => "viewer".to_string(), + FleetRole::Admin => "admin".to_string(), + FleetRole::Collaborator => "collaborator".to_string(), + FleetRole::Viewer => "viewer".to_string(), } } } @@ -286,9 +320,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct FleetRolesPolicy { + pub struct FleetRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -298,10 +332,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct FleetRolesRoleAssignment { + pub struct FleetRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: FleetRoles, + pub role_name: FleetRole, } ///Client view of global Images @@ -314,6 +348,8 @@ pub mod types { ///Hash of the image contents, if applicable #[serde(default, skip_serializing_if = "Option::is_none")] pub digest: Option, + ///Image distribution + pub distribution: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource @@ -327,9 +363,22 @@ pub mod types { ///URL source of this image, if any #[serde(default, skip_serializing_if = "Option::is_none")] pub url: Option, - ///Version of this, if any - #[serde(default, skip_serializing_if = "Option::is_none")] - pub version: Option, + ///Image version + pub version: String, + } + + ///Create-time parameters for an + /// [`GlobalImage`](omicron_common::api::external::GlobalImage) + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct GlobalImageCreate { + ///block size in bytes + pub block_size: BlockSize, + pub description: String, + ///OS image distribution + pub distribution: Distribution, + pub name: Name, + ///The source of the image's contents. + pub source: ImageSource, } ///A single page of results @@ -359,6 +408,47 @@ pub mod types { } } + ///Client view of an [`IdentityProvider`] + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IdentityProvider { + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///Identity provider type + pub provider_type: IdentityProviderType, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IdentityProviderResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] + pub enum IdentityProviderType { + #[serde(rename = "saml")] + Saml, + } + + impl ToString for IdentityProviderType { + fn to_string(&self) -> String { + match *self { + IdentityProviderType::Saml => "saml".to_string(), + } + } + } + ///Describes what kind of identity is described by an id #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] pub enum IdentityType { @@ -374,6 +464,15 @@ pub mod types { } } + #[derive(Serialize, Deserialize, Debug, Clone)] + #[serde(tag = "type")] + pub enum IdpMetadataSource { + #[serde(rename = "url")] + Url { url: String }, + #[serde(rename = "base64_encoded_xml")] + Base64EncodedXml { data: String }, + } + ///Client view of project Images #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Image { @@ -428,12 +527,14 @@ pub mod types { ///The source of the underlying image. #[derive(Serialize, Deserialize, Debug, Clone)] - #[serde(tag = "type", content = "src")] + #[serde(tag = "type")] pub enum ImageSource { #[serde(rename = "url")] - Url(String), + Url { url: String }, #[serde(rename = "snapshot")] - Snapshot(uuid::Uuid), + Snapshot { id: uuid::Uuid }, + #[serde(rename = "you_can_boot_anything_as_long_as_its_alpine")] + YouCanBootAnythingAsLongAsItsAlpine, } ///Client view of an [`Instance`] @@ -523,7 +624,7 @@ pub mod types { /// [`Instance`](omicron_common::api::external::Instance) #[derive(Serialize, Deserialize, Debug, Clone)] pub struct InstanceMigrate { - pub dst_sled_uuid: uuid::Uuid, + pub dst_sled_id: uuid::Uuid, } ///Describes an attachment of a `NetworkInterface` to an `Instance`, at the @@ -531,7 +632,10 @@ pub mod types { #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(tag = "type", content = "params")] pub enum InstanceNetworkInterfaceAttachment { - ///Create one or more `NetworkInterface`s for the `Instance` + ///Create one or more `NetworkInterface`s for the `Instance`. + /// + ///If more than one interface is provided, then the first will be + /// designated the primary interface for the instance. #[serde(rename = "create")] Create(Vec), #[serde(rename = "default")] @@ -550,6 +654,18 @@ pub mod types { pub next_page: Option, } + ///Contents of an Instance's serial console buffer. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct InstanceSerialConsoleData { + ///The bytes starting from the requested offset up to either the end of + /// the buffer or the request's `max_bytes`. Provided as a u8 array + /// rather than a string, as it may not be UTF-8. + pub data: Vec, + ///The absolute offset since boot (suitable for use as `byte_offset` in + /// a subsequent request) of the last byte returned in `data`. + pub last_byte_offset: u64, + } + ///Running state of an Instance (primarily: booted or stopped) /// ///This typically reflects whether it's starting, running, stopping, or @@ -602,6 +718,74 @@ pub mod types { V6(Ipv6Net), } + ///Identity-related metadata that's included in nearly all public API + /// objects + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPool { + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///Create-time parameters for an IP Pool. + /// + ///See [`IpPool`](omicron_nexus::external_api::views::IpPool) + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolCreate { + pub description: String, + pub name: Name, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolRange { + pub id: uuid::Uuid, + pub range: IpRange, + pub time_created: chrono::DateTime, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolRangeResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///Parameters for updating an IP Pool + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + #[serde(untagged)] + pub enum IpRange { + V4(Ipv4Range), + V6(Ipv6Range), + } + ///An IPv4 subnet, including prefix and subnet mask #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Ipv4Net(pub String); @@ -612,6 +796,15 @@ pub mod types { } } + ///A non-decreasing IPv4 address range, inclusive of both ends. + /// + ///The first address must be less than or equal to the last address. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct Ipv4Range { + pub first: std::net::Ipv4Addr, + pub last: std::net::Ipv4Addr, + } + ///An IPv6 subnet, including prefix and subnet mask #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Ipv6Net(pub String); @@ -622,6 +815,15 @@ pub mod types { } } + ///A non-decreasing IPv6 address range, inclusive of both ends. + /// + ///The first address must be less than or equal to the last address. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct Ipv6Range { + pub first: std::net::Ipv6Addr, + pub last: std::net::Ipv6Addr, + } + ///An inclusive-inclusive range of IP ports. The second port may be omitted /// to represent a single port #[derive(Serialize, Deserialize, Debug, Clone)] @@ -633,11 +835,6 @@ pub mod types { } } - #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct LoginParams { - pub username: String, - } - ///A Media Access Control address, in EUI-48 format #[derive(Serialize, Deserialize, Debug, Clone)] pub struct MacAddr(pub String); @@ -713,6 +910,9 @@ pub mod types { pub mac: MacAddr, ///unique, mutable, user-controlled identifier for each resource pub name: Name, + ///True if this interface is the primary for the instance to which it's + /// attached. + pub primary: bool, ///The subnet to which the interface belongs. pub subnet_id: uuid::Uuid, ///timestamp when this resource was created @@ -749,6 +949,41 @@ pub mod types { pub next_page: Option, } + ///Parameters for updating a + /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface). + /// + ///Note that modifying IP addresses for an interface is not yet supported, + /// a new interface must be created instead. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct NetworkInterfaceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + ///Make a secondary interface the instance's primary interface. + /// + ///If applied to a secondary interface, that interface will become the + /// primary on the next reboot of the instance. Note that this may have + /// implications for routing between instances, as the new primary + /// interface will be on a distinct subnet from the previous primary + /// interface. + /// + ///Note that this can only be used to select a new primary interface + /// for an instance. Requests to change the primary interface into a + /// secondary will return an error. + #[serde(default)] + pub make_primary: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] + pub enum Null {} + + impl ToString for Null { + fn to_string(&self) -> String { + match *self {} + } + } + ///Client view of an [`Organization`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Organization { @@ -783,18 +1018,21 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum OrganizationRoles { + pub enum OrganizationRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, + #[serde(rename = "viewer")] + Viewer, } - impl ToString for OrganizationRoles { + impl ToString for OrganizationRole { fn to_string(&self) -> String { match *self { - OrganizationRoles::Admin => "admin".to_string(), - OrganizationRoles::Collaborator => "collaborator".to_string(), + OrganizationRole::Admin => "admin".to_string(), + OrganizationRole::Collaborator => "collaborator".to_string(), + OrganizationRole::Viewer => "viewer".to_string(), } } } @@ -806,9 +1044,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct OrganizationRolesPolicy { + pub struct OrganizationRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -818,10 +1056,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct OrganizationRolesRoleAssignment { + pub struct OrganizationRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: OrganizationRoles, + pub role_name: OrganizationRole, } ///Updateable properties of an @@ -869,7 +1107,7 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum ProjectRoles { + pub enum ProjectRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -878,12 +1116,12 @@ pub mod types { Viewer, } - impl ToString for ProjectRoles { + impl ToString for ProjectRole { fn to_string(&self) -> String { match *self { - ProjectRoles::Admin => "admin".to_string(), - ProjectRoles::Collaborator => "collaborator".to_string(), - ProjectRoles::Viewer => "viewer".to_string(), + ProjectRole::Admin => "admin".to_string(), + ProjectRole::Collaborator => "collaborator".to_string(), + ProjectRole::Viewer => "viewer".to_string(), } } } @@ -895,9 +1133,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct ProjectRolesPolicy { + pub struct ProjectRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -907,10 +1145,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct ProjectRolesRoleAssignment { + pub struct ProjectRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: ProjectRoles, + pub role_name: ProjectRole, } ///Updateable properties of a @@ -926,12 +1164,8 @@ pub mod types { ///Client view of an [`Rack`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Rack { - ///human-readable free-form text about a resource - pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, - ///unique, mutable, user-controlled identifier for each resource - pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified @@ -1145,6 +1379,58 @@ pub mod types { }, } + ///Identity-related metadata that's included in nearly all public API + /// objects + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct SamlIdentityProvider { + ///service provider endpoint where the response will be sent + pub acs_url: String, + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///idp's entity id + pub idp_entity_id: String, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///optional request signing public certificate (base64 encoded der + /// file) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public_cert: Option, + ///service provider endpoint where the idp should send log out requests + pub slo_url: String, + ///sp's client id + pub sp_client_id: String, + ///customer's technical contact for saml configuration + pub technical_contact_email: String, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///Create-time identity-related parameters + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct SamlIdentityProviderCreate { + ///service provider endpoint where the response will be sent + pub acs_url: String, + pub description: String, + ///idp's entity id + pub idp_entity_id: String, + ///the source of an identity provider metadata descriptor + pub idp_metadata_source: IdpMetadataSource, + pub name: Name, + ///optional request signing key pair + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signing_keypair: Option, + ///service provider endpoint where the idp should send log out requests + pub slo_url: String, + ///sp's client id + pub sp_client_id: String, + ///customer's technical contact for saml configuration + pub technical_contact_email: String, + } + ///Client view of currently authed user. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct SessionUser { @@ -1167,6 +1453,8 @@ pub mod types { pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, + ///User provision type + pub user_provision_type: UserProvisionType, } ///Create-time parameters for a [`Silo`](crate::external_api::views::Silo) @@ -1175,6 +1463,7 @@ pub mod types { pub description: String, pub discoverable: bool, pub name: Name, + pub user_provision_type: UserProvisionType, } ///A single page of results @@ -1188,7 +1477,7 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum SiloRoles { + pub enum SiloRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -1197,12 +1486,12 @@ pub mod types { Viewer, } - impl ToString for SiloRoles { + impl ToString for SiloRole { fn to_string(&self) -> String { match *self { - SiloRoles::Admin => "admin".to_string(), - SiloRoles::Collaborator => "collaborator".to_string(), - SiloRoles::Viewer => "viewer".to_string(), + SiloRole::Admin => "admin".to_string(), + SiloRole::Collaborator => "collaborator".to_string(), + SiloRole::Viewer => "viewer".to_string(), } } } @@ -1214,9 +1503,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct SiloRolesPolicy { + pub struct SiloRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -1226,21 +1515,17 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct SiloRolesRoleAssignment { + pub struct SiloRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: SiloRoles, + pub role_name: SiloRole, } ///Client view of an [`Sled`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Sled { - ///human-readable free-form text about a resource - pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, - ///unique, mutable, user-controlled identifier for each resource - pub name: Name, pub service_address: String, ///timestamp when this resource was created pub time_created: chrono::DateTime, @@ -1296,6 +1581,11 @@ pub mod types { pub next_page: Option, } + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct SpoofLoginBody { + pub username: String, + } + ///Client view of a [`SshKey`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct SshKey { @@ -1372,6 +1662,14 @@ pub mod types { ///Client view of a [`User`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct User { + ///Human-readable name that can identify the user + pub display_name: String, + pub id: uuid::Uuid, + } + + ///Client view of a [`UserBuiltin`] + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct UserBuiltin { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource @@ -1384,6 +1682,34 @@ pub mod types { pub time_modified: chrono::DateTime, } + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct UserBuiltinResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///How users will be provisioned in a silo during authentication. + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] + pub enum UserProvisionType { + #[serde(rename = "fixed")] + Fixed, + #[serde(rename = "jit")] + Jit, + } + + impl ToString for UserProvisionType { + fn to_string(&self) -> String { + match *self { + UserProvisionType::Fixed => "fixed".to_string(), + UserProvisionType::Jit => "jit".to_string(), + } + } + } + ///A single page of results #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UserResultsPage { @@ -1823,12 +2149,12 @@ pub trait ClientDisksExt { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_disks_get() + /// let response = client.disk_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -1837,7 +2163,7 @@ pub trait ClientDisksExt { /// .send() /// .await; /// ``` - fn project_disks_get(&self) -> builder::ProjectDisksGet; + fn disk_list(&self) -> builder::DiskList; ///Create a disk in a project /// ///Sends a `POST` request to @@ -1849,101 +2175,190 @@ pub trait ClientDisksExt { /// - `body` /// ///```ignore - /// let response = client.project_disks_post() + /// let response = client.disk_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn project_disks_post(&self) -> builder::ProjectDisksPost; + fn disk_create(&self) -> builder::DiskCreate; ///Fetch a single disk in a project /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` ```ignore - /// let response = client.project_disks_get_disk() + /// let response = client.disk_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .send() /// .await; /// ``` - fn project_disks_get_disk(&self) -> builder::ProjectDisksGetDisk; + fn disk_view(&self) -> builder::DiskView; ///Delete a disk from a project /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` ```ignore - /// let response = client.project_disks_delete_disk() + /// let response = client.disk_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .send() /// .await; /// ``` - fn project_disks_delete_disk(&self) -> builder::ProjectDisksDeleteDisk; + fn disk_delete(&self) -> builder::DiskDelete; } impl ClientDisksExt for Client { - fn project_disks_get(&self) -> builder::ProjectDisksGet { - builder::ProjectDisksGet::new(self) + fn disk_list(&self) -> builder::DiskList { + builder::DiskList::new(self) } - fn project_disks_post(&self) -> builder::ProjectDisksPost { - builder::ProjectDisksPost::new(self) + fn disk_create(&self) -> builder::DiskCreate { + builder::DiskCreate::new(self) } - fn project_disks_get_disk(&self) -> builder::ProjectDisksGetDisk { - builder::ProjectDisksGetDisk::new(self) + fn disk_view(&self) -> builder::DiskView { + builder::DiskView::new(self) } - fn project_disks_delete_disk(&self) -> builder::ProjectDisksDeleteDisk { - builder::ProjectDisksDeleteDisk::new(self) + fn disk_delete(&self) -> builder::DiskDelete { + builder::DiskDelete::new(self) } } -pub trait ClientFirewallExt { - ///List firewall rules for a VPC +pub trait ClientHardwareExt { + ///List racks in the system /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/firewall/rules` ```ignore - /// let response = client.vpc_firewall_rules_get() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) + ///Sends a `GET` request to `/hardware/racks` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.rack_list() + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn vpc_firewall_rules_get(&self) -> builder::VpcFirewallRulesGet; - ///Replace the firewall rules for a VPC + fn rack_list(&self) -> builder::RackList; + ///Fetch information about a particular rack /// - ///Sends a `PUT` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/firewall/rules` ```ignore - /// let response = client.vpc_firewall_rules_put() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .body(body) + ///Sends a `GET` request to `/hardware/racks/{rack_id}` + /// + ///Arguments: + /// - `rack_id`: The rack's unique ID. + /// + ///```ignore + /// let response = client.rack_view() + /// .rack_id(rack_id) /// .send() /// .await; /// ``` - fn vpc_firewall_rules_put(&self) -> builder::VpcFirewallRulesPut; + fn rack_view(&self) -> builder::RackView; + ///List sleds in the system + /// + ///Sends a `GET` request to `/hardware/sleds` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.sled_list() + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn sled_list(&self) -> builder::SledList; + ///Fetch information about a sled in the system + /// + ///Sends a `GET` request to `/hardware/sleds/{sled_id}` + /// + ///Arguments: + /// - `sled_id`: The sled's unique ID. + /// + ///```ignore + /// let response = client.sled_view() + /// .sled_id(sled_id) + /// .send() + /// .await; + /// ``` + fn sled_view(&self) -> builder::SledView; } -impl ClientFirewallExt for Client { - fn vpc_firewall_rules_get(&self) -> builder::VpcFirewallRulesGet { - builder::VpcFirewallRulesGet::new(self) +impl ClientHardwareExt for Client { + fn rack_list(&self) -> builder::RackList { + builder::RackList::new(self) } - fn vpc_firewall_rules_put(&self) -> builder::VpcFirewallRulesPut { - builder::VpcFirewallRulesPut::new(self) + fn rack_view(&self) -> builder::RackView { + builder::RackView::new(self) + } + + fn sled_list(&self) -> builder::SledList { + builder::SledList::new(self) + } + + fn sled_view(&self) -> builder::SledView { + builder::SledView::new(self) } } pub trait ClientHiddenExt { + ///Start an OAuth 2.0 Device Authorization Grant + /// + ///This endpoint is designed to be accessed from an *unauthenticated* API + /// client. It generates and records a `device_code` and `user_code` which + /// must be verified and confirmed prior to a token being granted. + /// + ///Sends a `POST` request to `/device/auth` + ///```ignore + /// let response = client.device_auth_request() + /// .body(body) + /// .send() + /// .await; + /// ``` + fn device_auth_request(&self) -> builder::DeviceAuthRequest; + ///Confirm an OAuth 2.0 Device Authorization Grant + /// + ///This endpoint is designed to be accessed by the user agent (browser), + /// not the client requesting the token. So we do not actually return the + /// token here; it will be returned in response to the poll on + /// `/device/token`. + /// + ///Sends a `POST` request to `/device/confirm` + ///```ignore + /// let response = client.device_auth_confirm() + /// .body(body) + /// .send() + /// .await; + /// ``` + fn device_auth_confirm(&self) -> builder::DeviceAuthConfirm; + ///Request a device access token + /// + ///This endpoint should be polled by the client until the user code is + /// verified and the grant is confirmed. + /// + ///Sends a `POST` request to `/device/token` + ///```ignore + /// let response = client.device_access_token() + /// .body(body) + /// .send() + /// .await; + /// ``` + fn device_access_token(&self) -> builder::DeviceAccessToken; ///Sends a `POST` request to `/login` ///```ignore /// let response = client.spoof_login() @@ -1971,6 +2386,18 @@ pub trait ClientHiddenExt { } impl ClientHiddenExt for Client { + fn device_auth_request(&self) -> builder::DeviceAuthRequest { + builder::DeviceAuthRequest::new(self) + } + + fn device_auth_confirm(&self) -> builder::DeviceAuthConfirm { + builder::DeviceAuthConfirm::new(self) + } + + fn device_access_token(&self) -> builder::DeviceAccessToken { + builder::DeviceAccessToken::new(self) + } + fn spoof_login(&self) -> builder::SpoofLogin { builder::SpoofLogin::new(self) } @@ -1997,12 +2424,12 @@ pub trait ClientImagesExt { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_images_get() + /// let response = client.image_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2011,7 +2438,7 @@ pub trait ClientImagesExt { /// .send() /// .await; /// ``` - fn project_images_get(&self) -> builder::ProjectImagesGet; + fn image_list(&self) -> builder::ImageList; ///Create an image /// ///Create a new image in a project. @@ -2025,14 +2452,14 @@ pub trait ClientImagesExt { /// - `body` /// ///```ignore - /// let response = client.project_images_post() + /// let response = client.image_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn project_images_post(&self) -> builder::ProjectImagesPost; + fn image_create(&self) -> builder::ImageCreate; ///Get an image /// ///Get the details of a specific image in a project. @@ -2040,14 +2467,14 @@ pub trait ClientImagesExt { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` ```ignore - /// let response = client.project_images_get_image() + /// let response = client.image_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .image_name(image_name) /// .send() /// .await; /// ``` - fn project_images_get_image(&self) -> builder::ProjectImagesGetImage; + fn image_view(&self) -> builder::ImageView; ///Delete an image /// ///Permanently delete an image from a project. This operation cannot be @@ -2057,31 +2484,31 @@ pub trait ClientImagesExt { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` ```ignore - /// let response = client.project_images_delete_image() + /// let response = client.image_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .image_name(image_name) /// .send() /// .await; /// ``` - fn project_images_delete_image(&self) -> builder::ProjectImagesDeleteImage; + fn image_delete(&self) -> builder::ImageDelete; } impl ClientImagesExt for Client { - fn project_images_get(&self) -> builder::ProjectImagesGet { - builder::ProjectImagesGet::new(self) + fn image_list(&self) -> builder::ImageList { + builder::ImageList::new(self) } - fn project_images_post(&self) -> builder::ProjectImagesPost { - builder::ProjectImagesPost::new(self) + fn image_create(&self) -> builder::ImageCreate { + builder::ImageCreate::new(self) } - fn project_images_get_image(&self) -> builder::ProjectImagesGetImage { - builder::ProjectImagesGetImage::new(self) + fn image_view(&self) -> builder::ImageView { + builder::ImageView::new(self) } - fn project_images_delete_image(&self) -> builder::ProjectImagesDeleteImage { - builder::ProjectImagesDeleteImage::new(self) + fn image_delete(&self) -> builder::ImageDelete { + builder::ImageDelete::new(self) } } @@ -2095,19 +2522,19 @@ pub trait ClientImagesGlobalExt { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.images_get() + /// let response = client.image_global_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn images_get(&self) -> builder::ImagesGet; + fn image_global_list(&self) -> builder::ImageGlobalList; ///Create a global image /// ///Create a new global image. This image can then be used by any user as a @@ -2115,24 +2542,24 @@ pub trait ClientImagesGlobalExt { /// ///Sends a `POST` request to `/images` ///```ignore - /// let response = client.images_post() + /// let response = client.image_global_create() /// .body(body) /// .send() /// .await; /// ``` - fn images_post(&self) -> builder::ImagesPost; + fn image_global_create(&self) -> builder::ImageGlobalCreate; ///Get a global image /// ///Returns the details of a specific global image. /// ///Sends a `GET` request to `/images/{image_name}` ///```ignore - /// let response = client.images_get_image() + /// let response = client.image_global_view() /// .image_name(image_name) /// .send() /// .await; /// ``` - fn images_get_image(&self) -> builder::ImagesGetImage; + fn image_global_view(&self) -> builder::ImageGlobalView; ///Delete a global image /// ///Permanently delete a global image. This operation cannot be undone. Any @@ -2141,29 +2568,29 @@ pub trait ClientImagesGlobalExt { /// ///Sends a `DELETE` request to `/images/{image_name}` ///```ignore - /// let response = client.images_delete_image() + /// let response = client.image_global_delete() /// .image_name(image_name) /// .send() /// .await; /// ``` - fn images_delete_image(&self) -> builder::ImagesDeleteImage; + fn image_global_delete(&self) -> builder::ImageGlobalDelete; } impl ClientImagesGlobalExt for Client { - fn images_get(&self) -> builder::ImagesGet { - builder::ImagesGet::new(self) + fn image_global_list(&self) -> builder::ImageGlobalList { + builder::ImageGlobalList::new(self) } - fn images_post(&self) -> builder::ImagesPost { - builder::ImagesPost::new(self) + fn image_global_create(&self) -> builder::ImageGlobalCreate { + builder::ImageGlobalCreate::new(self) } - fn images_get_image(&self) -> builder::ImagesGetImage { - builder::ImagesGetImage::new(self) + fn image_global_view(&self) -> builder::ImageGlobalView { + builder::ImageGlobalView::new(self) } - fn images_delete_image(&self) -> builder::ImagesDeleteImage { - builder::ImagesDeleteImage::new(self) + fn image_global_delete(&self) -> builder::ImageGlobalDelete { + builder::ImageGlobalDelete::new(self) } } @@ -2177,12 +2604,12 @@ pub trait ClientInstancesExt { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_instances_get() + /// let response = client.instance_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2191,7 +2618,7 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn project_instances_get(&self) -> builder::ProjectInstancesGet; + fn instance_list(&self) -> builder::InstanceList; ///Create an instance in a project /// ///Sends a `POST` request to @@ -2203,40 +2630,40 @@ pub trait ClientInstancesExt { /// - `body` /// ///```ignore - /// let response = client.project_instances_post() + /// let response = client.instance_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn project_instances_post(&self) -> builder::ProjectInstancesPost; + fn instance_create(&self) -> builder::InstanceCreate; ///Get an instance in a project /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` ```ignore - /// let response = client.project_instances_get_instance() + /// let response = client.instance_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - fn project_instances_get_instance(&self) -> builder::ProjectInstancesGetInstance; + fn instance_view(&self) -> builder::InstanceView; ///Delete an instance from a project /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` ```ignore - /// let response = client.project_instances_delete_instance() + /// let response = client.instance_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - fn project_instances_delete_instance(&self) -> builder::ProjectInstancesDeleteInstance; + fn instance_delete(&self) -> builder::InstanceDelete; ///List disks attached to this instance /// ///Sends a `GET` request to @@ -2248,12 +2675,12 @@ pub trait ClientInstancesExt { /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.instance_disks_get() + /// let response = client.instance_disk_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2263,11 +2690,11 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_disks_get(&self) -> builder::InstanceDisksGet; + fn instance_disk_list(&self) -> builder::InstanceDiskList; ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/attach` ```ignore - /// let response = client.instance_disks_attach() + /// let response = client.instance_disk_attach() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2275,11 +2702,11 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_disks_attach(&self) -> builder::InstanceDisksAttach; + fn instance_disk_attach(&self) -> builder::InstanceDiskAttach; ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/detach` ```ignore - /// let response = client.instance_disks_detach() + /// let response = client.instance_disk_detach() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2287,14 +2714,14 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_disks_detach(&self) -> builder::InstanceDisksDetach; + fn instance_disk_detach(&self) -> builder::InstanceDiskDetach; ///Migrate an instance to a different propolis-server, possibly on a /// different sled /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/migrate` ```ignore - /// let response = client.project_instances_migrate_instance() + /// let response = client.instance_migrate() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2302,7 +2729,7 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn project_instances_migrate_instance(&self) -> builder::ProjectInstancesMigrateInstance; + fn instance_migrate(&self) -> builder::InstanceMigrate; ///List network interfaces attached to this instance /// ///Sends a `GET` request to @@ -2314,12 +2741,12 @@ pub trait ClientInstancesExt { /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.instance_network_interfaces_get() + /// let response = client.instance_network_interface_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2329,13 +2756,13 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_network_interfaces_get(&self) -> builder::InstanceNetworkInterfacesGet; + fn instance_network_interface_list(&self) -> builder::InstanceNetworkInterfaceList; ///Create a network interface for an instance /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces` ```ignore - /// let response = client.instance_network_interfaces_post() + /// let response = client.instance_network_interface_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2343,13 +2770,13 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_network_interfaces_post(&self) -> builder::InstanceNetworkInterfacesPost; + fn instance_network_interface_create(&self) -> builder::InstanceNetworkInterfaceCreate; ///Get an interface attached to an instance /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore - /// let response = client.instance_network_interfaces_get_interface() + /// let response = client.instance_network_interface_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2357,15 +2784,33 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_network_interfaces_get_interface( - &self, - ) -> builder::InstanceNetworkInterfacesGetInterface; + fn instance_network_interface_view(&self) -> builder::InstanceNetworkInterfaceView; + ///Update information about an instance's network interface + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/instances/ + /// {instance_name}/network-interfaces/{interface_name}` ```ignore + /// let response = client.instance_network_interface_update() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .instance_name(instance_name) + /// .interface_name(interface_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn instance_network_interface_update(&self) -> builder::InstanceNetworkInterfaceUpdate; ///Detach a network interface from an instance /// + ///Note that the primary interface for an instance cannot be deleted if + /// there are any secondary interfaces. A new primary interface must be + /// designated first. The primary interface can be deleted if there are no + /// secondary interfaces. + /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore - /// let response = client.instance_network_interfaces_delete_interface() + /// let response = client.instance_network_interface_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2373,113 +2818,332 @@ pub trait ClientInstancesExt { /// .send() /// .await; /// ``` - fn instance_network_interfaces_delete_interface( - &self, - ) -> builder::InstanceNetworkInterfacesDeleteInterface; + fn instance_network_interface_delete(&self) -> builder::InstanceNetworkInterfaceDelete; ///Reboot an instance /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/reboot` ```ignore - /// let response = client.project_instances_instance_reboot() + /// let response = client.instance_reboot() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - fn project_instances_instance_reboot(&self) -> builder::ProjectInstancesInstanceReboot; + fn instance_reboot(&self) -> builder::InstanceReboot; + ///Get contents of an instance's serial console + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/instances/ + /// {instance_name}/serial-console` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `instance_name` + /// - `from_start`: Character index in the serial buffer from which to read, + /// counting the bytes output since instance start. If this is not + /// provided, `most_recent` must be provided, and if this *is* provided, + /// `most_recent` must *not* be provided. + /// - `max_bytes`: Maximum number of bytes of buffered serial console + /// contents to return. If the requested range runs to the end of the + /// available buffer, the data returned will be shorter than `max_bytes`. + /// - `most_recent`: Character index in the serial buffer from which to + /// read, counting *backward* from the most recently buffered data + /// retrieved from the instance. (See note on `from_start` about mutual + /// exclusivity) + /// + ///```ignore + /// let response = client.instance_serial_console() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .instance_name(instance_name) + /// .from_start(from_start) + /// .max_bytes(max_bytes) + /// .most_recent(most_recent) + /// .send() + /// .await; + /// ``` + fn instance_serial_console(&self) -> builder::InstanceSerialConsole; ///Boot an instance /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/start` ```ignore - /// let response = client.project_instances_instance_start() + /// let response = client.instance_start() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - fn project_instances_instance_start(&self) -> builder::ProjectInstancesInstanceStart; + fn instance_start(&self) -> builder::InstanceStart; ///Halt an instance /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/stop` ```ignore - /// let response = client.project_instances_instance_stop() + /// let response = client.instance_stop() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - fn project_instances_instance_stop(&self) -> builder::ProjectInstancesInstanceStop; + fn instance_stop(&self) -> builder::InstanceStop; } impl ClientInstancesExt for Client { - fn project_instances_get(&self) -> builder::ProjectInstancesGet { - builder::ProjectInstancesGet::new(self) + fn instance_list(&self) -> builder::InstanceList { + builder::InstanceList::new(self) } - fn project_instances_post(&self) -> builder::ProjectInstancesPost { - builder::ProjectInstancesPost::new(self) + fn instance_create(&self) -> builder::InstanceCreate { + builder::InstanceCreate::new(self) } - fn project_instances_get_instance(&self) -> builder::ProjectInstancesGetInstance { - builder::ProjectInstancesGetInstance::new(self) + fn instance_view(&self) -> builder::InstanceView { + builder::InstanceView::new(self) } - fn project_instances_delete_instance(&self) -> builder::ProjectInstancesDeleteInstance { - builder::ProjectInstancesDeleteInstance::new(self) + fn instance_delete(&self) -> builder::InstanceDelete { + builder::InstanceDelete::new(self) } - fn instance_disks_get(&self) -> builder::InstanceDisksGet { - builder::InstanceDisksGet::new(self) + fn instance_disk_list(&self) -> builder::InstanceDiskList { + builder::InstanceDiskList::new(self) } - fn instance_disks_attach(&self) -> builder::InstanceDisksAttach { - builder::InstanceDisksAttach::new(self) + fn instance_disk_attach(&self) -> builder::InstanceDiskAttach { + builder::InstanceDiskAttach::new(self) } - fn instance_disks_detach(&self) -> builder::InstanceDisksDetach { - builder::InstanceDisksDetach::new(self) + fn instance_disk_detach(&self) -> builder::InstanceDiskDetach { + builder::InstanceDiskDetach::new(self) } - fn project_instances_migrate_instance(&self) -> builder::ProjectInstancesMigrateInstance { - builder::ProjectInstancesMigrateInstance::new(self) + fn instance_migrate(&self) -> builder::InstanceMigrate { + builder::InstanceMigrate::new(self) } - fn instance_network_interfaces_get(&self) -> builder::InstanceNetworkInterfacesGet { - builder::InstanceNetworkInterfacesGet::new(self) + fn instance_network_interface_list(&self) -> builder::InstanceNetworkInterfaceList { + builder::InstanceNetworkInterfaceList::new(self) } - fn instance_network_interfaces_post(&self) -> builder::InstanceNetworkInterfacesPost { - builder::InstanceNetworkInterfacesPost::new(self) + fn instance_network_interface_create(&self) -> builder::InstanceNetworkInterfaceCreate { + builder::InstanceNetworkInterfaceCreate::new(self) } - fn instance_network_interfaces_get_interface( - &self, - ) -> builder::InstanceNetworkInterfacesGetInterface { - builder::InstanceNetworkInterfacesGetInterface::new(self) + fn instance_network_interface_view(&self) -> builder::InstanceNetworkInterfaceView { + builder::InstanceNetworkInterfaceView::new(self) } - fn instance_network_interfaces_delete_interface( - &self, - ) -> builder::InstanceNetworkInterfacesDeleteInterface { - builder::InstanceNetworkInterfacesDeleteInterface::new(self) + fn instance_network_interface_update(&self) -> builder::InstanceNetworkInterfaceUpdate { + builder::InstanceNetworkInterfaceUpdate::new(self) } - fn project_instances_instance_reboot(&self) -> builder::ProjectInstancesInstanceReboot { - builder::ProjectInstancesInstanceReboot::new(self) + fn instance_network_interface_delete(&self) -> builder::InstanceNetworkInterfaceDelete { + builder::InstanceNetworkInterfaceDelete::new(self) } - fn project_instances_instance_start(&self) -> builder::ProjectInstancesInstanceStart { - builder::ProjectInstancesInstanceStart::new(self) + fn instance_reboot(&self) -> builder::InstanceReboot { + builder::InstanceReboot::new(self) } - fn project_instances_instance_stop(&self) -> builder::ProjectInstancesInstanceStop { - builder::ProjectInstancesInstanceStop::new(self) + fn instance_serial_console(&self) -> builder::InstanceSerialConsole { + builder::InstanceSerialConsole::new(self) + } + + fn instance_start(&self) -> builder::InstanceStart { + builder::InstanceStart::new(self) + } + + fn instance_stop(&self) -> builder::InstanceStop { + builder::InstanceStop::new(self) + } +} + +pub trait ClientIpPoolsExt { + ///List IP Pools + /// + ///Sends a `GET` request to `/ip-pools` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.ip_pool_list() + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn ip_pool_list(&self) -> builder::IpPoolList; + ///Create a new IP Pool + /// + ///Sends a `POST` request to `/ip-pools` + ///```ignore + /// let response = client.ip_pool_create() + /// .body(body) + /// .send() + /// .await; + /// ``` + fn ip_pool_create(&self) -> builder::IpPoolCreate; + ///Fetch a single IP Pool + /// + ///Sends a `GET` request to `/ip-pools/{pool_name}` + ///```ignore + /// let response = client.ip_pool_view() + /// .pool_name(pool_name) + /// .send() + /// .await; + /// ``` + fn ip_pool_view(&self) -> builder::IpPoolView; + ///Update an IP Pool + /// + ///Sends a `PUT` request to `/ip-pools/{pool_name}` + ///```ignore + /// let response = client.ip_pool_update() + /// .pool_name(pool_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn ip_pool_update(&self) -> builder::IpPoolUpdate; + ///Delete an IP Pool + /// + ///Sends a `DELETE` request to `/ip-pools/{pool_name}` + ///```ignore + /// let response = client.ip_pool_delete() + /// .pool_name(pool_name) + /// .send() + /// .await; + /// ``` + fn ip_pool_delete(&self) -> builder::IpPoolDelete; + ///List the ranges of IP addresses within an existing IP Pool + /// + ///Note that ranges are listed sorted by their first address. + /// + ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` + /// + ///Arguments: + /// - `pool_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// + ///```ignore + /// let response = client.ip_pool_range_list() + /// .pool_name(pool_name) + /// .limit(limit) + /// .page_token(page_token) + /// .send() + /// .await; + /// ``` + fn ip_pool_range_list(&self) -> builder::IpPoolRangeList; + ///Add a new range to an existing IP Pool + /// + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/add` + ///```ignore + /// let response = client.ip_pool_range_add() + /// .pool_name(pool_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn ip_pool_range_add(&self) -> builder::IpPoolRangeAdd; + ///Remove a range from an existing IP Pool + /// + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/remove` + ///```ignore + /// let response = client.ip_pool_range_remove() + /// .pool_name(pool_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn ip_pool_range_remove(&self) -> builder::IpPoolRangeRemove; +} + +impl ClientIpPoolsExt for Client { + fn ip_pool_list(&self) -> builder::IpPoolList { + builder::IpPoolList::new(self) + } + + fn ip_pool_create(&self) -> builder::IpPoolCreate { + builder::IpPoolCreate::new(self) + } + + fn ip_pool_view(&self) -> builder::IpPoolView { + builder::IpPoolView::new(self) + } + + fn ip_pool_update(&self) -> builder::IpPoolUpdate { + builder::IpPoolUpdate::new(self) + } + + fn ip_pool_delete(&self) -> builder::IpPoolDelete { + builder::IpPoolDelete::new(self) + } + + fn ip_pool_range_list(&self) -> builder::IpPoolRangeList { + builder::IpPoolRangeList::new(self) + } + + fn ip_pool_range_add(&self) -> builder::IpPoolRangeAdd { + builder::IpPoolRangeAdd::new(self) + } + + fn ip_pool_range_remove(&self) -> builder::IpPoolRangeRemove { + builder::IpPoolRangeRemove::new(self) + } +} + +pub trait ClientLoginExt { + ///Ask the user to login to their identity provider + /// + ///Either display a page asking a user for their credentials, or redirect + /// them to their identity provider. + /// + ///Sends a `GET` request to `/login/{silo_name}/{provider_name}` + ///```ignore + /// let response = client.login() + /// .silo_name(silo_name) + /// .provider_name(provider_name) + /// .send() + /// .await; + /// ``` + fn login(&self) -> builder::Login; + ///Consume some sort of credentials, and authenticate a user + /// + ///Either receive a username and password, or some sort of identity + /// provider data (like a SAMLResponse). Use these to set the user's session + /// cookie. + /// + ///Sends a `POST` request to `/login/{silo_name}/{provider_name}` + ///```ignore + /// let response = client.consume_credentials() + /// .silo_name(silo_name) + /// .provider_name(provider_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn consume_credentials(&self) -> builder::ConsumeCredentials; +} + +impl ClientLoginExt for Client { + fn login(&self) -> builder::Login { + builder::Login::new(self) + } + + fn consume_credentials(&self) -> builder::ConsumeCredentials { + builder::ConsumeCredentials::new(self) } } @@ -2490,7 +3154,7 @@ pub trait ClientMetricsExt { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// ///```ignore @@ -2516,29 +3180,29 @@ pub trait ClientOrganizationsExt { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.organizations_get() + /// let response = client.organization_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn organizations_get(&self) -> builder::OrganizationsGet; + fn organization_list(&self) -> builder::OrganizationList; ///Create a new organization /// ///Sends a `POST` request to `/organizations` ///```ignore - /// let response = client.organizations_post() + /// let response = client.organization_create() /// .body(body) /// .send() /// .await; /// ``` - fn organizations_post(&self) -> builder::OrganizationsPost; + fn organization_create(&self) -> builder::OrganizationCreate; ///Fetch a specific organization /// ///Sends a `GET` request to `/organizations/{organization_name}` @@ -2547,12 +3211,12 @@ pub trait ClientOrganizationsExt { /// - `organization_name`: The organization's unique name. /// ///```ignore - /// let response = client.organizations_get_organization() + /// let response = client.organization_view() /// .organization_name(organization_name) /// .send() /// .await; /// ``` - fn organizations_get_organization(&self) -> builder::OrganizationsGetOrganization; + fn organization_view(&self) -> builder::OrganizationView; ///Update a specific organization /// ///Sends a `PUT` request to `/organizations/{organization_name}` @@ -2562,13 +3226,13 @@ pub trait ClientOrganizationsExt { /// - `body` /// ///```ignore - /// let response = client.organizations_put_organization() + /// let response = client.organization_update() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` - fn organizations_put_organization(&self) -> builder::OrganizationsPutOrganization; + fn organization_update(&self) -> builder::OrganizationUpdate; ///Delete a specific organization /// ///Sends a `DELETE` request to `/organizations/{organization_name}` @@ -2577,12 +3241,12 @@ pub trait ClientOrganizationsExt { /// - `organization_name`: The organization's unique name. /// ///```ignore - /// let response = client.organizations_delete_organization() + /// let response = client.organization_delete() /// .organization_name(organization_name) /// .send() /// .await; /// ``` - fn organizations_delete_organization(&self) -> builder::OrganizationsDeleteOrganization; + fn organization_delete(&self) -> builder::OrganizationDelete; ///Fetch the IAM policy for this Organization /// ///Sends a `GET` request to `/organizations/{organization_name}/policy` @@ -2591,12 +3255,12 @@ pub trait ClientOrganizationsExt { /// - `organization_name`: The organization's unique name. /// ///```ignore - /// let response = client.organization_get_policy() + /// let response = client.organization_policy_view() /// .organization_name(organization_name) /// .send() /// .await; /// ``` - fn organization_get_policy(&self) -> builder::OrganizationGetPolicy; + fn organization_policy_view(&self) -> builder::OrganizationPolicyView; ///Update the IAM policy for this Organization /// ///Sends a `PUT` request to `/organizations/{organization_name}/policy` @@ -2606,42 +3270,42 @@ pub trait ClientOrganizationsExt { /// - `body` /// ///```ignore - /// let response = client.organization_put_policy() + /// let response = client.organization_policy_update() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` - fn organization_put_policy(&self) -> builder::OrganizationPutPolicy; + fn organization_policy_update(&self) -> builder::OrganizationPolicyUpdate; } impl ClientOrganizationsExt for Client { - fn organizations_get(&self) -> builder::OrganizationsGet { - builder::OrganizationsGet::new(self) + fn organization_list(&self) -> builder::OrganizationList { + builder::OrganizationList::new(self) } - fn organizations_post(&self) -> builder::OrganizationsPost { - builder::OrganizationsPost::new(self) + fn organization_create(&self) -> builder::OrganizationCreate { + builder::OrganizationCreate::new(self) } - fn organizations_get_organization(&self) -> builder::OrganizationsGetOrganization { - builder::OrganizationsGetOrganization::new(self) + fn organization_view(&self) -> builder::OrganizationView { + builder::OrganizationView::new(self) } - fn organizations_put_organization(&self) -> builder::OrganizationsPutOrganization { - builder::OrganizationsPutOrganization::new(self) + fn organization_update(&self) -> builder::OrganizationUpdate { + builder::OrganizationUpdate::new(self) } - fn organizations_delete_organization(&self) -> builder::OrganizationsDeleteOrganization { - builder::OrganizationsDeleteOrganization::new(self) + fn organization_delete(&self) -> builder::OrganizationDelete { + builder::OrganizationDelete::new(self) } - fn organization_get_policy(&self) -> builder::OrganizationGetPolicy { - builder::OrganizationGetPolicy::new(self) + fn organization_policy_view(&self) -> builder::OrganizationPolicyView { + builder::OrganizationPolicyView::new(self) } - fn organization_put_policy(&self) -> builder::OrganizationPutPolicy { - builder::OrganizationPutPolicy::new(self) + fn organization_policy_update(&self) -> builder::OrganizationPolicyUpdate { + builder::OrganizationPolicyUpdate::new(self) } } @@ -2650,30 +3314,30 @@ pub trait ClientPolicyExt { /// ///Sends a `GET` request to `/policy` ///```ignore - /// let response = client.policy_get() + /// let response = client.policy_view() /// .send() /// .await; /// ``` - fn policy_get(&self) -> builder::PolicyGet; + fn policy_view(&self) -> builder::PolicyView; ///Update the top-level IAM policy /// ///Sends a `PUT` request to `/policy` ///```ignore - /// let response = client.policy_put() + /// let response = client.policy_update() /// .body(body) /// .send() /// .await; /// ``` - fn policy_put(&self) -> builder::PolicyPut; + fn policy_update(&self) -> builder::PolicyUpdate; } impl ClientPolicyExt for Client { - fn policy_get(&self) -> builder::PolicyGet { - builder::PolicyGet::new(self) + fn policy_view(&self) -> builder::PolicyView { + builder::PolicyView::new(self) } - fn policy_put(&self) -> builder::PolicyPut { - builder::PolicyPut::new(self) + fn policy_update(&self) -> builder::PolicyUpdate { + builder::PolicyUpdate::new(self) } } @@ -2685,12 +3349,12 @@ pub trait ClientProjectsExt { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.organization_projects_get() + /// let response = client.project_list() /// .organization_name(organization_name) /// .limit(limit) /// .page_token(page_token) @@ -2698,7 +3362,7 @@ pub trait ClientProjectsExt { /// .send() /// .await; /// ``` - fn organization_projects_get(&self) -> builder::OrganizationProjectsGet; + fn project_list(&self) -> builder::ProjectList; ///Create a new project /// ///Sends a `POST` request to `/organizations/{organization_name}/projects` @@ -2708,13 +3372,13 @@ pub trait ClientProjectsExt { /// - `body` /// ///```ignore - /// let response = client.organization_projects_post() + /// let response = client.project_create() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` - fn organization_projects_post(&self) -> builder::OrganizationProjectsPost; + fn project_create(&self) -> builder::ProjectCreate; ///Fetch a specific project /// ///Sends a `GET` request to @@ -2725,13 +3389,13 @@ pub trait ClientProjectsExt { /// - `project_name`: The project's unique name within the organization. /// ///```ignore - /// let response = client.organization_projects_get_project() + /// let response = client.project_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` - fn organization_projects_get_project(&self) -> builder::OrganizationProjectsGetProject; + fn project_view(&self) -> builder::ProjectView; ///Update a specific project /// ///Sends a `PUT` request to @@ -2743,14 +3407,14 @@ pub trait ClientProjectsExt { /// - `body` /// ///```ignore - /// let response = client.organization_projects_put_project() + /// let response = client.project_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn organization_projects_put_project(&self) -> builder::OrganizationProjectsPutProject; + fn project_update(&self) -> builder::ProjectUpdate; ///Delete a specific project /// ///Sends a `DELETE` request to @@ -2761,13 +3425,13 @@ pub trait ClientProjectsExt { /// - `project_name`: The project's unique name within the organization. /// ///```ignore - /// let response = client.organization_projects_delete_project() + /// let response = client.project_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` - fn organization_projects_delete_project(&self) -> builder::OrganizationProjectsDeleteProject; + fn project_delete(&self) -> builder::ProjectDelete; ///Fetch the IAM policy for this Project /// ///Sends a `GET` request to @@ -2778,15 +3442,13 @@ pub trait ClientProjectsExt { /// - `project_name`: The project's unique name within the organization. /// ///```ignore - /// let response = client.organization_projects_get_project_policy() + /// let response = client.project_policy_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` - fn organization_projects_get_project_policy( - &self, - ) -> builder::OrganizationProjectsGetProjectPolicy; + fn project_policy_view(&self) -> builder::ProjectPolicyView; ///Update the IAM policy for this Project /// ///Sends a `PUT` request to @@ -2798,95 +3460,43 @@ pub trait ClientProjectsExt { /// - `body` /// ///```ignore - /// let response = client.organization_projects_put_project_policy() + /// let response = client.project_policy_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn organization_projects_put_project_policy( - &self, - ) -> builder::OrganizationProjectsPutProjectPolicy; + fn project_policy_update(&self) -> builder::ProjectPolicyUpdate; } impl ClientProjectsExt for Client { - fn organization_projects_get(&self) -> builder::OrganizationProjectsGet { - builder::OrganizationProjectsGet::new(self) + fn project_list(&self) -> builder::ProjectList { + builder::ProjectList::new(self) } - fn organization_projects_post(&self) -> builder::OrganizationProjectsPost { - builder::OrganizationProjectsPost::new(self) + fn project_create(&self) -> builder::ProjectCreate { + builder::ProjectCreate::new(self) } - fn organization_projects_get_project(&self) -> builder::OrganizationProjectsGetProject { - builder::OrganizationProjectsGetProject::new(self) + fn project_view(&self) -> builder::ProjectView { + builder::ProjectView::new(self) } - fn organization_projects_put_project(&self) -> builder::OrganizationProjectsPutProject { - builder::OrganizationProjectsPutProject::new(self) + fn project_update(&self) -> builder::ProjectUpdate { + builder::ProjectUpdate::new(self) } - fn organization_projects_delete_project(&self) -> builder::OrganizationProjectsDeleteProject { - builder::OrganizationProjectsDeleteProject::new(self) + fn project_delete(&self) -> builder::ProjectDelete { + builder::ProjectDelete::new(self) } - fn organization_projects_get_project_policy( - &self, - ) -> builder::OrganizationProjectsGetProjectPolicy { - builder::OrganizationProjectsGetProjectPolicy::new(self) + fn project_policy_view(&self) -> builder::ProjectPolicyView { + builder::ProjectPolicyView::new(self) } - fn organization_projects_put_project_policy( - &self, - ) -> builder::OrganizationProjectsPutProjectPolicy { - builder::OrganizationProjectsPutProjectPolicy::new(self) - } -} - -pub trait ClientRacksExt { - ///List racks in the system - /// - ///Sends a `GET` request to `/hardware/racks` - /// - ///Arguments: - /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the - /// subsequent page - /// - `sort_by` - /// - ///```ignore - /// let response = client.hardware_racks_get() - /// .limit(limit) - /// .page_token(page_token) - /// .sort_by(sort_by) - /// .send() - /// .await; - /// ``` - fn hardware_racks_get(&self) -> builder::HardwareRacksGet; - ///Fetch information about a particular rack - /// - ///Sends a `GET` request to `/hardware/racks/{rack_id}` - /// - ///Arguments: - /// - `rack_id`: The rack's unique ID. - /// - ///```ignore - /// let response = client.hardware_racks_get_rack() - /// .rack_id(rack_id) - /// .send() - /// .await; - /// ``` - fn hardware_racks_get_rack(&self) -> builder::HardwareRacksGetRack; -} - -impl ClientRacksExt for Client { - fn hardware_racks_get(&self) -> builder::HardwareRacksGet { - builder::HardwareRacksGet::new(self) - } - - fn hardware_racks_get_rack(&self) -> builder::HardwareRacksGetRack { - builder::HardwareRacksGetRack::new(self) + fn project_policy_update(&self) -> builder::ProjectPolicyUpdate { + builder::ProjectPolicyUpdate::new(self) } } @@ -2897,17 +3507,17 @@ pub trait ClientRolesExt { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// ///```ignore - /// let response = client.roles_get() + /// let response = client.role_list() /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` - fn roles_get(&self) -> builder::RolesGet; + fn role_list(&self) -> builder::RoleList; ///Fetch a specific built-in role /// ///Sends a `GET` request to `/roles/{role_name}` @@ -2916,245 +3526,21 @@ pub trait ClientRolesExt { /// - `role_name`: The built-in role's unique name. /// ///```ignore - /// let response = client.roles_get_role() + /// let response = client.role_view() /// .role_name(role_name) /// .send() /// .await; /// ``` - fn roles_get_role(&self) -> builder::RolesGetRole; + fn role_view(&self) -> builder::RoleView; } impl ClientRolesExt for Client { - fn roles_get(&self) -> builder::RolesGet { - builder::RolesGet::new(self) + fn role_list(&self) -> builder::RoleList { + builder::RoleList::new(self) } - fn roles_get_role(&self) -> builder::RolesGetRole { - builder::RolesGetRole::new(self) - } -} - -pub trait ClientRoutersExt { - ///List VPC Custom and System Routers - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers` - /// - ///Arguments: - /// - `organization_name` - /// - `project_name` - /// - `vpc_name` - /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the - /// subsequent page - /// - `sort_by` - /// - ///```ignore - /// let response = client.vpc_routers_get() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .limit(limit) - /// .page_token(page_token) - /// .sort_by(sort_by) - /// .send() - /// .await; - /// ``` - fn vpc_routers_get(&self) -> builder::VpcRoutersGet; - ///Create a VPC Router - /// - ///Sends a `POST` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers` ```ignore - /// let response = client.vpc_routers_post() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn vpc_routers_post(&self) -> builder::VpcRoutersPost; - ///Get a VPC Router - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}` ```ignore - /// let response = client.vpc_routers_get_router() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .send() - /// .await; - /// ``` - fn vpc_routers_get_router(&self) -> builder::VpcRoutersGetRouter; - ///Update a VPC Router - /// - ///Sends a `PUT` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}` ```ignore - /// let response = client.vpc_routers_put_router() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn vpc_routers_put_router(&self) -> builder::VpcRoutersPutRouter; - ///Delete a router from its VPC - /// - ///Sends a `DELETE` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}` ```ignore - /// let response = client.vpc_routers_delete_router() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .send() - /// .await; - /// ``` - fn vpc_routers_delete_router(&self) -> builder::VpcRoutersDeleteRouter; -} - -impl ClientRoutersExt for Client { - fn vpc_routers_get(&self) -> builder::VpcRoutersGet { - builder::VpcRoutersGet::new(self) - } - - fn vpc_routers_post(&self) -> builder::VpcRoutersPost { - builder::VpcRoutersPost::new(self) - } - - fn vpc_routers_get_router(&self) -> builder::VpcRoutersGetRouter { - builder::VpcRoutersGetRouter::new(self) - } - - fn vpc_routers_put_router(&self) -> builder::VpcRoutersPutRouter { - builder::VpcRoutersPutRouter::new(self) - } - - fn vpc_routers_delete_router(&self) -> builder::VpcRoutersDeleteRouter { - builder::VpcRoutersDeleteRouter::new(self) - } -} - -pub trait ClientRoutesExt { - ///List a Router's routes - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}/routes` - /// - ///Arguments: - /// - `organization_name` - /// - `project_name` - /// - `vpc_name` - /// - `router_name` - /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the - /// subsequent page - /// - `sort_by` - /// - ///```ignore - /// let response = client.routers_routes_get() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .limit(limit) - /// .page_token(page_token) - /// .sort_by(sort_by) - /// .send() - /// .await; - /// ``` - fn routers_routes_get(&self) -> builder::RoutersRoutesGet; - ///Create a VPC Router - /// - ///Sends a `POST` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}/routes` ```ignore - /// let response = client.routers_routes_post() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn routers_routes_post(&self) -> builder::RoutersRoutesPost; - ///Get a VPC Router route - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore - /// let response = client.routers_routes_get_route() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .route_name(route_name) - /// .send() - /// .await; - /// ``` - fn routers_routes_get_route(&self) -> builder::RoutersRoutesGetRoute; - ///Update a Router route - /// - ///Sends a `PUT` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore - /// let response = client.routers_routes_put_route() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .route_name(route_name) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn routers_routes_put_route(&self) -> builder::RoutersRoutesPutRoute; - ///Delete a route from its router - /// - ///Sends a `DELETE` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore - /// let response = client.routers_routes_delete_route() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .router_name(router_name) - /// .route_name(route_name) - /// .send() - /// .await; - /// ``` - fn routers_routes_delete_route(&self) -> builder::RoutersRoutesDeleteRoute; -} - -impl ClientRoutesExt for Client { - fn routers_routes_get(&self) -> builder::RoutersRoutesGet { - builder::RoutersRoutesGet::new(self) - } - - fn routers_routes_post(&self) -> builder::RoutersRoutesPost { - builder::RoutersRoutesPost::new(self) - } - - fn routers_routes_get_route(&self) -> builder::RoutersRoutesGetRoute { - builder::RoutersRoutesGetRoute::new(self) - } - - fn routers_routes_put_route(&self) -> builder::RoutersRoutesPutRoute { - builder::RoutersRoutesPutRoute::new(self) - } - - fn routers_routes_delete_route(&self) -> builder::RoutersRoutesDeleteRoute { - builder::RoutersRoutesDeleteRoute::new(self) + fn role_view(&self) -> builder::RoleView { + builder::RoleView::new(self) } } @@ -3165,38 +3551,108 @@ pub trait ClientSagasExt { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.sagas_get() + /// let response = client.saga_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn sagas_get(&self) -> builder::SagasGet; + fn saga_list(&self) -> builder::SagaList; ///Fetch information about a single saga (for debugging) /// ///Sends a `GET` request to `/sagas/{saga_id}` ///```ignore - /// let response = client.sagas_get_saga() + /// let response = client.saga_view() /// .saga_id(saga_id) /// .send() /// .await; /// ``` - fn sagas_get_saga(&self) -> builder::SagasGetSaga; + fn saga_view(&self) -> builder::SagaView; } impl ClientSagasExt for Client { - fn sagas_get(&self) -> builder::SagasGet { - builder::SagasGet::new(self) + fn saga_list(&self) -> builder::SagaList { + builder::SagaList::new(self) } - fn sagas_get_saga(&self) -> builder::SagasGetSaga { - builder::SagasGetSaga::new(self) + fn saga_view(&self) -> builder::SagaView { + builder::SagaView::new(self) + } +} + +pub trait ClientSessionExt { + ///List the current user's SSH public keys + /// + ///Sends a `GET` request to `/session/me/sshkeys` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.session_sshkey_list() + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn session_sshkey_list(&self) -> builder::SessionSshkeyList; + ///Create a new SSH public key for the current user + /// + ///Sends a `POST` request to `/session/me/sshkeys` + ///```ignore + /// let response = client.session_sshkey_create() + /// .body(body) + /// .send() + /// .await; + /// ``` + fn session_sshkey_create(&self) -> builder::SessionSshkeyCreate; + ///Get (by name) an SSH public key belonging to the current user + /// + ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` + ///```ignore + /// let response = client.session_sshkey_view() + /// .ssh_key_name(ssh_key_name) + /// .send() + /// .await; + /// ``` + fn session_sshkey_view(&self) -> builder::SessionSshkeyView; + ///Delete (by name) an SSH public key belonging to the current user + /// + ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` + ///```ignore + /// let response = client.session_sshkey_delete() + /// .ssh_key_name(ssh_key_name) + /// .send() + /// .await; + /// ``` + fn session_sshkey_delete(&self) -> builder::SessionSshkeyDelete; +} + +impl ClientSessionExt for Client { + fn session_sshkey_list(&self) -> builder::SessionSshkeyList { + builder::SessionSshkeyList::new(self) + } + + fn session_sshkey_create(&self) -> builder::SessionSshkeyCreate { + builder::SessionSshkeyCreate::new(self) + } + + fn session_sshkey_view(&self) -> builder::SessionSshkeyView { + builder::SessionSshkeyView::new(self) + } + + fn session_sshkey_delete(&self) -> builder::SessionSshkeyDelete { + builder::SessionSshkeyDelete::new(self) } } @@ -3205,29 +3661,29 @@ pub trait ClientSilosExt { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.silos_get() + /// let response = client.silo_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn silos_get(&self) -> builder::SilosGet; + fn silo_list(&self) -> builder::SiloList; ///Create a new silo /// ///Sends a `POST` request to `/silos` ///```ignore - /// let response = client.silos_post() + /// let response = client.silo_create() /// .body(body) /// .send() /// .await; /// ``` - fn silos_post(&self) -> builder::SilosPost; + fn silo_create(&self) -> builder::SiloCreate; ///Fetch a specific silo /// ///Sends a `GET` request to `/silos/{silo_name}` @@ -3236,12 +3692,12 @@ pub trait ClientSilosExt { /// - `silo_name`: The silo's unique name. /// ///```ignore - /// let response = client.silos_get_silo() + /// let response = client.silo_view() /// .silo_name(silo_name) /// .send() /// .await; /// ``` - fn silos_get_silo(&self) -> builder::SilosGetSilo; + fn silo_view(&self) -> builder::SiloView; ///Delete a specific silo /// ///Sends a `DELETE` request to `/silos/{silo_name}` @@ -3250,12 +3706,33 @@ pub trait ClientSilosExt { /// - `silo_name`: The silo's unique name. /// ///```ignore - /// let response = client.silos_delete_silo() + /// let response = client.silo_delete() /// .silo_name(silo_name) /// .send() /// .await; /// ``` - fn silos_delete_silo(&self) -> builder::SilosDeleteSilo; + fn silo_delete(&self) -> builder::SiloDelete; + ///List Silo identity providers + /// + ///Sends a `GET` request to `/silos/{silo_name}/identity_providers` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.silo_identity_provider_list() + /// .silo_name(silo_name) + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn silo_identity_provider_list(&self) -> builder::SiloIdentityProviderList; ///Fetch the IAM policy for this Silo /// ///Sends a `GET` request to `/silos/{silo_name}/policy` @@ -3264,12 +3741,12 @@ pub trait ClientSilosExt { /// - `silo_name`: The silo's unique name. /// ///```ignore - /// let response = client.silos_get_silo_policy() + /// let response = client.silo_policy_view() /// .silo_name(silo_name) /// .send() /// .await; /// ``` - fn silos_get_silo_policy(&self) -> builder::SilosGetSiloPolicy; + fn silo_policy_view(&self) -> builder::SiloPolicyView; ///Update the IAM policy for this Silo /// ///Sends a `PUT` request to `/silos/{silo_name}/policy` @@ -3279,84 +3756,106 @@ pub trait ClientSilosExt { /// - `body` /// ///```ignore - /// let response = client.silos_put_silo_policy() + /// let response = client.silo_policy_update() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` - fn silos_put_silo_policy(&self) -> builder::SilosPutSiloPolicy; -} - -impl ClientSilosExt for Client { - fn silos_get(&self) -> builder::SilosGet { - builder::SilosGet::new(self) - } - - fn silos_post(&self) -> builder::SilosPost { - builder::SilosPost::new(self) - } - - fn silos_get_silo(&self) -> builder::SilosGetSilo { - builder::SilosGetSilo::new(self) - } - - fn silos_delete_silo(&self) -> builder::SilosDeleteSilo { - builder::SilosDeleteSilo::new(self) - } - - fn silos_get_silo_policy(&self) -> builder::SilosGetSiloPolicy { - builder::SilosGetSiloPolicy::new(self) - } - - fn silos_put_silo_policy(&self) -> builder::SilosPutSiloPolicy { - builder::SilosPutSiloPolicy::new(self) - } -} - -pub trait ClientSledsExt { - ///List sleds in the system + fn silo_policy_update(&self) -> builder::SiloPolicyUpdate; + ///Create a new SAML identity provider for a silo /// - ///Sends a `GET` request to `/hardware/sleds` + ///Sends a `POST` request to `/silos/{silo_name}/saml_identity_providers` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `body` + /// + ///```ignore + /// let response = client.silo_identity_provider_create() + /// .silo_name(silo_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn silo_identity_provider_create(&self) -> builder::SiloIdentityProviderCreate; + ///GET a silo's SAML identity provider + /// + ///Sends a `GET` request to + /// `/silos/{silo_name}/saml_identity_providers/{provider_name}` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `provider_name`: The SAML identity provider's name + /// + ///```ignore + /// let response = client.silo_identity_provider_view() + /// .silo_name(silo_name) + /// .provider_name(provider_name) + /// .send() + /// .await; + /// ``` + fn silo_identity_provider_view(&self) -> builder::SiloIdentityProviderView; + ///List users + /// + ///Sends a `GET` request to `/users` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.hardware_sleds_get() + /// let response = client.user_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn hardware_sleds_get(&self) -> builder::HardwareSledsGet; - ///Fetch information about a sled in the system - /// - ///Sends a `GET` request to `/hardware/sleds/{sled_id}` - /// - ///Arguments: - /// - `sled_id`: The sled's unique ID. - /// - ///```ignore - /// let response = client.hardware_sleds_get_sled() - /// .sled_id(sled_id) - /// .send() - /// .await; - /// ``` - fn hardware_sleds_get_sled(&self) -> builder::HardwareSledsGetSled; + fn user_list(&self) -> builder::UserList; } -impl ClientSledsExt for Client { - fn hardware_sleds_get(&self) -> builder::HardwareSledsGet { - builder::HardwareSledsGet::new(self) +impl ClientSilosExt for Client { + fn silo_list(&self) -> builder::SiloList { + builder::SiloList::new(self) } - fn hardware_sleds_get_sled(&self) -> builder::HardwareSledsGetSled { - builder::HardwareSledsGetSled::new(self) + fn silo_create(&self) -> builder::SiloCreate { + builder::SiloCreate::new(self) + } + + fn silo_view(&self) -> builder::SiloView { + builder::SiloView::new(self) + } + + fn silo_delete(&self) -> builder::SiloDelete { + builder::SiloDelete::new(self) + } + + fn silo_identity_provider_list(&self) -> builder::SiloIdentityProviderList { + builder::SiloIdentityProviderList::new(self) + } + + fn silo_policy_view(&self) -> builder::SiloPolicyView { + builder::SiloPolicyView::new(self) + } + + fn silo_policy_update(&self) -> builder::SiloPolicyUpdate { + builder::SiloPolicyUpdate::new(self) + } + + fn silo_identity_provider_create(&self) -> builder::SiloIdentityProviderCreate { + builder::SiloIdentityProviderCreate::new(self) + } + + fn silo_identity_provider_view(&self) -> builder::SiloIdentityProviderView { + builder::SiloIdentityProviderView::new(self) + } + + fn user_list(&self) -> builder::UserList { + builder::UserList::new(self) } } @@ -3370,12 +3869,12 @@ pub trait ClientSnapshotsExt { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_snapshots_get() + /// let response = client.snapshot_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -3384,7 +3883,7 @@ pub trait ClientSnapshotsExt { /// .send() /// .await; /// ``` - fn project_snapshots_get(&self) -> builder::ProjectSnapshotsGet; + fn snapshot_list(&self) -> builder::SnapshotList; ///Create a snapshot of a disk /// ///Sends a `POST` request to @@ -3396,269 +3895,103 @@ pub trait ClientSnapshotsExt { /// - `body` /// ///```ignore - /// let response = client.project_snapshots_post() + /// let response = client.snapshot_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn project_snapshots_post(&self) -> builder::ProjectSnapshotsPost; + fn snapshot_create(&self) -> builder::SnapshotCreate; ///Get a snapshot in a project /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` ```ignore - /// let response = client.project_snapshots_get_snapshot() + /// let response = client.snapshot_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .snapshot_name(snapshot_name) /// .send() /// .await; /// ``` - fn project_snapshots_get_snapshot(&self) -> builder::ProjectSnapshotsGetSnapshot; + fn snapshot_view(&self) -> builder::SnapshotView; ///Delete a snapshot from a project /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` ```ignore - /// let response = client.project_snapshots_delete_snapshot() + /// let response = client.snapshot_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .snapshot_name(snapshot_name) /// .send() /// .await; /// ``` - fn project_snapshots_delete_snapshot(&self) -> builder::ProjectSnapshotsDeleteSnapshot; + fn snapshot_delete(&self) -> builder::SnapshotDelete; } impl ClientSnapshotsExt for Client { - fn project_snapshots_get(&self) -> builder::ProjectSnapshotsGet { - builder::ProjectSnapshotsGet::new(self) + fn snapshot_list(&self) -> builder::SnapshotList { + builder::SnapshotList::new(self) } - fn project_snapshots_post(&self) -> builder::ProjectSnapshotsPost { - builder::ProjectSnapshotsPost::new(self) + fn snapshot_create(&self) -> builder::SnapshotCreate { + builder::SnapshotCreate::new(self) } - fn project_snapshots_get_snapshot(&self) -> builder::ProjectSnapshotsGetSnapshot { - builder::ProjectSnapshotsGetSnapshot::new(self) + fn snapshot_view(&self) -> builder::SnapshotView { + builder::SnapshotView::new(self) } - fn project_snapshots_delete_snapshot(&self) -> builder::ProjectSnapshotsDeleteSnapshot { - builder::ProjectSnapshotsDeleteSnapshot::new(self) + fn snapshot_delete(&self) -> builder::SnapshotDelete { + builder::SnapshotDelete::new(self) } } -pub trait ClientSshkeysExt { - ///List the current user's SSH public keys +pub trait ClientSystemExt { + ///List the built-in system users /// - ///Sends a `GET` request to `/session/me/sshkeys` + ///Sends a `GET` request to `/system/user` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.sshkeys_get() + /// let response = client.system_user_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn sshkeys_get(&self) -> builder::SshkeysGet; - ///Create a new SSH public key for the current user + fn system_user_list(&self) -> builder::SystemUserList; + ///Fetch a specific built-in system user /// - ///Sends a `POST` request to `/session/me/sshkeys` - ///```ignore - /// let response = client.sshkeys_post() - /// .body(body) - /// .send() - /// .await; - /// ``` - fn sshkeys_post(&self) -> builder::SshkeysPost; - ///Get (by name) an SSH public key belonging to the current user - /// - ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` - ///```ignore - /// let response = client.sshkeys_get_key() - /// .ssh_key_name(ssh_key_name) - /// .send() - /// .await; - /// ``` - fn sshkeys_get_key(&self) -> builder::SshkeysGetKey; - ///Delete (by name) an SSH public key belonging to the current user - /// - ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` - ///```ignore - /// let response = client.sshkeys_delete_key() - /// .ssh_key_name(ssh_key_name) - /// .send() - /// .await; - /// ``` - fn sshkeys_delete_key(&self) -> builder::SshkeysDeleteKey; -} - -impl ClientSshkeysExt for Client { - fn sshkeys_get(&self) -> builder::SshkeysGet { - builder::SshkeysGet::new(self) - } - - fn sshkeys_post(&self) -> builder::SshkeysPost { - builder::SshkeysPost::new(self) - } - - fn sshkeys_get_key(&self) -> builder::SshkeysGetKey { - builder::SshkeysGetKey::new(self) - } - - fn sshkeys_delete_key(&self) -> builder::SshkeysDeleteKey { - builder::SshkeysDeleteKey::new(self) - } -} - -pub trait ClientSubnetsExt { - ///List subnets in a VPC - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/subnets` + ///Sends a `GET` request to `/system/user/{user_name}` /// ///Arguments: - /// - `organization_name` - /// - `project_name` - /// - `vpc_name` - /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the - /// subsequent page - /// - `sort_by` + /// - `user_name`: The built-in user's unique name. /// ///```ignore - /// let response = client.vpc_subnets_get() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .limit(limit) - /// .page_token(page_token) - /// .sort_by(sort_by) + /// let response = client.system_user_view() + /// .user_name(user_name) /// .send() /// .await; /// ``` - fn vpc_subnets_get(&self) -> builder::VpcSubnetsGet; - ///Create a subnet in a VPC - /// - ///Sends a `POST` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/subnets` ```ignore - /// let response = client.vpc_subnets_post() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn vpc_subnets_post(&self) -> builder::VpcSubnetsPost; - ///Get subnet in a VPC - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/subnets/{subnet_name}` ```ignore - /// let response = client.vpc_subnets_get_subnet() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .subnet_name(subnet_name) - /// .send() - /// .await; - /// ``` - fn vpc_subnets_get_subnet(&self) -> builder::VpcSubnetsGetSubnet; - ///Update a VPC Subnet - /// - ///Sends a `PUT` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/subnets/{subnet_name}` ```ignore - /// let response = client.vpc_subnets_put_subnet() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .subnet_name(subnet_name) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn vpc_subnets_put_subnet(&self) -> builder::VpcSubnetsPutSubnet; - ///Delete a subnet from a VPC - /// - ///Sends a `DELETE` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/subnets/{subnet_name}` ```ignore - /// let response = client.vpc_subnets_delete_subnet() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .subnet_name(subnet_name) - /// .send() - /// .await; - /// ``` - fn vpc_subnets_delete_subnet(&self) -> builder::VpcSubnetsDeleteSubnet; - ///List network interfaces in a VPC subnet - /// - ///Sends a `GET` request to - /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ - /// {vpc_name}/subnets/{subnet_name}/network-interfaces` - /// - ///Arguments: - /// - `organization_name` - /// - `project_name` - /// - `vpc_name` - /// - `subnet_name` - /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the - /// subsequent page - /// - `sort_by` - /// - ///```ignore - /// let response = client.subnet_network_interfaces_get() - /// .organization_name(organization_name) - /// .project_name(project_name) - /// .vpc_name(vpc_name) - /// .subnet_name(subnet_name) - /// .limit(limit) - /// .page_token(page_token) - /// .sort_by(sort_by) - /// .send() - /// .await; - /// ``` - fn subnet_network_interfaces_get(&self) -> builder::SubnetNetworkInterfacesGet; + fn system_user_view(&self) -> builder::SystemUserView; } -impl ClientSubnetsExt for Client { - fn vpc_subnets_get(&self) -> builder::VpcSubnetsGet { - builder::VpcSubnetsGet::new(self) +impl ClientSystemExt for Client { + fn system_user_list(&self) -> builder::SystemUserList { + builder::SystemUserList::new(self) } - fn vpc_subnets_post(&self) -> builder::VpcSubnetsPost { - builder::VpcSubnetsPost::new(self) - } - - fn vpc_subnets_get_subnet(&self) -> builder::VpcSubnetsGetSubnet { - builder::VpcSubnetsGetSubnet::new(self) - } - - fn vpc_subnets_put_subnet(&self) -> builder::VpcSubnetsPutSubnet { - builder::VpcSubnetsPutSubnet::new(self) - } - - fn vpc_subnets_delete_subnet(&self) -> builder::VpcSubnetsDeleteSubnet { - builder::VpcSubnetsDeleteSubnet::new(self) - } - - fn subnet_network_interfaces_get(&self) -> builder::SubnetNetworkInterfacesGet { - builder::SubnetNetworkInterfacesGet::new(self) + fn system_user_view(&self) -> builder::SystemUserView { + builder::SystemUserView::new(self) } } @@ -3680,52 +4013,6 @@ impl ClientUpdatesExt for Client { } } -pub trait ClientUsersExt { - ///List the built-in system users - /// - ///Sends a `GET` request to `/users` - /// - ///Arguments: - /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the - /// subsequent page - /// - `sort_by` - /// - ///```ignore - /// let response = client.users_get() - /// .limit(limit) - /// .page_token(page_token) - /// .sort_by(sort_by) - /// .send() - /// .await; - /// ``` - fn users_get(&self) -> builder::UsersGet; - ///Fetch a specific built-in system user - /// - ///Sends a `GET` request to `/users/{user_name}` - /// - ///Arguments: - /// - `user_name`: The built-in user's unique name. - /// - ///```ignore - /// let response = client.users_get_user() - /// .user_name(user_name) - /// .send() - /// .await; - /// ``` - fn users_get_user(&self) -> builder::UsersGetUser; -} - -impl ClientUsersExt for Client { - fn users_get(&self) -> builder::UsersGet { - builder::UsersGet::new(self) - } - - fn users_get_user(&self) -> builder::UsersGetUser { - builder::UsersGetUser::new(self) - } -} - pub trait ClientVpcsExt { ///List VPCs in a project /// @@ -3736,12 +4023,12 @@ pub trait ClientVpcsExt { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_vpcs_get() + /// let response = client.vpc_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -3750,7 +4037,7 @@ pub trait ClientVpcsExt { /// .send() /// .await; /// ``` - fn project_vpcs_get(&self) -> builder::ProjectVpcsGet; + fn vpc_list(&self) -> builder::VpcList; ///Create a VPC in a project /// ///Sends a `POST` request to @@ -3762,33 +4049,33 @@ pub trait ClientVpcsExt { /// - `body` /// ///```ignore - /// let response = client.project_vpcs_post() + /// let response = client.vpc_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - fn project_vpcs_post(&self) -> builder::ProjectVpcsPost; + fn vpc_create(&self) -> builder::VpcCreate; ///Get a VPC in a project /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` ```ignore - /// let response = client.project_vpcs_get_vpc() + /// let response = client.vpc_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` - fn project_vpcs_get_vpc(&self) -> builder::ProjectVpcsGetVpc; + fn vpc_view(&self) -> builder::VpcView; ///Update a VPC /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` ```ignore - /// let response = client.project_vpcs_put_vpc() + /// let response = client.vpc_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3796,62 +4083,590 @@ pub trait ClientVpcsExt { /// .send() /// .await; /// ``` - fn project_vpcs_put_vpc(&self) -> builder::ProjectVpcsPutVpc; + fn vpc_update(&self) -> builder::VpcUpdate; ///Delete a vpc from a project /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` ```ignore - /// let response = client.project_vpcs_delete_vpc() + /// let response = client.vpc_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` - fn project_vpcs_delete_vpc(&self) -> builder::ProjectVpcsDeleteVpc; + fn vpc_delete(&self) -> builder::VpcDelete; + ///List firewall rules for a VPC + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/firewall/rules` ```ignore + /// let response = client.vpc_firewall_rules_view() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .send() + /// .await; + /// ``` + fn vpc_firewall_rules_view(&self) -> builder::VpcFirewallRulesView; + ///Replace the firewall rules for a VPC + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/firewall/rules` ```ignore + /// let response = client.vpc_firewall_rules_update() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_firewall_rules_update(&self) -> builder::VpcFirewallRulesUpdate; + ///List VPC Custom and System Routers + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `vpc_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.vpc_router_list() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn vpc_router_list(&self) -> builder::VpcRouterList; + ///Create a VPC Router + /// + ///Sends a `POST` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers` ```ignore + /// let response = client.vpc_router_create() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_router_create(&self) -> builder::VpcRouterCreate; + ///Get a VPC Router + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}` ```ignore + /// let response = client.vpc_router_view() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .send() + /// .await; + /// ``` + fn vpc_router_view(&self) -> builder::VpcRouterView; + ///Update a VPC Router + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}` ```ignore + /// let response = client.vpc_router_update() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_router_update(&self) -> builder::VpcRouterUpdate; + ///Delete a router from its VPC + /// + ///Sends a `DELETE` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}` ```ignore + /// let response = client.vpc_router_delete() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .send() + /// .await; + /// ``` + fn vpc_router_delete(&self) -> builder::VpcRouterDelete; + ///List a Router's routes + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}/routes` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `vpc_name` + /// - `router_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.vpc_router_route_list() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn vpc_router_route_list(&self) -> builder::VpcRouterRouteList; + ///Create a VPC Router + /// + ///Sends a `POST` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}/routes` ```ignore + /// let response = client.vpc_router_route_create() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_router_route_create(&self) -> builder::VpcRouterRouteCreate; + ///Get a VPC Router route + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore + /// let response = client.vpc_router_route_view() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .route_name(route_name) + /// .send() + /// .await; + /// ``` + fn vpc_router_route_view(&self) -> builder::VpcRouterRouteView; + ///Update a Router route + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore + /// let response = client.vpc_router_route_update() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .route_name(route_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_router_route_update(&self) -> builder::VpcRouterRouteUpdate; + ///Delete a route from its router + /// + ///Sends a `DELETE` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore + /// let response = client.vpc_router_route_delete() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .router_name(router_name) + /// .route_name(route_name) + /// .send() + /// .await; + /// ``` + fn vpc_router_route_delete(&self) -> builder::VpcRouterRouteDelete; + ///List subnets in a VPC + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/subnets` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `vpc_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.vpc_subnet_list() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn vpc_subnet_list(&self) -> builder::VpcSubnetList; + ///Create a subnet in a VPC + /// + ///Sends a `POST` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/subnets` ```ignore + /// let response = client.vpc_subnet_create() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_subnet_create(&self) -> builder::VpcSubnetCreate; + ///Get subnet in a VPC + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/subnets/{subnet_name}` ```ignore + /// let response = client.vpc_subnet_view() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .subnet_name(subnet_name) + /// .send() + /// .await; + /// ``` + fn vpc_subnet_view(&self) -> builder::VpcSubnetView; + ///Update a VPC Subnet + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/subnets/{subnet_name}` ```ignore + /// let response = client.vpc_subnet_update() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .subnet_name(subnet_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn vpc_subnet_update(&self) -> builder::VpcSubnetUpdate; + ///Delete a subnet from a VPC + /// + ///Sends a `DELETE` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/subnets/{subnet_name}` ```ignore + /// let response = client.vpc_subnet_delete() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .subnet_name(subnet_name) + /// .send() + /// .await; + /// ``` + fn vpc_subnet_delete(&self) -> builder::VpcSubnetDelete; + ///List network interfaces in a VPC subnet + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ + /// {vpc_name}/subnets/{subnet_name}/network-interfaces` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `vpc_name` + /// - `subnet_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.vpc_subnet_list_network_interfaces() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .vpc_name(vpc_name) + /// .subnet_name(subnet_name) + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + fn vpc_subnet_list_network_interfaces(&self) -> builder::VpcSubnetListNetworkInterfaces; } impl ClientVpcsExt for Client { - fn project_vpcs_get(&self) -> builder::ProjectVpcsGet { - builder::ProjectVpcsGet::new(self) + fn vpc_list(&self) -> builder::VpcList { + builder::VpcList::new(self) } - fn project_vpcs_post(&self) -> builder::ProjectVpcsPost { - builder::ProjectVpcsPost::new(self) + fn vpc_create(&self) -> builder::VpcCreate { + builder::VpcCreate::new(self) } - fn project_vpcs_get_vpc(&self) -> builder::ProjectVpcsGetVpc { - builder::ProjectVpcsGetVpc::new(self) + fn vpc_view(&self) -> builder::VpcView { + builder::VpcView::new(self) } - fn project_vpcs_put_vpc(&self) -> builder::ProjectVpcsPutVpc { - builder::ProjectVpcsPutVpc::new(self) + fn vpc_update(&self) -> builder::VpcUpdate { + builder::VpcUpdate::new(self) } - fn project_vpcs_delete_vpc(&self) -> builder::ProjectVpcsDeleteVpc { - builder::ProjectVpcsDeleteVpc::new(self) + fn vpc_delete(&self) -> builder::VpcDelete { + builder::VpcDelete::new(self) + } + + fn vpc_firewall_rules_view(&self) -> builder::VpcFirewallRulesView { + builder::VpcFirewallRulesView::new(self) + } + + fn vpc_firewall_rules_update(&self) -> builder::VpcFirewallRulesUpdate { + builder::VpcFirewallRulesUpdate::new(self) + } + + fn vpc_router_list(&self) -> builder::VpcRouterList { + builder::VpcRouterList::new(self) + } + + fn vpc_router_create(&self) -> builder::VpcRouterCreate { + builder::VpcRouterCreate::new(self) + } + + fn vpc_router_view(&self) -> builder::VpcRouterView { + builder::VpcRouterView::new(self) + } + + fn vpc_router_update(&self) -> builder::VpcRouterUpdate { + builder::VpcRouterUpdate::new(self) + } + + fn vpc_router_delete(&self) -> builder::VpcRouterDelete { + builder::VpcRouterDelete::new(self) + } + + fn vpc_router_route_list(&self) -> builder::VpcRouterRouteList { + builder::VpcRouterRouteList::new(self) + } + + fn vpc_router_route_create(&self) -> builder::VpcRouterRouteCreate { + builder::VpcRouterRouteCreate::new(self) + } + + fn vpc_router_route_view(&self) -> builder::VpcRouterRouteView { + builder::VpcRouterRouteView::new(self) + } + + fn vpc_router_route_update(&self) -> builder::VpcRouterRouteUpdate { + builder::VpcRouterRouteUpdate::new(self) + } + + fn vpc_router_route_delete(&self) -> builder::VpcRouterRouteDelete { + builder::VpcRouterRouteDelete::new(self) + } + + fn vpc_subnet_list(&self) -> builder::VpcSubnetList { + builder::VpcSubnetList::new(self) + } + + fn vpc_subnet_create(&self) -> builder::VpcSubnetCreate { + builder::VpcSubnetCreate::new(self) + } + + fn vpc_subnet_view(&self) -> builder::VpcSubnetView { + builder::VpcSubnetView::new(self) + } + + fn vpc_subnet_update(&self) -> builder::VpcSubnetUpdate { + builder::VpcSubnetUpdate::new(self) + } + + fn vpc_subnet_delete(&self) -> builder::VpcSubnetDelete { + builder::VpcSubnetDelete::new(self) + } + + fn vpc_subnet_list_network_interfaces(&self) -> builder::VpcSubnetListNetworkInterfaces { + builder::VpcSubnetListNetworkInterfaces::new(self) } } pub mod builder { - #[allow(unused_imports)] - use super::encode_path; use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; - ///Builder for [`ClientRacksExt::hardware_racks_get`] + use super::{encode_path, ByteStream, Error, RequestBuilderExt, ResponseValue}; + ///Builder for [`ClientHiddenExt::device_auth_request`] /// - ///[`ClientRacksExt::hardware_racks_get`]: super::ClientRacksExt::hardware_racks_get + ///[`ClientHiddenExt::device_auth_request`]: super::ClientHiddenExt::device_auth_request #[derive(Clone)] - pub struct HardwareRacksGet<'a> { + pub struct DeviceAuthRequest<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> DeviceAuthRequest<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::DeviceAuthRequest) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/device/auth` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/device/auth", client.baseurl,); + let 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))), + } + } + } + + ///Builder for [`ClientHiddenExt::device_auth_confirm`] + /// + ///[`ClientHiddenExt::device_auth_confirm`]: super::ClientHiddenExt::device_auth_confirm + #[derive(Clone)] + pub struct DeviceAuthConfirm<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> DeviceAuthConfirm<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::DeviceAuthVerify) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/device/confirm` + pub async fn send(self) -> Result>, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/device/confirm", client.baseurl,); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`ClientHiddenExt::device_access_token`] + /// + ///[`ClientHiddenExt::device_access_token`]: super::ClientHiddenExt::device_access_token + #[derive(Clone)] + pub struct DeviceAccessToken<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> DeviceAccessToken<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::DeviceAccessTokenRequest) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/device/token` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/device/token", client.baseurl,); + let 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))), + } + } + } + + ///Builder for [`ClientHardwareExt::rack_list`] + /// + ///[`ClientHardwareExt::rack_list`]: super::ClientHardwareExt::rack_list + #[derive(Clone)] + pub struct RackList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> HardwareRacksGet<'a> { + impl<'a> RackList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -3960,16 +4775,16 @@ pub mod builder { } } - ///Builder for [`ClientRacksExt::hardware_racks_get_rack`] + ///Builder for [`ClientHardwareExt::rack_view`] /// - ///[`ClientRacksExt::hardware_racks_get_rack`]: super::ClientRacksExt::hardware_racks_get_rack + ///[`ClientHardwareExt::rack_view`]: super::ClientHardwareExt::rack_view #[derive(Clone)] - pub struct HardwareRacksGetRack<'a> { + pub struct RackView<'a> { client: &'a super::Client, rack_id: Option, } - impl<'a> HardwareRacksGetRack<'a> { + impl<'a> RackView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4019,18 +4834,18 @@ pub mod builder { } } - ///Builder for [`ClientSledsExt::hardware_sleds_get`] + ///Builder for [`ClientHardwareExt::sled_list`] /// - ///[`ClientSledsExt::hardware_sleds_get`]: super::ClientSledsExt::hardware_sleds_get + ///[`ClientHardwareExt::sled_list`]: super::ClientHardwareExt::sled_list #[derive(Clone)] - pub struct HardwareSledsGet<'a> { + pub struct SledList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> HardwareSledsGet<'a> { + impl<'a> SledList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4139,16 +4954,16 @@ pub mod builder { } } - ///Builder for [`ClientSledsExt::hardware_sleds_get_sled`] + ///Builder for [`ClientHardwareExt::sled_view`] /// - ///[`ClientSledsExt::hardware_sleds_get_sled`]: super::ClientSledsExt::hardware_sleds_get_sled + ///[`ClientHardwareExt::sled_view`]: super::ClientHardwareExt::sled_view #[derive(Clone)] - pub struct HardwareSledsGetSled<'a> { + pub struct SledView<'a> { client: &'a super::Client, sled_id: Option, } - impl<'a> HardwareSledsGetSled<'a> { + impl<'a> SledView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4198,18 +5013,18 @@ pub mod builder { } } - ///Builder for [`ClientImagesGlobalExt::images_get`] + ///Builder for [`ClientImagesGlobalExt::image_global_list`] /// - ///[`ClientImagesGlobalExt::images_get`]: super::ClientImagesGlobalExt::images_get + ///[`ClientImagesGlobalExt::image_global_list`]: super::ClientImagesGlobalExt::image_global_list #[derive(Clone)] - pub struct ImagesGet<'a> { + pub struct ImageGlobalList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> ImagesGet<'a> { + impl<'a> ImageGlobalList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4318,21 +5133,21 @@ pub mod builder { } } - ///Builder for [`ClientImagesGlobalExt::images_post`] + ///Builder for [`ClientImagesGlobalExt::image_global_create`] /// - ///[`ClientImagesGlobalExt::images_post`]: super::ClientImagesGlobalExt::images_post + ///[`ClientImagesGlobalExt::image_global_create`]: super::ClientImagesGlobalExt::image_global_create #[derive(Clone)] - pub struct ImagesPost<'a> { + pub struct ImageGlobalCreate<'a> { client: &'a super::Client, - body: Option, + body: Option, } - impl<'a> ImagesPost<'a> { + impl<'a> ImageGlobalCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } - pub fn body(mut self, value: types::ImageCreate) -> Self { + pub fn body(mut self, value: types::GlobalImageCreate) -> Self { self.body = Some(value); self } @@ -4370,16 +5185,16 @@ pub mod builder { } } - ///Builder for [`ClientImagesGlobalExt::images_get_image`] + ///Builder for [`ClientImagesGlobalExt::image_global_view`] /// - ///[`ClientImagesGlobalExt::images_get_image`]: super::ClientImagesGlobalExt::images_get_image + ///[`ClientImagesGlobalExt::image_global_view`]: super::ClientImagesGlobalExt::image_global_view #[derive(Clone)] - pub struct ImagesGetImage<'a> { + pub struct ImageGlobalView<'a> { client: &'a super::Client, image_name: Option, } - impl<'a> ImagesGetImage<'a> { + impl<'a> ImageGlobalView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4429,16 +5244,16 @@ pub mod builder { } } - ///Builder for [`ClientImagesGlobalExt::images_delete_image`] + ///Builder for [`ClientImagesGlobalExt::image_global_delete`] /// - ///[`ClientImagesGlobalExt::images_delete_image`]: super::ClientImagesGlobalExt::images_delete_image + ///[`ClientImagesGlobalExt::image_global_delete`]: super::ClientImagesGlobalExt::image_global_delete #[derive(Clone)] - pub struct ImagesDeleteImage<'a> { + pub struct ImageGlobalDelete<'a> { client: &'a super::Client, image_name: Option, } - impl<'a> ImagesDeleteImage<'a> { + impl<'a> ImageGlobalDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4488,13 +5303,655 @@ pub mod builder { } } + ///Builder for [`ClientIpPoolsExt::ip_pool_list`] + /// + ///[`ClientIpPoolsExt::ip_pool_list`]: super::ClientIpPoolsExt::ip_pool_list + #[derive(Clone)] + pub struct IpPoolList<'a> { + client: &'a super::Client, + limit: Option, + page_token: Option, + sort_by: Option, + } + + impl<'a> IpPoolList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + limit: None, + page_token: None, + sort_by: None, + } + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + pub fn sort_by(mut self, value: types::NameOrIdSortMode) -> Self { + self.sort_by = Some(value); + self + } + + ///Sends a `GET` request to `/ip-pools` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + limit, + page_token, + sort_by, + } = self; + let url = format!("{}/ip-pools", client.baseurl,); + let mut query = Vec::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/ip-pools` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + sort_by: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`ClientIpPoolsExt::ip_pool_create`] + /// + ///[`ClientIpPoolsExt::ip_pool_create`]: super::ClientIpPoolsExt::ip_pool_create + #[derive(Clone)] + pub struct IpPoolCreate<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> IpPoolCreate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::IpPoolCreate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/ip-pools` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/ip-pools", client.baseurl,); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`ClientIpPoolsExt::ip_pool_view`] + /// + ///[`ClientIpPoolsExt::ip_pool_view`]: super::ClientIpPoolsExt::ip_pool_view + #[derive(Clone)] + pub struct IpPoolView<'a> { + client: &'a super::Client, + pool_name: Option, + } + + impl<'a> IpPoolView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + ///Sends a `GET` request to `/ip-pools/{pool_name}` + pub async fn send(self) -> Result, Error> { + let Self { client, pool_name } = self; + let (pool_name,) = match (pool_name,) { + (Some(pool_name),) => (pool_name,), + (pool_name,) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.get(url).build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 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 [`ClientIpPoolsExt::ip_pool_update`] + /// + ///[`ClientIpPoolsExt::ip_pool_update`]: super::ClientIpPoolsExt::ip_pool_update + #[derive(Clone)] + pub struct IpPoolUpdate<'a> { + client: &'a super::Client, + pool_name: Option, + body: Option, + } + + impl<'a> IpPoolUpdate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + body: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn body(mut self, value: types::IpPoolUpdate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `PUT` request to `/ip-pools/{pool_name}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + pool_name, + body, + } = self; + let (pool_name, body) = match (pool_name, body) { + (Some(pool_name), Some(body)) => (pool_name, body), + (pool_name, body) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.put(url).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)), + } + } + } + + ///Builder for [`ClientIpPoolsExt::ip_pool_delete`] + /// + ///[`ClientIpPoolsExt::ip_pool_delete`]: super::ClientIpPoolsExt::ip_pool_delete + #[derive(Clone)] + pub struct IpPoolDelete<'a> { + client: &'a super::Client, + pool_name: Option, + } + + impl<'a> IpPoolDelete<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + ///Sends a `DELETE` request to `/ip-pools/{pool_name}` + pub async fn send(self) -> Result, Error> { + let Self { client, pool_name } = self; + let (pool_name,) = match (pool_name,) { + (Some(pool_name),) => (pool_name,), + (pool_name,) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.delete(url).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)), + } + } + } + + ///Builder for [`ClientIpPoolsExt::ip_pool_range_list`] + /// + ///[`ClientIpPoolsExt::ip_pool_range_list`]: super::ClientIpPoolsExt::ip_pool_range_list + #[derive(Clone)] + pub struct IpPoolRangeList<'a> { + client: &'a super::Client, + pool_name: Option, + limit: Option, + page_token: Option, + } + + impl<'a> IpPoolRangeList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + limit: None, + page_token: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + pool_name, + limit, + page_token, + } = self; + let (pool_name,) = match (pool_name,) { + (Some(pool_name),) => (pool_name,), + (pool_name,) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}/ranges", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let mut query = Vec::new(); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/ip-pools/{pool_name}/ranges` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`ClientIpPoolsExt::ip_pool_range_add`] + /// + ///[`ClientIpPoolsExt::ip_pool_range_add`]: super::ClientIpPoolsExt::ip_pool_range_add + #[derive(Clone)] + pub struct IpPoolRangeAdd<'a> { + client: &'a super::Client, + pool_name: Option, + body: Option, + } + + impl<'a> IpPoolRangeAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + body: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn body(mut self, value: types::IpRange) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/add` + pub async fn send(self) -> Result, Error> { + let Self { + client, + pool_name, + body, + } = self; + let (pool_name, body) = match (pool_name, body) { + (Some(pool_name), Some(body)) => (pool_name, body), + (pool_name, body) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}/ranges/add", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`ClientIpPoolsExt::ip_pool_range_remove`] + /// + ///[`ClientIpPoolsExt::ip_pool_range_remove`]: super::ClientIpPoolsExt::ip_pool_range_remove + #[derive(Clone)] + pub struct IpPoolRangeRemove<'a> { + client: &'a super::Client, + pool_name: Option, + body: Option, + } + + impl<'a> IpPoolRangeRemove<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + body: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn body(mut self, value: types::IpRange) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/remove` + pub async fn send(self) -> Result, Error> { + let Self { + client, + pool_name, + body, + } = self; + let (pool_name, body) = match (pool_name, body) { + (Some(pool_name), Some(body)) => (pool_name, body), + (pool_name, body) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}/ranges/remove", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.post(url).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)), + } + } + } + ///Builder for [`ClientHiddenExt::spoof_login`] /// ///[`ClientHiddenExt::spoof_login`]: super::ClientHiddenExt::spoof_login #[derive(Clone)] pub struct SpoofLogin<'a> { client: &'a super::Client, - body: Option, + body: Option, } impl<'a> SpoofLogin<'a> { @@ -4502,7 +5959,7 @@ pub mod builder { Self { client, body: None } } - pub fn body(mut self, value: types::LoginParams) -> Self { + pub fn body(mut self, value: types::SpoofLoginBody) -> Self { self.body = Some(value); self } @@ -4534,6 +5991,162 @@ pub mod builder { } } + ///Builder for [`ClientLoginExt::login`] + /// + ///[`ClientLoginExt::login`]: super::ClientLoginExt::login + #[derive(Clone)] + pub struct Login<'a> { + client: &'a super::Client, + silo_name: Option, + provider_name: Option, + } + + impl<'a> Login<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + provider_name: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn provider_name(mut self, value: types::Name) -> Self { + self.provider_name = Some(value); + self + } + + ///Sends a `GET` request to `/login/{silo_name}/{provider_name}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + silo_name, + provider_name, + } = self; + let (silo_name, provider_name) = match (silo_name, provider_name) { + (Some(silo_name), Some(provider_name)) => (silo_name, provider_name), + (silo_name, provider_name) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if provider_name.is_none() { + missing.push(stringify!(provider_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/login/{}/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let 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::ErrorResponse(ResponseValue::stream(response))), + } + } + } + + ///Builder for [`ClientLoginExt::consume_credentials`] + /// + ///[`ClientLoginExt::consume_credentials`]: super::ClientLoginExt::consume_credentials + pub struct ConsumeCredentials<'a> { + client: &'a super::Client, + silo_name: Option, + provider_name: Option, + body: Option, + } + + impl<'a> ConsumeCredentials<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + provider_name: None, + body: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn provider_name(mut self, value: types::Name) -> Self { + self.provider_name = Some(value); + self + } + + pub fn body>(mut self, value: B) -> Self { + self.body = Some(value.into()); + self + } + + ///Sends a `POST` request to `/login/{silo_name}/{provider_name}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + silo_name, + provider_name, + body, + } = self; + let (silo_name, provider_name, body) = match (silo_name, provider_name, body) { + (Some(silo_name), Some(provider_name), Some(body)) => { + (silo_name, provider_name, body) + } + (silo_name, provider_name, body) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if provider_name.is_none() { + missing.push(stringify!(provider_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/login/{}/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let 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)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + } + ///Builder for [`ClientHiddenExt::logout`] /// ///[`ClientHiddenExt::logout`]: super::ClientHiddenExt::logout @@ -4561,18 +6174,18 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organizations_get`] + ///Builder for [`ClientOrganizationsExt::organization_list`] /// - ///[`ClientOrganizationsExt::organizations_get`]: super::ClientOrganizationsExt::organizations_get + ///[`ClientOrganizationsExt::organization_list`]: super::ClientOrganizationsExt::organization_list #[derive(Clone)] - pub struct OrganizationsGet<'a> { + pub struct OrganizationList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> OrganizationsGet<'a> { + impl<'a> OrganizationList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4681,16 +6294,16 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organizations_post`] + ///Builder for [`ClientOrganizationsExt::organization_create`] /// - ///[`ClientOrganizationsExt::organizations_post`]: super::ClientOrganizationsExt::organizations_post + ///[`ClientOrganizationsExt::organization_create`]: super::ClientOrganizationsExt::organization_create #[derive(Clone)] - pub struct OrganizationsPost<'a> { + pub struct OrganizationCreate<'a> { client: &'a super::Client, body: Option, } - impl<'a> OrganizationsPost<'a> { + impl<'a> OrganizationCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } @@ -4733,16 +6346,16 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organizations_get_organization`] + ///Builder for [`ClientOrganizationsExt::organization_view`] /// - ///[`ClientOrganizationsExt::organizations_get_organization`]: super::ClientOrganizationsExt::organizations_get_organization + ///[`ClientOrganizationsExt::organization_view`]: super::ClientOrganizationsExt::organization_view #[derive(Clone)] - pub struct OrganizationsGetOrganization<'a> { + pub struct OrganizationView<'a> { client: &'a super::Client, organization_name: Option, } - impl<'a> OrganizationsGetOrganization<'a> { + impl<'a> OrganizationView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4795,17 +6408,17 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organizations_put_organization`] + ///Builder for [`ClientOrganizationsExt::organization_update`] /// - ///[`ClientOrganizationsExt::organizations_put_organization`]: super::ClientOrganizationsExt::organizations_put_organization + ///[`ClientOrganizationsExt::organization_update`]: super::ClientOrganizationsExt::organization_update #[derive(Clone)] - pub struct OrganizationsPutOrganization<'a> { + pub struct OrganizationUpdate<'a> { client: &'a super::Client, organization_name: Option, body: Option, } - impl<'a> OrganizationsPutOrganization<'a> { + impl<'a> OrganizationUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4868,17 +6481,16 @@ pub mod builder { } } - ///Builder for - /// [`ClientOrganizationsExt::organizations_delete_organization`] + ///Builder for [`ClientOrganizationsExt::organization_delete`] /// - ///[`ClientOrganizationsExt::organizations_delete_organization`]: super::ClientOrganizationsExt::organizations_delete_organization + ///[`ClientOrganizationsExt::organization_delete`]: super::ClientOrganizationsExt::organization_delete #[derive(Clone)] - pub struct OrganizationsDeleteOrganization<'a> { + pub struct OrganizationDelete<'a> { client: &'a super::Client, organization_name: Option, } - impl<'a> OrganizationsDeleteOrganization<'a> { + impl<'a> OrganizationDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4931,16 +6543,16 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organization_get_policy`] + ///Builder for [`ClientOrganizationsExt::organization_policy_view`] /// - ///[`ClientOrganizationsExt::organization_get_policy`]: super::ClientOrganizationsExt::organization_get_policy + ///[`ClientOrganizationsExt::organization_policy_view`]: super::ClientOrganizationsExt::organization_policy_view #[derive(Clone)] - pub struct OrganizationGetPolicy<'a> { + pub struct OrganizationPolicyView<'a> { client: &'a super::Client, organization_name: Option, } - impl<'a> OrganizationGetPolicy<'a> { + impl<'a> OrganizationPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4956,7 +6568,7 @@ pub mod builder { ///Sends a `GET` request to `/organizations/{organization_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -4995,17 +6607,17 @@ pub mod builder { } } - ///Builder for [`ClientOrganizationsExt::organization_put_policy`] + ///Builder for [`ClientOrganizationsExt::organization_policy_update`] /// - ///[`ClientOrganizationsExt::organization_put_policy`]: super::ClientOrganizationsExt::organization_put_policy + ///[`ClientOrganizationsExt::organization_policy_update`]: super::ClientOrganizationsExt::organization_policy_update #[derive(Clone)] - pub struct OrganizationPutPolicy<'a> { + pub struct OrganizationPolicyUpdate<'a> { client: &'a super::Client, organization_name: Option, - body: Option, + body: Option, } - impl<'a> OrganizationPutPolicy<'a> { + impl<'a> OrganizationPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5019,7 +6631,7 @@ pub mod builder { self } - pub fn body(mut self, value: types::OrganizationRolesPolicy) -> Self { + pub fn body(mut self, value: types::OrganizationRolePolicy) -> Self { self.body = Some(value); self } @@ -5027,7 +6639,7 @@ pub mod builder { ///Sends a `PUT` request to `/organizations/{organization_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -5070,11 +6682,11 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::organization_projects_get`] + ///Builder for [`ClientProjectsExt::project_list`] /// - ///[`ClientProjectsExt::organization_projects_get`]: super::ClientProjectsExt::organization_projects_get + ///[`ClientProjectsExt::project_list`]: super::ClientProjectsExt::project_list #[derive(Clone)] - pub struct OrganizationProjectsGet<'a> { + pub struct ProjectList<'a> { client: &'a super::Client, organization_name: Option, limit: Option, @@ -5082,7 +6694,7 @@ pub mod builder { sort_by: Option, } - impl<'a> OrganizationProjectsGet<'a> { + impl<'a> ProjectList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5217,17 +6829,17 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::organization_projects_post`] + ///Builder for [`ClientProjectsExt::project_create`] /// - ///[`ClientProjectsExt::organization_projects_post`]: super::ClientProjectsExt::organization_projects_post + ///[`ClientProjectsExt::project_create`]: super::ClientProjectsExt::project_create #[derive(Clone)] - pub struct OrganizationProjectsPost<'a> { + pub struct ProjectCreate<'a> { client: &'a super::Client, organization_name: Option, body: Option, } - impl<'a> OrganizationProjectsPost<'a> { + impl<'a> ProjectCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5291,17 +6903,17 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::organization_projects_get_project`] + ///Builder for [`ClientProjectsExt::project_view`] /// - ///[`ClientProjectsExt::organization_projects_get_project`]: super::ClientProjectsExt::organization_projects_get_project + ///[`ClientProjectsExt::project_view`]: super::ClientProjectsExt::project_view #[derive(Clone)] - pub struct OrganizationProjectsGetProject<'a> { + pub struct ProjectView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, } - impl<'a> OrganizationProjectsGetProject<'a> { + impl<'a> ProjectView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5366,18 +6978,18 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::organization_projects_put_project`] + ///Builder for [`ClientProjectsExt::project_update`] /// - ///[`ClientProjectsExt::organization_projects_put_project`]: super::ClientProjectsExt::organization_projects_put_project + ///[`ClientProjectsExt::project_update`]: super::ClientProjectsExt::project_update #[derive(Clone)] - pub struct OrganizationProjectsPutProject<'a> { + pub struct ProjectUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> OrganizationProjectsPutProject<'a> { + impl<'a> ProjectUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5455,17 +7067,17 @@ pub mod builder { } } - ///Builder for [`ClientProjectsExt::organization_projects_delete_project`] + ///Builder for [`ClientProjectsExt::project_delete`] /// - ///[`ClientProjectsExt::organization_projects_delete_project`]: super::ClientProjectsExt::organization_projects_delete_project + ///[`ClientProjectsExt::project_delete`]: super::ClientProjectsExt::project_delete #[derive(Clone)] - pub struct OrganizationProjectsDeleteProject<'a> { + pub struct ProjectDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, } - impl<'a> OrganizationProjectsDeleteProject<'a> { + impl<'a> ProjectDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5530,11 +7142,11 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::project_disks_get`] + ///Builder for [`ClientDisksExt::disk_list`] /// - ///[`ClientDisksExt::project_disks_get`]: super::ClientDisksExt::project_disks_get + ///[`ClientDisksExt::disk_list`]: super::ClientDisksExt::disk_list #[derive(Clone)] - pub struct ProjectDisksGet<'a> { + pub struct DiskList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -5543,7 +7155,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectDisksGet<'a> { + impl<'a> DiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5689,18 +7301,18 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::project_disks_post`] + ///Builder for [`ClientDisksExt::disk_create`] /// - ///[`ClientDisksExt::project_disks_post`]: super::ClientDisksExt::project_disks_post + ///[`ClientDisksExt::disk_create`]: super::ClientDisksExt::disk_create #[derive(Clone)] - pub struct ProjectDisksPost<'a> { + pub struct DiskCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectDisksPost<'a> { + impl<'a> DiskCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5778,18 +7390,18 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::project_disks_get_disk`] + ///Builder for [`ClientDisksExt::disk_view`] /// - ///[`ClientDisksExt::project_disks_get_disk`]: super::ClientDisksExt::project_disks_get_disk + ///[`ClientDisksExt::disk_view`]: super::ClientDisksExt::disk_view #[derive(Clone)] - pub struct ProjectDisksGetDisk<'a> { + pub struct DiskView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, disk_name: Option, } - impl<'a> ProjectDisksGetDisk<'a> { + impl<'a> DiskView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5869,18 +7481,18 @@ pub mod builder { } } - ///Builder for [`ClientDisksExt::project_disks_delete_disk`] + ///Builder for [`ClientDisksExt::disk_delete`] /// - ///[`ClientDisksExt::project_disks_delete_disk`]: super::ClientDisksExt::project_disks_delete_disk + ///[`ClientDisksExt::disk_delete`]: super::ClientDisksExt::disk_delete #[derive(Clone)] - pub struct ProjectDisksDeleteDisk<'a> { + pub struct DiskDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, disk_name: Option, } - impl<'a> ProjectDisksDeleteDisk<'a> { + impl<'a> DiskDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5960,11 +7572,11 @@ pub mod builder { } } - ///Builder for [`ClientImagesExt::project_images_get`] + ///Builder for [`ClientImagesExt::image_list`] /// - ///[`ClientImagesExt::project_images_get`]: super::ClientImagesExt::project_images_get + ///[`ClientImagesExt::image_list`]: super::ClientImagesExt::image_list #[derive(Clone)] - pub struct ProjectImagesGet<'a> { + pub struct ImageList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -5973,7 +7585,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectImagesGet<'a> { + impl<'a> ImageList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6119,18 +7731,18 @@ pub mod builder { } } - ///Builder for [`ClientImagesExt::project_images_post`] + ///Builder for [`ClientImagesExt::image_create`] /// - ///[`ClientImagesExt::project_images_post`]: super::ClientImagesExt::project_images_post + ///[`ClientImagesExt::image_create`]: super::ClientImagesExt::image_create #[derive(Clone)] - pub struct ProjectImagesPost<'a> { + pub struct ImageCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectImagesPost<'a> { + impl<'a> ImageCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6208,18 +7820,18 @@ pub mod builder { } } - ///Builder for [`ClientImagesExt::project_images_get_image`] + ///Builder for [`ClientImagesExt::image_view`] /// - ///[`ClientImagesExt::project_images_get_image`]: super::ClientImagesExt::project_images_get_image + ///[`ClientImagesExt::image_view`]: super::ClientImagesExt::image_view #[derive(Clone)] - pub struct ProjectImagesGetImage<'a> { + pub struct ImageView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, image_name: Option, } - impl<'a> ProjectImagesGetImage<'a> { + impl<'a> ImageView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6299,18 +7911,18 @@ pub mod builder { } } - ///Builder for [`ClientImagesExt::project_images_delete_image`] + ///Builder for [`ClientImagesExt::image_delete`] /// - ///[`ClientImagesExt::project_images_delete_image`]: super::ClientImagesExt::project_images_delete_image + ///[`ClientImagesExt::image_delete`]: super::ClientImagesExt::image_delete #[derive(Clone)] - pub struct ProjectImagesDeleteImage<'a> { + pub struct ImageDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, image_name: Option, } - impl<'a> ProjectImagesDeleteImage<'a> { + impl<'a> ImageDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6390,11 +8002,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_get`] + ///Builder for [`ClientInstancesExt::instance_list`] /// - ///[`ClientInstancesExt::project_instances_get`]: super::ClientInstancesExt::project_instances_get + ///[`ClientInstancesExt::instance_list`]: super::ClientInstancesExt::instance_list #[derive(Clone)] - pub struct ProjectInstancesGet<'a> { + pub struct InstanceList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -6403,7 +8015,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectInstancesGet<'a> { + impl<'a> InstanceList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6551,18 +8163,18 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_post`] + ///Builder for [`ClientInstancesExt::instance_create`] /// - ///[`ClientInstancesExt::project_instances_post`]: super::ClientInstancesExt::project_instances_post + ///[`ClientInstancesExt::instance_create`]: super::ClientInstancesExt::instance_create #[derive(Clone)] - pub struct ProjectInstancesPost<'a> { + pub struct InstanceCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectInstancesPost<'a> { + impl<'a> InstanceCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6641,18 +8253,18 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_get_instance`] + ///Builder for [`ClientInstancesExt::instance_view`] /// - ///[`ClientInstancesExt::project_instances_get_instance`]: super::ClientInstancesExt::project_instances_get_instance + ///[`ClientInstancesExt::instance_view`]: super::ClientInstancesExt::instance_view #[derive(Clone)] - pub struct ProjectInstancesGetInstance<'a> { + pub struct InstanceView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesGetInstance<'a> { + impl<'a> InstanceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6732,18 +8344,18 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_delete_instance`] + ///Builder for [`ClientInstancesExt::instance_delete`] /// - ///[`ClientInstancesExt::project_instances_delete_instance`]: super::ClientInstancesExt::project_instances_delete_instance + ///[`ClientInstancesExt::instance_delete`]: super::ClientInstancesExt::instance_delete #[derive(Clone)] - pub struct ProjectInstancesDeleteInstance<'a> { + pub struct InstanceDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesDeleteInstance<'a> { + impl<'a> InstanceDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6823,11 +8435,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_disks_get`] + ///Builder for [`ClientInstancesExt::instance_disk_list`] /// - ///[`ClientInstancesExt::instance_disks_get`]: super::ClientInstancesExt::instance_disks_get + ///[`ClientInstancesExt::instance_disk_list`]: super::ClientInstancesExt::instance_disk_list #[derive(Clone)] - pub struct InstanceDisksGet<'a> { + pub struct InstanceDiskList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -6837,7 +8449,7 @@ pub mod builder { sort_by: Option, } - impl<'a> InstanceDisksGet<'a> { + impl<'a> InstanceDiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6999,11 +8611,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_disks_attach`] + ///Builder for [`ClientInstancesExt::instance_disk_attach`] /// - ///[`ClientInstancesExt::instance_disks_attach`]: super::ClientInstancesExt::instance_disks_attach + ///[`ClientInstancesExt::instance_disk_attach`]: super::ClientInstancesExt::instance_disk_attach #[derive(Clone)] - pub struct InstanceDisksAttach<'a> { + pub struct InstanceDiskAttach<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7011,7 +8623,7 @@ pub mod builder { body: Option, } - impl<'a> InstanceDisksAttach<'a> { + impl<'a> InstanceDiskAttach<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7104,11 +8716,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_disks_detach`] + ///Builder for [`ClientInstancesExt::instance_disk_detach`] /// - ///[`ClientInstancesExt::instance_disks_detach`]: super::ClientInstancesExt::instance_disks_detach + ///[`ClientInstancesExt::instance_disk_detach`]: super::ClientInstancesExt::instance_disk_detach #[derive(Clone)] - pub struct InstanceDisksDetach<'a> { + pub struct InstanceDiskDetach<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7116,7 +8728,7 @@ pub mod builder { body: Option, } - impl<'a> InstanceDisksDetach<'a> { + impl<'a> InstanceDiskDetach<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7209,11 +8821,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_migrate_instance`] + ///Builder for [`ClientInstancesExt::instance_migrate`] /// - ///[`ClientInstancesExt::project_instances_migrate_instance`]: super::ClientInstancesExt::project_instances_migrate_instance + ///[`ClientInstancesExt::instance_migrate`]: super::ClientInstancesExt::instance_migrate #[derive(Clone)] - pub struct ProjectInstancesMigrateInstance<'a> { + pub struct InstanceMigrate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7221,7 +8833,7 @@ pub mod builder { body: Option, } - impl<'a> ProjectInstancesMigrateInstance<'a> { + impl<'a> InstanceMigrate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7314,11 +8926,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_network_interfaces_get`] + ///Builder for [`ClientInstancesExt::instance_network_interface_list`] /// - ///[`ClientInstancesExt::instance_network_interfaces_get`]: super::ClientInstancesExt::instance_network_interfaces_get + ///[`ClientInstancesExt::instance_network_interface_list`]: super::ClientInstancesExt::instance_network_interface_list #[derive(Clone)] - pub struct InstanceNetworkInterfacesGet<'a> { + pub struct InstanceNetworkInterfaceList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7328,7 +8940,7 @@ pub mod builder { sort_by: Option, } - impl<'a> InstanceNetworkInterfacesGet<'a> { + impl<'a> InstanceNetworkInterfaceList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7491,11 +9103,11 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::instance_network_interfaces_post`] + ///Builder for [`ClientInstancesExt::instance_network_interface_create`] /// - ///[`ClientInstancesExt::instance_network_interfaces_post`]: super::ClientInstancesExt::instance_network_interfaces_post + ///[`ClientInstancesExt::instance_network_interface_create`]: super::ClientInstancesExt::instance_network_interface_create #[derive(Clone)] - pub struct InstanceNetworkInterfacesPost<'a> { + pub struct InstanceNetworkInterfaceCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7503,7 +9115,7 @@ pub mod builder { body: Option, } - impl<'a> InstanceNetworkInterfacesPost<'a> { + impl<'a> InstanceNetworkInterfaceCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7598,12 +9210,11 @@ pub mod builder { } } - ///Builder for - /// [`ClientInstancesExt::instance_network_interfaces_get_interface`] + ///Builder for [`ClientInstancesExt::instance_network_interface_view`] /// - ///[`ClientInstancesExt::instance_network_interfaces_get_interface`]: super::ClientInstancesExt::instance_network_interfaces_get_interface + ///[`ClientInstancesExt::instance_network_interface_view`]: super::ClientInstancesExt::instance_network_interface_view #[derive(Clone)] - pub struct InstanceNetworkInterfacesGetInterface<'a> { + pub struct InstanceNetworkInterfaceView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7611,7 +9222,7 @@ pub mod builder { interface_name: Option, } - impl<'a> InstanceNetworkInterfacesGetInterface<'a> { + impl<'a> InstanceNetworkInterfaceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7716,12 +9327,142 @@ pub mod builder { } } - ///Builder for - /// [`ClientInstancesExt::instance_network_interfaces_delete_interface`] + ///Builder for [`ClientInstancesExt::instance_network_interface_update`] /// - ///[`ClientInstancesExt::instance_network_interfaces_delete_interface`]: super::ClientInstancesExt::instance_network_interfaces_delete_interface + ///[`ClientInstancesExt::instance_network_interface_update`]: super::ClientInstancesExt::instance_network_interface_update #[derive(Clone)] - pub struct InstanceNetworkInterfacesDeleteInterface<'a> { + pub struct InstanceNetworkInterfaceUpdate<'a> { + client: &'a super::Client, + organization_name: Option, + project_name: Option, + instance_name: Option, + interface_name: Option, + body: Option, + } + + impl<'a> InstanceNetworkInterfaceUpdate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + organization_name: None, + project_name: None, + instance_name: None, + interface_name: None, + body: None, + } + } + + pub fn organization_name(mut self, value: types::Name) -> Self { + self.organization_name = Some(value); + self + } + + pub fn project_name(mut self, value: types::Name) -> Self { + self.project_name = Some(value); + self + } + + pub fn instance_name(mut self, value: types::Name) -> Self { + self.instance_name = Some(value); + self + } + + pub fn interface_name(mut self, value: types::Name) -> Self { + self.interface_name = Some(value); + self + } + + pub fn body(mut self, value: types::NetworkInterfaceUpdate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/ + /// instances/{instance_name}/network-interfaces/{interface_name}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + organization_name, + project_name, + instance_name, + interface_name, + body, + } = self; + let (organization_name, project_name, instance_name, interface_name, body) = match ( + organization_name, + project_name, + instance_name, + interface_name, + body, + ) { + ( + Some(organization_name), + Some(project_name), + Some(instance_name), + Some(interface_name), + Some(body), + ) => ( + organization_name, + project_name, + instance_name, + interface_name, + body, + ), + (organization_name, project_name, instance_name, interface_name, body) => { + let mut missing = Vec::new(); + if organization_name.is_none() { + missing.push(stringify!(organization_name)); + } + if project_name.is_none() { + missing.push(stringify!(project_name)); + } + if instance_name.is_none() { + missing.push(stringify!(instance_name)); + } + if interface_name.is_none() { + missing.push(stringify!(interface_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + 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()), + ); + let request = client.client.put(url).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)), + } + } + } + + ///Builder for [`ClientInstancesExt::instance_network_interface_delete`] + /// + ///[`ClientInstancesExt::instance_network_interface_delete`]: super::ClientInstancesExt::instance_network_interface_delete + #[derive(Clone)] + pub struct InstanceNetworkInterfaceDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7729,7 +9470,7 @@ pub mod builder { interface_name: Option, } - impl<'a> InstanceNetworkInterfacesDeleteInterface<'a> { + impl<'a> InstanceNetworkInterfaceDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7832,18 +9573,18 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_instance_reboot`] + ///Builder for [`ClientInstancesExt::instance_reboot`] /// - ///[`ClientInstancesExt::project_instances_instance_reboot`]: super::ClientInstancesExt::project_instances_instance_reboot + ///[`ClientInstancesExt::instance_reboot`]: super::ClientInstancesExt::instance_reboot #[derive(Clone)] - pub struct ProjectInstancesInstanceReboot<'a> { + pub struct InstanceReboot<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesInstanceReboot<'a> { + impl<'a> InstanceReboot<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7923,18 +9664,145 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_instance_start`] + ///Builder for [`ClientInstancesExt::instance_serial_console`] /// - ///[`ClientInstancesExt::project_instances_instance_start`]: super::ClientInstancesExt::project_instances_instance_start + ///[`ClientInstancesExt::instance_serial_console`]: super::ClientInstancesExt::instance_serial_console #[derive(Clone)] - pub struct ProjectInstancesInstanceStart<'a> { + pub struct InstanceSerialConsole<'a> { + client: &'a super::Client, + organization_name: Option, + project_name: Option, + instance_name: Option, + from_start: Option, + max_bytes: Option, + most_recent: Option, + } + + impl<'a> InstanceSerialConsole<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + organization_name: None, + project_name: None, + instance_name: None, + from_start: None, + max_bytes: None, + most_recent: None, + } + } + + pub fn organization_name(mut self, value: types::Name) -> Self { + self.organization_name = Some(value); + self + } + + pub fn project_name(mut self, value: types::Name) -> Self { + self.project_name = Some(value); + self + } + + pub fn instance_name(mut self, value: types::Name) -> Self { + self.instance_name = Some(value); + self + } + + pub fn from_start(mut self, value: u64) -> Self { + self.from_start = Some(value); + self + } + + pub fn max_bytes(mut self, value: u64) -> Self { + self.max_bytes = Some(value); + self + } + + pub fn most_recent(mut self, value: u64) -> Self { + self.most_recent = Some(value); + self + } + + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/ + /// instances/{instance_name}/serial-console` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + organization_name, + project_name, + instance_name, + from_start, + max_bytes, + most_recent, + } = self; + let (organization_name, project_name, instance_name) = + match (organization_name, project_name, instance_name) { + (Some(organization_name), Some(project_name), Some(instance_name)) => { + (organization_name, project_name, instance_name) + } + (organization_name, project_name, instance_name) => { + let mut missing = Vec::new(); + if organization_name.is_none() { + missing.push(stringify!(organization_name)); + } + if project_name.is_none() { + missing.push(stringify!(project_name)); + } + if instance_name.is_none() { + missing.push(stringify!(instance_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + 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::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + } + + ///Builder for [`ClientInstancesExt::instance_start`] + /// + ///[`ClientInstancesExt::instance_start`]: super::ClientInstancesExt::instance_start + #[derive(Clone)] + pub struct InstanceStart<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesInstanceStart<'a> { + impl<'a> InstanceStart<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8014,18 +9882,18 @@ pub mod builder { } } - ///Builder for [`ClientInstancesExt::project_instances_instance_stop`] + ///Builder for [`ClientInstancesExt::instance_stop`] /// - ///[`ClientInstancesExt::project_instances_instance_stop`]: super::ClientInstancesExt::project_instances_instance_stop + ///[`ClientInstancesExt::instance_stop`]: super::ClientInstancesExt::instance_stop #[derive(Clone)] - pub struct ProjectInstancesInstanceStop<'a> { + pub struct InstanceStop<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesInstanceStop<'a> { + impl<'a> InstanceStop<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8105,18 +9973,17 @@ pub mod builder { } } - ///Builder for - /// [`ClientProjectsExt::organization_projects_get_project_policy`] + ///Builder for [`ClientProjectsExt::project_policy_view`] /// - ///[`ClientProjectsExt::organization_projects_get_project_policy`]: super::ClientProjectsExt::organization_projects_get_project_policy + ///[`ClientProjectsExt::project_policy_view`]: super::ClientProjectsExt::project_policy_view #[derive(Clone)] - pub struct OrganizationProjectsGetProjectPolicy<'a> { + pub struct ProjectPolicyView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, } - impl<'a> OrganizationProjectsGetProjectPolicy<'a> { + impl<'a> ProjectPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8139,7 +10006,7 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -8183,19 +10050,18 @@ pub mod builder { } } - ///Builder for - /// [`ClientProjectsExt::organization_projects_put_project_policy`] + ///Builder for [`ClientProjectsExt::project_policy_update`] /// - ///[`ClientProjectsExt::organization_projects_put_project_policy`]: super::ClientProjectsExt::organization_projects_put_project_policy + ///[`ClientProjectsExt::project_policy_update`]: super::ClientProjectsExt::project_policy_update #[derive(Clone)] - pub struct OrganizationProjectsPutProjectPolicy<'a> { + pub struct ProjectPolicyUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, - body: Option, + body: Option, } - impl<'a> OrganizationProjectsPutProjectPolicy<'a> { + impl<'a> ProjectPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8215,7 +10081,7 @@ pub mod builder { self } - pub fn body(mut self, value: types::ProjectRolesPolicy) -> Self { + pub fn body(mut self, value: types::ProjectRolePolicy) -> Self { self.body = Some(value); self } @@ -8224,7 +10090,7 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -8275,11 +10141,11 @@ pub mod builder { } } - ///Builder for [`ClientSnapshotsExt::project_snapshots_get`] + ///Builder for [`ClientSnapshotsExt::snapshot_list`] /// - ///[`ClientSnapshotsExt::project_snapshots_get`]: super::ClientSnapshotsExt::project_snapshots_get + ///[`ClientSnapshotsExt::snapshot_list`]: super::ClientSnapshotsExt::snapshot_list #[derive(Clone)] - pub struct ProjectSnapshotsGet<'a> { + pub struct SnapshotList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -8288,7 +10154,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectSnapshotsGet<'a> { + impl<'a> SnapshotList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8436,18 +10302,18 @@ pub mod builder { } } - ///Builder for [`ClientSnapshotsExt::project_snapshots_post`] + ///Builder for [`ClientSnapshotsExt::snapshot_create`] /// - ///[`ClientSnapshotsExt::project_snapshots_post`]: super::ClientSnapshotsExt::project_snapshots_post + ///[`ClientSnapshotsExt::snapshot_create`]: super::ClientSnapshotsExt::snapshot_create #[derive(Clone)] - pub struct ProjectSnapshotsPost<'a> { + pub struct SnapshotCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectSnapshotsPost<'a> { + impl<'a> SnapshotCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8526,18 +10392,18 @@ pub mod builder { } } - ///Builder for [`ClientSnapshotsExt::project_snapshots_get_snapshot`] + ///Builder for [`ClientSnapshotsExt::snapshot_view`] /// - ///[`ClientSnapshotsExt::project_snapshots_get_snapshot`]: super::ClientSnapshotsExt::project_snapshots_get_snapshot + ///[`ClientSnapshotsExt::snapshot_view`]: super::ClientSnapshotsExt::snapshot_view #[derive(Clone)] - pub struct ProjectSnapshotsGetSnapshot<'a> { + pub struct SnapshotView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, snapshot_name: Option, } - impl<'a> ProjectSnapshotsGetSnapshot<'a> { + impl<'a> SnapshotView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8617,18 +10483,18 @@ pub mod builder { } } - ///Builder for [`ClientSnapshotsExt::project_snapshots_delete_snapshot`] + ///Builder for [`ClientSnapshotsExt::snapshot_delete`] /// - ///[`ClientSnapshotsExt::project_snapshots_delete_snapshot`]: super::ClientSnapshotsExt::project_snapshots_delete_snapshot + ///[`ClientSnapshotsExt::snapshot_delete`]: super::ClientSnapshotsExt::snapshot_delete #[derive(Clone)] - pub struct ProjectSnapshotsDeleteSnapshot<'a> { + pub struct SnapshotDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, snapshot_name: Option, } - impl<'a> ProjectSnapshotsDeleteSnapshot<'a> { + impl<'a> SnapshotDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8708,11 +10574,11 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::project_vpcs_get`] + ///Builder for [`ClientVpcsExt::vpc_list`] /// - ///[`ClientVpcsExt::project_vpcs_get`]: super::ClientVpcsExt::project_vpcs_get + ///[`ClientVpcsExt::vpc_list`]: super::ClientVpcsExt::vpc_list #[derive(Clone)] - pub struct ProjectVpcsGet<'a> { + pub struct VpcList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -8721,7 +10587,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectVpcsGet<'a> { + impl<'a> VpcList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8867,18 +10733,18 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::project_vpcs_post`] + ///Builder for [`ClientVpcsExt::vpc_create`] /// - ///[`ClientVpcsExt::project_vpcs_post`]: super::ClientVpcsExt::project_vpcs_post + ///[`ClientVpcsExt::vpc_create`]: super::ClientVpcsExt::vpc_create #[derive(Clone)] - pub struct ProjectVpcsPost<'a> { + pub struct VpcCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectVpcsPost<'a> { + impl<'a> VpcCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8956,18 +10822,18 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::project_vpcs_get_vpc`] + ///Builder for [`ClientVpcsExt::vpc_view`] /// - ///[`ClientVpcsExt::project_vpcs_get_vpc`]: super::ClientVpcsExt::project_vpcs_get_vpc + ///[`ClientVpcsExt::vpc_view`]: super::ClientVpcsExt::vpc_view #[derive(Clone)] - pub struct ProjectVpcsGetVpc<'a> { + pub struct VpcView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, vpc_name: Option, } - impl<'a> ProjectVpcsGetVpc<'a> { + impl<'a> VpcView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9047,11 +10913,11 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::project_vpcs_put_vpc`] + ///Builder for [`ClientVpcsExt::vpc_update`] /// - ///[`ClientVpcsExt::project_vpcs_put_vpc`]: super::ClientVpcsExt::project_vpcs_put_vpc + ///[`ClientVpcsExt::vpc_update`]: super::ClientVpcsExt::vpc_update #[derive(Clone)] - pub struct ProjectVpcsPutVpc<'a> { + pub struct VpcUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9059,7 +10925,7 @@ pub mod builder { body: Option, } - impl<'a> ProjectVpcsPutVpc<'a> { + impl<'a> VpcUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9149,18 +11015,18 @@ pub mod builder { } } - ///Builder for [`ClientVpcsExt::project_vpcs_delete_vpc`] + ///Builder for [`ClientVpcsExt::vpc_delete`] /// - ///[`ClientVpcsExt::project_vpcs_delete_vpc`]: super::ClientVpcsExt::project_vpcs_delete_vpc + ///[`ClientVpcsExt::vpc_delete`]: super::ClientVpcsExt::vpc_delete #[derive(Clone)] - pub struct ProjectVpcsDeleteVpc<'a> { + pub struct VpcDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, vpc_name: Option, } - impl<'a> ProjectVpcsDeleteVpc<'a> { + impl<'a> VpcDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9240,18 +11106,18 @@ pub mod builder { } } - ///Builder for [`ClientFirewallExt::vpc_firewall_rules_get`] + ///Builder for [`ClientVpcsExt::vpc_firewall_rules_view`] /// - ///[`ClientFirewallExt::vpc_firewall_rules_get`]: super::ClientFirewallExt::vpc_firewall_rules_get + ///[`ClientVpcsExt::vpc_firewall_rules_view`]: super::ClientVpcsExt::vpc_firewall_rules_view #[derive(Clone)] - pub struct VpcFirewallRulesGet<'a> { + pub struct VpcFirewallRulesView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, vpc_name: Option, } - impl<'a> VpcFirewallRulesGet<'a> { + impl<'a> VpcFirewallRulesView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9333,11 +11199,11 @@ pub mod builder { } } - ///Builder for [`ClientFirewallExt::vpc_firewall_rules_put`] + ///Builder for [`ClientVpcsExt::vpc_firewall_rules_update`] /// - ///[`ClientFirewallExt::vpc_firewall_rules_put`]: super::ClientFirewallExt::vpc_firewall_rules_put + ///[`ClientVpcsExt::vpc_firewall_rules_update`]: super::ClientVpcsExt::vpc_firewall_rules_update #[derive(Clone)] - pub struct VpcFirewallRulesPut<'a> { + pub struct VpcFirewallRulesUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9345,7 +11211,7 @@ pub mod builder { body: Option, } - impl<'a> VpcFirewallRulesPut<'a> { + impl<'a> VpcFirewallRulesUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9437,11 +11303,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutersExt::vpc_routers_get`] + ///Builder for [`ClientVpcsExt::vpc_router_list`] /// - ///[`ClientRoutersExt::vpc_routers_get`]: super::ClientRoutersExt::vpc_routers_get + ///[`ClientVpcsExt::vpc_router_list`]: super::ClientVpcsExt::vpc_router_list #[derive(Clone)] - pub struct VpcRoutersGet<'a> { + pub struct VpcRouterList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9451,7 +11317,7 @@ pub mod builder { sort_by: Option, } - impl<'a> VpcRoutersGet<'a> { + impl<'a> VpcRouterList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9613,11 +11479,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutersExt::vpc_routers_post`] + ///Builder for [`ClientVpcsExt::vpc_router_create`] /// - ///[`ClientRoutersExt::vpc_routers_post`]: super::ClientRoutersExt::vpc_routers_post + ///[`ClientVpcsExt::vpc_router_create`]: super::ClientVpcsExt::vpc_router_create #[derive(Clone)] - pub struct VpcRoutersPost<'a> { + pub struct VpcRouterCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9625,7 +11491,7 @@ pub mod builder { body: Option, } - impl<'a> VpcRoutersPost<'a> { + impl<'a> VpcRouterCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9715,11 +11581,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutersExt::vpc_routers_get_router`] + ///Builder for [`ClientVpcsExt::vpc_router_view`] /// - ///[`ClientRoutersExt::vpc_routers_get_router`]: super::ClientRoutersExt::vpc_routers_get_router + ///[`ClientVpcsExt::vpc_router_view`]: super::ClientVpcsExt::vpc_router_view #[derive(Clone)] - pub struct VpcRoutersGetRouter<'a> { + pub struct VpcRouterView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9727,7 +11593,7 @@ pub mod builder { router_name: Option, } - impl<'a> VpcRoutersGetRouter<'a> { + impl<'a> VpcRouterView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9821,11 +11687,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutersExt::vpc_routers_put_router`] + ///Builder for [`ClientVpcsExt::vpc_router_update`] /// - ///[`ClientRoutersExt::vpc_routers_put_router`]: super::ClientRoutersExt::vpc_routers_put_router + ///[`ClientVpcsExt::vpc_router_update`]: super::ClientVpcsExt::vpc_router_update #[derive(Clone)] - pub struct VpcRoutersPutRouter<'a> { + pub struct VpcRouterUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9834,7 +11700,7 @@ pub mod builder { body: Option, } - impl<'a> VpcRoutersPutRouter<'a> { + impl<'a> VpcRouterUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9939,11 +11805,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutersExt::vpc_routers_delete_router`] + ///Builder for [`ClientVpcsExt::vpc_router_delete`] /// - ///[`ClientRoutersExt::vpc_routers_delete_router`]: super::ClientRoutersExt::vpc_routers_delete_router + ///[`ClientVpcsExt::vpc_router_delete`]: super::ClientVpcsExt::vpc_router_delete #[derive(Clone)] - pub struct VpcRoutersDeleteRouter<'a> { + pub struct VpcRouterDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9951,7 +11817,7 @@ pub mod builder { router_name: Option, } - impl<'a> VpcRoutersDeleteRouter<'a> { + impl<'a> VpcRouterDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10045,11 +11911,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutesExt::routers_routes_get`] + ///Builder for [`ClientVpcsExt::vpc_router_route_list`] /// - ///[`ClientRoutesExt::routers_routes_get`]: super::ClientRoutesExt::routers_routes_get + ///[`ClientVpcsExt::vpc_router_route_list`]: super::ClientVpcsExt::vpc_router_route_list #[derive(Clone)] - pub struct RoutersRoutesGet<'a> { + pub struct VpcRouterRouteList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10060,7 +11926,7 @@ pub mod builder { sort_by: Option, } - impl<'a> RoutersRoutesGet<'a> { + impl<'a> VpcRouterRouteList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10236,11 +12102,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutesExt::routers_routes_post`] + ///Builder for [`ClientVpcsExt::vpc_router_route_create`] /// - ///[`ClientRoutesExt::routers_routes_post`]: super::ClientRoutesExt::routers_routes_post + ///[`ClientVpcsExt::vpc_router_route_create`]: super::ClientVpcsExt::vpc_router_route_create #[derive(Clone)] - pub struct RoutersRoutesPost<'a> { + pub struct VpcRouterRouteCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10249,7 +12115,7 @@ pub mod builder { body: Option, } - impl<'a> RoutersRoutesPost<'a> { + impl<'a> VpcRouterRouteCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10354,11 +12220,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutesExt::routers_routes_get_route`] + ///Builder for [`ClientVpcsExt::vpc_router_route_view`] /// - ///[`ClientRoutesExt::routers_routes_get_route`]: super::ClientRoutesExt::routers_routes_get_route + ///[`ClientVpcsExt::vpc_router_route_view`]: super::ClientVpcsExt::vpc_router_route_view #[derive(Clone)] - pub struct RoutersRoutesGetRoute<'a> { + pub struct VpcRouterRouteView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10367,7 +12233,7 @@ pub mod builder { route_name: Option, } - impl<'a> RoutersRoutesGetRoute<'a> { + impl<'a> VpcRouterRouteView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10484,11 +12350,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutesExt::routers_routes_put_route`] + ///Builder for [`ClientVpcsExt::vpc_router_route_update`] /// - ///[`ClientRoutesExt::routers_routes_put_route`]: super::ClientRoutesExt::routers_routes_put_route + ///[`ClientVpcsExt::vpc_router_route_update`]: super::ClientVpcsExt::vpc_router_route_update #[derive(Clone)] - pub struct RoutersRoutesPutRoute<'a> { + pub struct VpcRouterRouteUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10498,7 +12364,7 @@ pub mod builder { body: Option, } - impl<'a> RoutersRoutesPutRoute<'a> { + impl<'a> VpcRouterRouteUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10628,11 +12494,11 @@ pub mod builder { } } - ///Builder for [`ClientRoutesExt::routers_routes_delete_route`] + ///Builder for [`ClientVpcsExt::vpc_router_route_delete`] /// - ///[`ClientRoutesExt::routers_routes_delete_route`]: super::ClientRoutesExt::routers_routes_delete_route + ///[`ClientVpcsExt::vpc_router_route_delete`]: super::ClientVpcsExt::vpc_router_route_delete #[derive(Clone)] - pub struct RoutersRoutesDeleteRoute<'a> { + pub struct VpcRouterRouteDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10641,7 +12507,7 @@ pub mod builder { route_name: Option, } - impl<'a> RoutersRoutesDeleteRoute<'a> { + impl<'a> VpcRouterRouteDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10758,11 +12624,11 @@ pub mod builder { } } - ///Builder for [`ClientSubnetsExt::vpc_subnets_get`] + ///Builder for [`ClientVpcsExt::vpc_subnet_list`] /// - ///[`ClientSubnetsExt::vpc_subnets_get`]: super::ClientSubnetsExt::vpc_subnets_get + ///[`ClientVpcsExt::vpc_subnet_list`]: super::ClientVpcsExt::vpc_subnet_list #[derive(Clone)] - pub struct VpcSubnetsGet<'a> { + pub struct VpcSubnetList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10772,7 +12638,7 @@ pub mod builder { sort_by: Option, } - impl<'a> VpcSubnetsGet<'a> { + impl<'a> VpcSubnetList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10934,11 +12800,11 @@ pub mod builder { } } - ///Builder for [`ClientSubnetsExt::vpc_subnets_post`] + ///Builder for [`ClientVpcsExt::vpc_subnet_create`] /// - ///[`ClientSubnetsExt::vpc_subnets_post`]: super::ClientSubnetsExt::vpc_subnets_post + ///[`ClientVpcsExt::vpc_subnet_create`]: super::ClientVpcsExt::vpc_subnet_create #[derive(Clone)] - pub struct VpcSubnetsPost<'a> { + pub struct VpcSubnetCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10946,7 +12812,7 @@ pub mod builder { body: Option, } - impl<'a> VpcSubnetsPost<'a> { + impl<'a> VpcSubnetCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11036,11 +12902,11 @@ pub mod builder { } } - ///Builder for [`ClientSubnetsExt::vpc_subnets_get_subnet`] + ///Builder for [`ClientVpcsExt::vpc_subnet_view`] /// - ///[`ClientSubnetsExt::vpc_subnets_get_subnet`]: super::ClientSubnetsExt::vpc_subnets_get_subnet + ///[`ClientVpcsExt::vpc_subnet_view`]: super::ClientVpcsExt::vpc_subnet_view #[derive(Clone)] - pub struct VpcSubnetsGetSubnet<'a> { + pub struct VpcSubnetView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -11048,7 +12914,7 @@ pub mod builder { subnet_name: Option, } - impl<'a> VpcSubnetsGetSubnet<'a> { + impl<'a> VpcSubnetView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11142,11 +13008,11 @@ pub mod builder { } } - ///Builder for [`ClientSubnetsExt::vpc_subnets_put_subnet`] + ///Builder for [`ClientVpcsExt::vpc_subnet_update`] /// - ///[`ClientSubnetsExt::vpc_subnets_put_subnet`]: super::ClientSubnetsExt::vpc_subnets_put_subnet + ///[`ClientVpcsExt::vpc_subnet_update`]: super::ClientVpcsExt::vpc_subnet_update #[derive(Clone)] - pub struct VpcSubnetsPutSubnet<'a> { + pub struct VpcSubnetUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -11155,7 +13021,7 @@ pub mod builder { body: Option, } - impl<'a> VpcSubnetsPutSubnet<'a> { + impl<'a> VpcSubnetUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11260,11 +13126,11 @@ pub mod builder { } } - ///Builder for [`ClientSubnetsExt::vpc_subnets_delete_subnet`] + ///Builder for [`ClientVpcsExt::vpc_subnet_delete`] /// - ///[`ClientSubnetsExt::vpc_subnets_delete_subnet`]: super::ClientSubnetsExt::vpc_subnets_delete_subnet + ///[`ClientVpcsExt::vpc_subnet_delete`]: super::ClientVpcsExt::vpc_subnet_delete #[derive(Clone)] - pub struct VpcSubnetsDeleteSubnet<'a> { + pub struct VpcSubnetDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -11272,7 +13138,7 @@ pub mod builder { subnet_name: Option, } - impl<'a> VpcSubnetsDeleteSubnet<'a> { + impl<'a> VpcSubnetDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11366,11 +13232,11 @@ pub mod builder { } } - ///Builder for [`ClientSubnetsExt::subnet_network_interfaces_get`] + ///Builder for [`ClientVpcsExt::vpc_subnet_list_network_interfaces`] /// - ///[`ClientSubnetsExt::subnet_network_interfaces_get`]: super::ClientSubnetsExt::subnet_network_interfaces_get + ///[`ClientVpcsExt::vpc_subnet_list_network_interfaces`]: super::ClientVpcsExt::vpc_subnet_list_network_interfaces #[derive(Clone)] - pub struct SubnetNetworkInterfacesGet<'a> { + pub struct VpcSubnetListNetworkInterfaces<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -11381,7 +13247,7 @@ pub mod builder { sort_by: Option, } - impl<'a> SubnetNetworkInterfacesGet<'a> { + impl<'a> VpcSubnetListNetworkInterfaces<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11558,15 +13424,15 @@ pub mod builder { } } - ///Builder for [`ClientPolicyExt::policy_get`] + ///Builder for [`ClientPolicyExt::policy_view`] /// - ///[`ClientPolicyExt::policy_get`]: super::ClientPolicyExt::policy_get + ///[`ClientPolicyExt::policy_view`]: super::ClientPolicyExt::policy_view #[derive(Clone)] - pub struct PolicyGet<'a> { + pub struct PolicyView<'a> { client: &'a super::Client, } - impl<'a> PolicyGet<'a> { + impl<'a> PolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } @@ -11574,7 +13440,7 @@ pub mod builder { ///Sends a `GET` request to `/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client } = self; let url = format!("{}/policy", client.baseurl,); let request = client.client.get(url).build()?; @@ -11593,21 +13459,21 @@ pub mod builder { } } - ///Builder for [`ClientPolicyExt::policy_put`] + ///Builder for [`ClientPolicyExt::policy_update`] /// - ///[`ClientPolicyExt::policy_put`]: super::ClientPolicyExt::policy_put + ///[`ClientPolicyExt::policy_update`]: super::ClientPolicyExt::policy_update #[derive(Clone)] - pub struct PolicyPut<'a> { + pub struct PolicyUpdate<'a> { client: &'a super::Client, - body: Option, + body: Option, } - impl<'a> PolicyPut<'a> { + impl<'a> PolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } - pub fn body(mut self, value: types::FleetRolesPolicy) -> Self { + pub fn body(mut self, value: types::FleetRolePolicy) -> Self { self.body = Some(value); self } @@ -11615,7 +13481,7 @@ pub mod builder { ///Sends a `PUT` request to `/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, body } = self; let (body,) = match (body,) { (Some(body),) => (body,), @@ -11647,17 +13513,17 @@ pub mod builder { } } - ///Builder for [`ClientRolesExt::roles_get`] + ///Builder for [`ClientRolesExt::role_list`] /// - ///[`ClientRolesExt::roles_get`]: super::ClientRolesExt::roles_get + ///[`ClientRolesExt::role_list`]: super::ClientRolesExt::role_list #[derive(Clone)] - pub struct RolesGet<'a> { + pub struct RoleList<'a> { client: &'a super::Client, limit: Option, page_token: Option, } - impl<'a> RolesGet<'a> { + impl<'a> RoleList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11755,16 +13621,16 @@ pub mod builder { } } - ///Builder for [`ClientRolesExt::roles_get_role`] + ///Builder for [`ClientRolesExt::role_view`] /// - ///[`ClientRolesExt::roles_get_role`]: super::ClientRolesExt::roles_get_role + ///[`ClientRolesExt::role_view`]: super::ClientRolesExt::role_view #[derive(Clone)] - pub struct RolesGetRole<'a> { + pub struct RoleView<'a> { client: &'a super::Client, role_name: Option, } - impl<'a> RolesGetRole<'a> { + impl<'a> RoleView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11814,18 +13680,18 @@ pub mod builder { } } - ///Builder for [`ClientSagasExt::sagas_get`] + ///Builder for [`ClientSagasExt::saga_list`] /// - ///[`ClientSagasExt::sagas_get`]: super::ClientSagasExt::sagas_get + ///[`ClientSagasExt::saga_list`]: super::ClientSagasExt::saga_list #[derive(Clone)] - pub struct SagasGet<'a> { + pub struct SagaList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> SagasGet<'a> { + impl<'a> SagaList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11934,16 +13800,16 @@ pub mod builder { } } - ///Builder for [`ClientSagasExt::sagas_get_saga`] + ///Builder for [`ClientSagasExt::saga_view`] /// - ///[`ClientSagasExt::sagas_get_saga`]: super::ClientSagasExt::sagas_get_saga + ///[`ClientSagasExt::saga_view`]: super::ClientSagasExt::saga_view #[derive(Clone)] - pub struct SagasGetSaga<'a> { + pub struct SagaView<'a> { client: &'a super::Client, saga_id: Option, } - impl<'a> SagasGetSaga<'a> { + impl<'a> SagaView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12026,18 +13892,18 @@ pub mod builder { } } - ///Builder for [`ClientSshkeysExt::sshkeys_get`] + ///Builder for [`ClientSessionExt::session_sshkey_list`] /// - ///[`ClientSshkeysExt::sshkeys_get`]: super::ClientSshkeysExt::sshkeys_get + ///[`ClientSessionExt::session_sshkey_list`]: super::ClientSessionExt::session_sshkey_list #[derive(Clone)] - pub struct SshkeysGet<'a> { + pub struct SessionSshkeyList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> SshkeysGet<'a> { + impl<'a> SessionSshkeyList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12146,16 +14012,16 @@ pub mod builder { } } - ///Builder for [`ClientSshkeysExt::sshkeys_post`] + ///Builder for [`ClientSessionExt::session_sshkey_create`] /// - ///[`ClientSshkeysExt::sshkeys_post`]: super::ClientSshkeysExt::sshkeys_post + ///[`ClientSessionExt::session_sshkey_create`]: super::ClientSessionExt::session_sshkey_create #[derive(Clone)] - pub struct SshkeysPost<'a> { + pub struct SessionSshkeyCreate<'a> { client: &'a super::Client, body: Option, } - impl<'a> SshkeysPost<'a> { + impl<'a> SessionSshkeyCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } @@ -12198,16 +14064,16 @@ pub mod builder { } } - ///Builder for [`ClientSshkeysExt::sshkeys_get_key`] + ///Builder for [`ClientSessionExt::session_sshkey_view`] /// - ///[`ClientSshkeysExt::sshkeys_get_key`]: super::ClientSshkeysExt::sshkeys_get_key + ///[`ClientSessionExt::session_sshkey_view`]: super::ClientSessionExt::session_sshkey_view #[derive(Clone)] - pub struct SshkeysGetKey<'a> { + pub struct SessionSshkeyView<'a> { client: &'a super::Client, ssh_key_name: Option, } - impl<'a> SshkeysGetKey<'a> { + impl<'a> SessionSshkeyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12260,16 +14126,16 @@ pub mod builder { } } - ///Builder for [`ClientSshkeysExt::sshkeys_delete_key`] + ///Builder for [`ClientSessionExt::session_sshkey_delete`] /// - ///[`ClientSshkeysExt::sshkeys_delete_key`]: super::ClientSshkeysExt::sshkeys_delete_key + ///[`ClientSessionExt::session_sshkey_delete`]: super::ClientSessionExt::session_sshkey_delete #[derive(Clone)] - pub struct SshkeysDeleteKey<'a> { + pub struct SessionSshkeyDelete<'a> { client: &'a super::Client, ssh_key_name: Option, } - impl<'a> SshkeysDeleteKey<'a> { + impl<'a> SessionSshkeyDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12322,18 +14188,18 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::silos_get`] + ///Builder for [`ClientSilosExt::silo_list`] /// - ///[`ClientSilosExt::silos_get`]: super::ClientSilosExt::silos_get + ///[`ClientSilosExt::silo_list`]: super::ClientSilosExt::silo_list #[derive(Clone)] - pub struct SilosGet<'a> { + pub struct SiloList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> SilosGet<'a> { + impl<'a> SiloList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12442,16 +14308,16 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::silos_post`] + ///Builder for [`ClientSilosExt::silo_create`] /// - ///[`ClientSilosExt::silos_post`]: super::ClientSilosExt::silos_post + ///[`ClientSilosExt::silo_create`]: super::ClientSilosExt::silo_create #[derive(Clone)] - pub struct SilosPost<'a> { + pub struct SiloCreate<'a> { client: &'a super::Client, body: Option, } - impl<'a> SilosPost<'a> { + impl<'a> SiloCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } @@ -12494,16 +14360,16 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::silos_get_silo`] + ///Builder for [`ClientSilosExt::silo_view`] /// - ///[`ClientSilosExt::silos_get_silo`]: super::ClientSilosExt::silos_get_silo + ///[`ClientSilosExt::silo_view`]: super::ClientSilosExt::silo_view #[derive(Clone)] - pub struct SilosGetSilo<'a> { + pub struct SiloView<'a> { client: &'a super::Client, silo_name: Option, } - impl<'a> SilosGetSilo<'a> { + impl<'a> SiloView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12553,16 +14419,16 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::silos_delete_silo`] + ///Builder for [`ClientSilosExt::silo_delete`] /// - ///[`ClientSilosExt::silos_delete_silo`]: super::ClientSilosExt::silos_delete_silo + ///[`ClientSilosExt::silo_delete`]: super::ClientSilosExt::silo_delete #[derive(Clone)] - pub struct SilosDeleteSilo<'a> { + pub struct SiloDelete<'a> { client: &'a super::Client, silo_name: Option, } - impl<'a> SilosDeleteSilo<'a> { + impl<'a> SiloDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12612,16 +14478,162 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::silos_get_silo_policy`] + ///Builder for [`ClientSilosExt::silo_identity_provider_list`] /// - ///[`ClientSilosExt::silos_get_silo_policy`]: super::ClientSilosExt::silos_get_silo_policy + ///[`ClientSilosExt::silo_identity_provider_list`]: super::ClientSilosExt::silo_identity_provider_list #[derive(Clone)] - pub struct SilosGetSiloPolicy<'a> { + pub struct SiloIdentityProviderList<'a> { + client: &'a super::Client, + silo_name: Option, + limit: Option, + page_token: Option, + sort_by: Option, + } + + impl<'a> SiloIdentityProviderList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + limit: None, + page_token: None, + sort_by: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + pub fn sort_by(mut self, value: types::NameSortMode) -> Self { + self.sort_by = Some(value); + self + } + + ///Sends a `GET` request to `/silos/{silo_name}/identity_providers` + pub async fn send( + self, + ) -> Result, Error> + { + let Self { + client, + silo_name, + limit, + page_token, + sort_by, + } = self; + let (silo_name,) = match (silo_name,) { + (Some(silo_name),) => (silo_name,), + (silo_name,) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/silos/{}/identity_providers", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/silos/{silo_name}/identity_providers` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + sort_by: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`ClientSilosExt::silo_policy_view`] + /// + ///[`ClientSilosExt::silo_policy_view`]: super::ClientSilosExt::silo_policy_view + #[derive(Clone)] + pub struct SiloPolicyView<'a> { client: &'a super::Client, silo_name: Option, } - impl<'a> SilosGetSiloPolicy<'a> { + impl<'a> SiloPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12637,7 +14649,7 @@ pub mod builder { ///Sends a `GET` request to `/silos/{silo_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, silo_name } = self; let (silo_name,) = match (silo_name,) { (Some(silo_name),) => (silo_name,), @@ -12673,17 +14685,17 @@ pub mod builder { } } - ///Builder for [`ClientSilosExt::silos_put_silo_policy`] + ///Builder for [`ClientSilosExt::silo_policy_update`] /// - ///[`ClientSilosExt::silos_put_silo_policy`]: super::ClientSilosExt::silos_put_silo_policy + ///[`ClientSilosExt::silo_policy_update`]: super::ClientSilosExt::silo_policy_update #[derive(Clone)] - pub struct SilosPutSiloPolicy<'a> { + pub struct SiloPolicyUpdate<'a> { client: &'a super::Client, silo_name: Option, - body: Option, + body: Option, } - impl<'a> SilosPutSiloPolicy<'a> { + impl<'a> SiloPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12697,7 +14709,7 @@ pub mod builder { self } - pub fn body(mut self, value: types::SiloRolesPolicy) -> Self { + pub fn body(mut self, value: types::SiloRolePolicy) -> Self { self.body = Some(value); self } @@ -12705,7 +14717,7 @@ pub mod builder { ///Sends a `PUT` request to `/silos/{silo_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, silo_name, @@ -12748,6 +14760,338 @@ pub mod builder { } } + ///Builder for [`ClientSilosExt::silo_identity_provider_create`] + /// + ///[`ClientSilosExt::silo_identity_provider_create`]: super::ClientSilosExt::silo_identity_provider_create + #[derive(Clone)] + pub struct SiloIdentityProviderCreate<'a> { + client: &'a super::Client, + silo_name: Option, + body: Option, + } + + impl<'a> SiloIdentityProviderCreate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + body: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn body(mut self, value: types::SamlIdentityProviderCreate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to + /// `/silos/{silo_name}/saml_identity_providers` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + silo_name, + body, + } = self; + let (silo_name, body) = match (silo_name, body) { + (Some(silo_name), Some(body)) => (silo_name, body), + (silo_name, body) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/silos/{}/saml_identity_providers", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`ClientSilosExt::silo_identity_provider_view`] + /// + ///[`ClientSilosExt::silo_identity_provider_view`]: super::ClientSilosExt::silo_identity_provider_view + #[derive(Clone)] + pub struct SiloIdentityProviderView<'a> { + client: &'a super::Client, + silo_name: Option, + provider_name: Option, + } + + impl<'a> SiloIdentityProviderView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + provider_name: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn provider_name(mut self, value: types::Name) -> Self { + self.provider_name = Some(value); + self + } + + ///Sends a `GET` request to + /// `/silos/{silo_name}/saml_identity_providers/{provider_name}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + silo_name, + provider_name, + } = self; + let (silo_name, provider_name) = match (silo_name, provider_name) { + (Some(silo_name), Some(provider_name)) => (silo_name, provider_name), + (silo_name, provider_name) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if provider_name.is_none() { + missing.push(stringify!(provider_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/silos/{}/saml_identity_providers/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let request = client.client.get(url).build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 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 [`ClientSystemExt::system_user_list`] + /// + ///[`ClientSystemExt::system_user_list`]: super::ClientSystemExt::system_user_list + #[derive(Clone)] + pub struct SystemUserList<'a> { + client: &'a super::Client, + limit: Option, + page_token: Option, + sort_by: Option, + } + + impl<'a> SystemUserList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + limit: None, + page_token: None, + sort_by: None, + } + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + pub fn sort_by(mut self, value: types::NameSortMode) -> Self { + self.sort_by = Some(value); + self + } + + ///Sends a `GET` request to `/system/user` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + limit, + page_token, + sort_by, + } = self; + let url = format!("{}/system/user", client.baseurl,); + let mut query = Vec::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/system/user` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + sort_by: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`ClientSystemExt::system_user_view`] + /// + ///[`ClientSystemExt::system_user_view`]: super::ClientSystemExt::system_user_view + #[derive(Clone)] + pub struct SystemUserView<'a> { + client: &'a super::Client, + user_name: Option, + } + + impl<'a> SystemUserView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + user_name: None, + } + } + + pub fn user_name(mut self, value: types::Name) -> Self { + self.user_name = Some(value); + self + } + + ///Sends a `GET` request to `/system/user/{user_name}` + pub async fn send(self) -> Result, Error> { + let Self { client, user_name } = self; + let (user_name,) = match (user_name,) { + (Some(user_name),) => (user_name,), + (user_name,) => { + let mut missing = Vec::new(); + if user_name.is_none() { + missing.push(stringify!(user_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/system/user/{}", + client.baseurl, + encode_path(&user_name.to_string()), + ); + let request = client.client.get(url).build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 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 [`ClientMetricsExt::timeseries_schema_get`] /// ///[`ClientMetricsExt::timeseries_schema_get`]: super::ClientMetricsExt::timeseries_schema_get @@ -12890,18 +15234,18 @@ pub mod builder { } } - ///Builder for [`ClientUsersExt::users_get`] + ///Builder for [`ClientSilosExt::user_list`] /// - ///[`ClientUsersExt::users_get`]: super::ClientUsersExt::users_get + ///[`ClientSilosExt::user_list`]: super::ClientSilosExt::user_list #[derive(Clone)] - pub struct UsersGet<'a> { + pub struct UserList<'a> { client: &'a super::Client, limit: Option, page_token: Option, - sort_by: Option, + sort_by: Option, } - impl<'a> UsersGet<'a> { + impl<'a> UserList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12921,7 +15265,7 @@ pub mod builder { self } - pub fn sort_by(mut self, value: types::NameSortMode) -> Self { + pub fn sort_by(mut self, value: types::IdSortMode) -> Self { self.sort_by = Some(value); self } @@ -13009,63 +15353,4 @@ pub mod builder { .boxed() } } - - ///Builder for [`ClientUsersExt::users_get_user`] - /// - ///[`ClientUsersExt::users_get_user`]: super::ClientUsersExt::users_get_user - #[derive(Clone)] - pub struct UsersGetUser<'a> { - client: &'a super::Client, - user_name: Option, - } - - impl<'a> UsersGetUser<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { - client, - user_name: None, - } - } - - pub fn user_name(mut self, value: types::Name) -> Self { - self.user_name = Some(value); - self - } - - ///Sends a `GET` request to `/users/{user_name}` - pub async fn send(self) -> Result, Error> { - let Self { client, user_name } = self; - let (user_name,) = match (user_name,) { - (Some(user_name),) => (user_name,), - (user_name,) => { - let mut missing = Vec::new(); - if user_name.is_none() { - missing.push(stringify!(user_name)); - } - return Err(super::Error::InvalidRequest(format!( - "the following parameters are required: {}", - missing.join(", "), - ))); - } - }; - let url = format!( - "{}/users/{}", - client.baseurl, - encode_path(&user_name.to_string()), - ); - let request = client.client.get(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } } diff --git a/progenitor-impl/tests/output/nexus-builder.out b/progenitor-impl/tests/output/nexus-builder.out index 13e4a8e..250b3d2 100644 --- a/progenitor-impl/tests/output/nexus-builder.out +++ b/progenitor-impl/tests/output/nexus-builder.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -80,6 +80,31 @@ pub mod types { } } + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct DerEncodedKeyPair { + ///request signing private key (base64 encoded der file) + pub private_key: String, + ///request signing public certificate (base64 encoded der file) + pub public_cert: String, + } + + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct DeviceAccessTokenRequest { + pub client_id: uuid::Uuid, + pub device_code: String, + pub grant_type: String, + } + + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct DeviceAuthRequest { + pub client_id: uuid::Uuid, + } + + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct DeviceAuthVerify { + pub user_code: String, + } + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Digest { #[serde(rename = "type")] @@ -103,7 +128,7 @@ pub mod types { } } - ///Client view of an [`Disk`] + ///Client view of a [`Disk`] #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Disk { pub block_size: ByteCount, @@ -201,6 +226,15 @@ pub mod types { Faulted, } + ///OS image distribution + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct Distribution { + ///The name of the distribution (e.g. "alpine" or "ubuntu") + pub name: Name, + ///The version of the distribution (e.g. "3.10" or "18.04") + pub version: String, + } + ///Error information from a response. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Error { @@ -270,7 +304,7 @@ pub mod types { #[derive( Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, )] - pub enum FleetRoles { + pub enum FleetRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -279,12 +313,12 @@ pub mod types { Viewer, } - impl ToString for FleetRoles { + impl ToString for FleetRole { fn to_string(&self) -> String { match *self { - FleetRoles::Admin => "admin".to_string(), - FleetRoles::Collaborator => "collaborator".to_string(), - FleetRoles::Viewer => "viewer".to_string(), + FleetRole::Admin => "admin".to_string(), + FleetRole::Collaborator => "collaborator".to_string(), + FleetRole::Viewer => "viewer".to_string(), } } } @@ -296,9 +330,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct FleetRolesPolicy { + pub struct FleetRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -308,10 +342,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct FleetRolesRoleAssignment { + pub struct FleetRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: FleetRoles, + pub role_name: FleetRole, } ///Client view of global Images @@ -324,6 +358,8 @@ pub mod types { ///Hash of the image contents, if applicable #[serde(default, skip_serializing_if = "Option::is_none")] pub digest: Option, + ///Image distribution + pub distribution: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource @@ -337,9 +373,22 @@ pub mod types { ///URL source of this image, if any #[serde(default, skip_serializing_if = "Option::is_none")] pub url: Option, - ///Version of this, if any - #[serde(default, skip_serializing_if = "Option::is_none")] - pub version: Option, + ///Image version + pub version: String, + } + + ///Create-time parameters for an + /// [`GlobalImage`](omicron_common::api::external::GlobalImage) + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct GlobalImageCreate { + ///block size in bytes + pub block_size: BlockSize, + pub description: String, + ///OS image distribution + pub distribution: Distribution, + pub name: Name, + ///The source of the image's contents. + pub source: ImageSource, } ///A single page of results @@ -371,6 +420,49 @@ pub mod types { } } + ///Client view of an [`IdentityProvider`] + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IdentityProvider { + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///Identity provider type + pub provider_type: IdentityProviderType, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IdentityProviderResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + #[derive( + Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, + )] + pub enum IdentityProviderType { + #[serde(rename = "saml")] + Saml, + } + + impl ToString for IdentityProviderType { + fn to_string(&self) -> String { + match *self { + IdentityProviderType::Saml => "saml".to_string(), + } + } + } + ///Describes what kind of identity is described by an id #[derive( Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, @@ -388,6 +480,15 @@ pub mod types { } } + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + #[serde(tag = "type")] + pub enum IdpMetadataSource { + #[serde(rename = "url")] + Url { url: String }, + #[serde(rename = "base64_encoded_xml")] + Base64EncodedXml { data: String }, + } + ///Client view of project Images #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Image { @@ -442,12 +543,14 @@ pub mod types { ///The source of the underlying image. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - #[serde(tag = "type", content = "src")] + #[serde(tag = "type")] pub enum ImageSource { #[serde(rename = "url")] - Url(String), + Url { url: String }, #[serde(rename = "snapshot")] - Snapshot(uuid::Uuid), + Snapshot { id: uuid::Uuid }, + #[serde(rename = "you_can_boot_anything_as_long_as_its_alpine")] + YouCanBootAnythingAsLongAsItsAlpine, } ///Client view of an [`Instance`] @@ -537,7 +640,7 @@ pub mod types { /// [`Instance`](omicron_common::api::external::Instance) #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct InstanceMigrate { - pub dst_sled_uuid: uuid::Uuid, + pub dst_sled_id: uuid::Uuid, } ///Describes an attachment of a `NetworkInterface` to an `Instance`, at the @@ -545,7 +648,10 @@ pub mod types { #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] #[serde(tag = "type", content = "params")] pub enum InstanceNetworkInterfaceAttachment { - ///Create one or more `NetworkInterface`s for the `Instance` + ///Create one or more `NetworkInterface`s for the `Instance`. + /// + ///If more than one interface is provided, then the first will be + /// designated the primary interface for the instance. #[serde(rename = "create")] Create(Vec), #[serde(rename = "default")] @@ -564,6 +670,18 @@ pub mod types { pub next_page: Option, } + ///Contents of an Instance's serial console buffer. + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct InstanceSerialConsoleData { + ///The bytes starting from the requested offset up to either the end of + /// the buffer or the request's `max_bytes`. Provided as a u8 array + /// rather than a string, as it may not be UTF-8. + pub data: Vec, + ///The absolute offset since boot (suitable for use as `byte_offset` in + /// a subsequent request) of the last byte returned in `data`. + pub last_byte_offset: u64, + } + ///Running state of an Instance (primarily: booted or stopped) /// ///This typically reflects whether it's starting, running, stopping, or @@ -618,6 +736,74 @@ pub mod types { V6(Ipv6Net), } + ///Identity-related metadata that's included in nearly all public API + /// objects + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IpPool { + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///Create-time parameters for an IP Pool. + /// + ///See [`IpPool`](omicron_nexus::external_api::views::IpPool) + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IpPoolCreate { + pub description: String, + pub name: Name, + } + + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IpPoolRange { + pub id: uuid::Uuid, + pub range: IpRange, + pub time_created: chrono::DateTime, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IpPoolRangeResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IpPoolResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///Parameters for updating an IP Pool + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct IpPoolUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + #[serde(untagged)] + pub enum IpRange { + V4(Ipv4Range), + V6(Ipv6Range), + } + ///An IPv4 subnet, including prefix and subnet mask #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Ipv4Net(pub String); @@ -628,6 +814,15 @@ pub mod types { } } + ///A non-decreasing IPv4 address range, inclusive of both ends. + /// + ///The first address must be less than or equal to the last address. + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct Ipv4Range { + pub first: std::net::Ipv4Addr, + pub last: std::net::Ipv4Addr, + } + ///An IPv6 subnet, including prefix and subnet mask #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Ipv6Net(pub String); @@ -638,6 +833,15 @@ pub mod types { } } + ///A non-decreasing IPv6 address range, inclusive of both ends. + /// + ///The first address must be less than or equal to the last address. + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct Ipv6Range { + pub first: std::net::Ipv6Addr, + pub last: std::net::Ipv6Addr, + } + ///An inclusive-inclusive range of IP ports. The second port may be omitted /// to represent a single port #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] @@ -649,11 +853,6 @@ pub mod types { } } - #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct LoginParams { - pub username: String, - } - ///A Media Access Control address, in EUI-48 format #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct MacAddr(pub String); @@ -733,6 +932,9 @@ pub mod types { pub mac: MacAddr, ///unique, mutable, user-controlled identifier for each resource pub name: Name, + ///True if this interface is the primary for the instance to which it's + /// attached. + pub primary: bool, ///The subnet to which the interface belongs. pub subnet_id: uuid::Uuid, ///timestamp when this resource was created @@ -769,6 +971,43 @@ pub mod types { pub next_page: Option, } + ///Parameters for updating a + /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface). + /// + ///Note that modifying IP addresses for an interface is not yet supported, + /// a new interface must be created instead. + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct NetworkInterfaceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + ///Make a secondary interface the instance's primary interface. + /// + ///If applied to a secondary interface, that interface will become the + /// primary on the next reboot of the instance. Note that this may have + /// implications for routing between instances, as the new primary + /// interface will be on a distinct subnet from the previous primary + /// interface. + /// + ///Note that this can only be used to select a new primary interface + /// for an instance. Requests to change the primary interface into a + /// secondary will return an error. + #[serde(default)] + pub make_primary: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + #[derive( + Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, + )] + pub enum Null {} + + impl ToString for Null { + fn to_string(&self) -> String { + match *self {} + } + } + ///Client view of an [`Organization`] #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Organization { @@ -805,18 +1044,21 @@ pub mod types { #[derive( Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, )] - pub enum OrganizationRoles { + pub enum OrganizationRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, + #[serde(rename = "viewer")] + Viewer, } - impl ToString for OrganizationRoles { + impl ToString for OrganizationRole { fn to_string(&self) -> String { match *self { - OrganizationRoles::Admin => "admin".to_string(), - OrganizationRoles::Collaborator => "collaborator".to_string(), + OrganizationRole::Admin => "admin".to_string(), + OrganizationRole::Collaborator => "collaborator".to_string(), + OrganizationRole::Viewer => "viewer".to_string(), } } } @@ -828,9 +1070,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct OrganizationRolesPolicy { + pub struct OrganizationRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -840,10 +1082,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct OrganizationRolesRoleAssignment { + pub struct OrganizationRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: OrganizationRoles, + pub role_name: OrganizationRole, } ///Updateable properties of an @@ -893,7 +1135,7 @@ pub mod types { #[derive( Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, )] - pub enum ProjectRoles { + pub enum ProjectRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -902,12 +1144,12 @@ pub mod types { Viewer, } - impl ToString for ProjectRoles { + impl ToString for ProjectRole { fn to_string(&self) -> String { match *self { - ProjectRoles::Admin => "admin".to_string(), - ProjectRoles::Collaborator => "collaborator".to_string(), - ProjectRoles::Viewer => "viewer".to_string(), + ProjectRole::Admin => "admin".to_string(), + ProjectRole::Collaborator => "collaborator".to_string(), + ProjectRole::Viewer => "viewer".to_string(), } } } @@ -919,9 +1161,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct ProjectRolesPolicy { + pub struct ProjectRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -931,10 +1173,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct ProjectRolesRoleAssignment { + pub struct ProjectRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: ProjectRoles, + pub role_name: ProjectRole, } ///Updateable properties of a @@ -950,12 +1192,8 @@ pub mod types { ///Client view of an [`Rack`] #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Rack { - ///human-readable free-form text about a resource - pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, - ///unique, mutable, user-controlled identifier for each resource - pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified @@ -1171,6 +1409,58 @@ pub mod types { }, } + ///Identity-related metadata that's included in nearly all public API + /// objects + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct SamlIdentityProvider { + ///service provider endpoint where the response will be sent + pub acs_url: String, + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///idp's entity id + pub idp_entity_id: String, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///optional request signing public certificate (base64 encoded der + /// file) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public_cert: Option, + ///service provider endpoint where the idp should send log out requests + pub slo_url: String, + ///sp's client id + pub sp_client_id: String, + ///customer's technical contact for saml configuration + pub technical_contact_email: String, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///Create-time identity-related parameters + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct SamlIdentityProviderCreate { + ///service provider endpoint where the response will be sent + pub acs_url: String, + pub description: String, + ///idp's entity id + pub idp_entity_id: String, + ///the source of an identity provider metadata descriptor + pub idp_metadata_source: IdpMetadataSource, + pub name: Name, + ///optional request signing key pair + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signing_keypair: Option, + ///service provider endpoint where the idp should send log out requests + pub slo_url: String, + ///sp's client id + pub sp_client_id: String, + ///customer's technical contact for saml configuration + pub technical_contact_email: String, + } + ///Client view of currently authed user. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct SessionUser { @@ -1193,6 +1483,8 @@ pub mod types { pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, + ///User provision type + pub user_provision_type: UserProvisionType, } ///Create-time parameters for a [`Silo`](crate::external_api::views::Silo) @@ -1201,6 +1493,7 @@ pub mod types { pub description: String, pub discoverable: bool, pub name: Name, + pub user_provision_type: UserProvisionType, } ///A single page of results @@ -1216,7 +1509,7 @@ pub mod types { #[derive( Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, )] - pub enum SiloRoles { + pub enum SiloRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -1225,12 +1518,12 @@ pub mod types { Viewer, } - impl ToString for SiloRoles { + impl ToString for SiloRole { fn to_string(&self) -> String { match *self { - SiloRoles::Admin => "admin".to_string(), - SiloRoles::Collaborator => "collaborator".to_string(), - SiloRoles::Viewer => "viewer".to_string(), + SiloRole::Admin => "admin".to_string(), + SiloRole::Collaborator => "collaborator".to_string(), + SiloRole::Viewer => "viewer".to_string(), } } } @@ -1242,9 +1535,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct SiloRolesPolicy { + pub struct SiloRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -1254,21 +1547,17 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] - pub struct SiloRolesRoleAssignment { + pub struct SiloRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: SiloRoles, + pub role_name: SiloRole, } ///Client view of an [`Sled`] #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct Sled { - ///human-readable free-form text about a resource - pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, - ///unique, mutable, user-controlled identifier for each resource - pub name: Name, pub service_address: String, ///timestamp when this resource was created pub time_created: chrono::DateTime, @@ -1324,6 +1613,11 @@ pub mod types { pub next_page: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct SpoofLoginBody { + pub username: String, + } + ///Client view of a [`SshKey`] #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct SshKey { @@ -1400,6 +1694,14 @@ pub mod types { ///Client view of a [`User`] #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct User { + ///Human-readable name that can identify the user + pub display_name: String, + pub id: uuid::Uuid, + } + + ///Client view of a [`UserBuiltin`] + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct UserBuiltin { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource @@ -1412,6 +1714,36 @@ pub mod types { pub time_modified: chrono::DateTime, } + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] + pub struct UserBuiltinResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///How users will be provisioned in a silo during authentication. + #[derive( + Serialize, Deserialize, Debug, Clone, JsonSchema, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, + )] + pub enum UserProvisionType { + #[serde(rename = "fixed")] + Fixed, + #[serde(rename = "jit")] + Jit, + } + + impl ToString for UserProvisionType { + fn to_string(&self) -> String { + match *self { + UserProvisionType::Fixed => "fixed".to_string(), + UserProvisionType::Jit => "jit".to_string(), + } + } + } + ///A single page of results #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] pub struct UserResultsPage { @@ -1852,26 +2184,77 @@ impl Client { } impl Client { + ///Start an OAuth 2.0 Device Authorization Grant + /// + ///This endpoint is designed to be accessed from an *unauthenticated* API + /// client. It generates and records a `device_code` and `user_code` which + /// must be verified and confirmed prior to a token being granted. + /// + ///Sends a `POST` request to `/device/auth` + ///```ignore + /// let response = client.device_auth_request() + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn device_auth_request(&self) -> builder::DeviceAuthRequest { + builder::DeviceAuthRequest::new(self) + } + + ///Confirm an OAuth 2.0 Device Authorization Grant + /// + ///This endpoint is designed to be accessed by the user agent (browser), + /// not the client requesting the token. So we do not actually return the + /// token here; it will be returned in response to the poll on + /// `/device/token`. + /// + ///Sends a `POST` request to `/device/confirm` + ///```ignore + /// let response = client.device_auth_confirm() + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn device_auth_confirm(&self) -> builder::DeviceAuthConfirm { + builder::DeviceAuthConfirm::new(self) + } + + ///Request a device access token + /// + ///This endpoint should be polled by the client until the user code is + /// verified and the grant is confirmed. + /// + ///Sends a `POST` request to `/device/token` + ///```ignore + /// let response = client.device_access_token() + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn device_access_token(&self) -> builder::DeviceAccessToken { + builder::DeviceAccessToken::new(self) + } + ///List racks in the system /// ///Sends a `GET` request to `/hardware/racks` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.hardware_racks_get() + /// let response = client.rack_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn hardware_racks_get(&self) -> builder::HardwareRacksGet { - builder::HardwareRacksGet::new(self) + pub fn rack_list(&self) -> builder::RackList { + builder::RackList::new(self) } ///Fetch information about a particular rack @@ -1882,13 +2265,13 @@ impl Client { /// - `rack_id`: The rack's unique ID. /// ///```ignore - /// let response = client.hardware_racks_get_rack() + /// let response = client.rack_view() /// .rack_id(rack_id) /// .send() /// .await; /// ``` - pub fn hardware_racks_get_rack(&self) -> builder::HardwareRacksGetRack { - builder::HardwareRacksGetRack::new(self) + pub fn rack_view(&self) -> builder::RackView { + builder::RackView::new(self) } ///List sleds in the system @@ -1897,20 +2280,20 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.hardware_sleds_get() + /// let response = client.sled_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn hardware_sleds_get(&self) -> builder::HardwareSledsGet { - builder::HardwareSledsGet::new(self) + pub fn sled_list(&self) -> builder::SledList { + builder::SledList::new(self) } ///Fetch information about a sled in the system @@ -1921,13 +2304,13 @@ impl Client { /// - `sled_id`: The sled's unique ID. /// ///```ignore - /// let response = client.hardware_sleds_get_sled() + /// let response = client.sled_view() /// .sled_id(sled_id) /// .send() /// .await; /// ``` - pub fn hardware_sleds_get_sled(&self) -> builder::HardwareSledsGetSled { - builder::HardwareSledsGetSled::new(self) + pub fn sled_view(&self) -> builder::SledView { + builder::SledView::new(self) } ///List global images @@ -1939,20 +2322,20 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.images_get() + /// let response = client.image_global_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn images_get(&self) -> builder::ImagesGet { - builder::ImagesGet::new(self) + pub fn image_global_list(&self) -> builder::ImageGlobalList { + builder::ImageGlobalList::new(self) } ///Create a global image @@ -1962,13 +2345,13 @@ impl Client { /// ///Sends a `POST` request to `/images` ///```ignore - /// let response = client.images_post() + /// let response = client.image_global_create() /// .body(body) /// .send() /// .await; /// ``` - pub fn images_post(&self) -> builder::ImagesPost { - builder::ImagesPost::new(self) + pub fn image_global_create(&self) -> builder::ImageGlobalCreate { + builder::ImageGlobalCreate::new(self) } ///Get a global image @@ -1977,13 +2360,13 @@ impl Client { /// ///Sends a `GET` request to `/images/{image_name}` ///```ignore - /// let response = client.images_get_image() + /// let response = client.image_global_view() /// .image_name(image_name) /// .send() /// .await; /// ``` - pub fn images_get_image(&self) -> builder::ImagesGetImage { - builder::ImagesGetImage::new(self) + pub fn image_global_view(&self) -> builder::ImageGlobalView { + builder::ImageGlobalView::new(self) } ///Delete a global image @@ -1994,13 +2377,140 @@ impl Client { /// ///Sends a `DELETE` request to `/images/{image_name}` ///```ignore - /// let response = client.images_delete_image() + /// let response = client.image_global_delete() /// .image_name(image_name) /// .send() /// .await; /// ``` - pub fn images_delete_image(&self) -> builder::ImagesDeleteImage { - builder::ImagesDeleteImage::new(self) + pub fn image_global_delete(&self) -> builder::ImageGlobalDelete { + builder::ImageGlobalDelete::new(self) + } + + ///List IP Pools + /// + ///Sends a `GET` request to `/ip-pools` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.ip_pool_list() + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_list(&self) -> builder::IpPoolList { + builder::IpPoolList::new(self) + } + + ///Create a new IP Pool + /// + ///Sends a `POST` request to `/ip-pools` + ///```ignore + /// let response = client.ip_pool_create() + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_create(&self) -> builder::IpPoolCreate { + builder::IpPoolCreate::new(self) + } + + ///Fetch a single IP Pool + /// + ///Sends a `GET` request to `/ip-pools/{pool_name}` + ///```ignore + /// let response = client.ip_pool_view() + /// .pool_name(pool_name) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_view(&self) -> builder::IpPoolView { + builder::IpPoolView::new(self) + } + + ///Update an IP Pool + /// + ///Sends a `PUT` request to `/ip-pools/{pool_name}` + ///```ignore + /// let response = client.ip_pool_update() + /// .pool_name(pool_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_update(&self) -> builder::IpPoolUpdate { + builder::IpPoolUpdate::new(self) + } + + ///Delete an IP Pool + /// + ///Sends a `DELETE` request to `/ip-pools/{pool_name}` + ///```ignore + /// let response = client.ip_pool_delete() + /// .pool_name(pool_name) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_delete(&self) -> builder::IpPoolDelete { + builder::IpPoolDelete::new(self) + } + + ///List the ranges of IP addresses within an existing IP Pool + /// + ///Note that ranges are listed sorted by their first address. + /// + ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` + /// + ///Arguments: + /// - `pool_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// + ///```ignore + /// let response = client.ip_pool_range_list() + /// .pool_name(pool_name) + /// .limit(limit) + /// .page_token(page_token) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_range_list(&self) -> builder::IpPoolRangeList { + builder::IpPoolRangeList::new(self) + } + + ///Add a new range to an existing IP Pool + /// + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/add` + ///```ignore + /// let response = client.ip_pool_range_add() + /// .pool_name(pool_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_range_add(&self) -> builder::IpPoolRangeAdd { + builder::IpPoolRangeAdd::new(self) + } + + ///Remove a range from an existing IP Pool + /// + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/remove` + ///```ignore + /// let response = client.ip_pool_range_remove() + /// .pool_name(pool_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn ip_pool_range_remove(&self) -> builder::IpPoolRangeRemove { + builder::IpPoolRangeRemove::new(self) } ///Sends a `POST` request to `/login` @@ -2014,6 +2524,42 @@ impl Client { builder::SpoofLogin::new(self) } + ///Ask the user to login to their identity provider + /// + ///Either display a page asking a user for their credentials, or redirect + /// them to their identity provider. + /// + ///Sends a `GET` request to `/login/{silo_name}/{provider_name}` + ///```ignore + /// let response = client.login() + /// .silo_name(silo_name) + /// .provider_name(provider_name) + /// .send() + /// .await; + /// ``` + pub fn login(&self) -> builder::Login { + builder::Login::new(self) + } + + ///Consume some sort of credentials, and authenticate a user + /// + ///Either receive a username and password, or some sort of identity + /// provider data (like a SAMLResponse). Use these to set the user's session + /// cookie. + /// + ///Sends a `POST` request to `/login/{silo_name}/{provider_name}` + ///```ignore + /// let response = client.consume_credentials() + /// .silo_name(silo_name) + /// .provider_name(provider_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn consume_credentials(&self) -> builder::ConsumeCredentials { + builder::ConsumeCredentials::new(self) + } + ///Sends a `POST` request to `/logout` ///```ignore /// let response = client.logout() @@ -2030,33 +2576,33 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.organizations_get() + /// let response = client.organization_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn organizations_get(&self) -> builder::OrganizationsGet { - builder::OrganizationsGet::new(self) + pub fn organization_list(&self) -> builder::OrganizationList { + builder::OrganizationList::new(self) } ///Create a new organization /// ///Sends a `POST` request to `/organizations` ///```ignore - /// let response = client.organizations_post() + /// let response = client.organization_create() /// .body(body) /// .send() /// .await; /// ``` - pub fn organizations_post(&self) -> builder::OrganizationsPost { - builder::OrganizationsPost::new(self) + pub fn organization_create(&self) -> builder::OrganizationCreate { + builder::OrganizationCreate::new(self) } ///Fetch a specific organization @@ -2067,13 +2613,13 @@ impl Client { /// - `organization_name`: The organization's unique name. /// ///```ignore - /// let response = client.organizations_get_organization() + /// let response = client.organization_view() /// .organization_name(organization_name) /// .send() /// .await; /// ``` - pub fn organizations_get_organization(&self) -> builder::OrganizationsGetOrganization { - builder::OrganizationsGetOrganization::new(self) + pub fn organization_view(&self) -> builder::OrganizationView { + builder::OrganizationView::new(self) } ///Update a specific organization @@ -2085,14 +2631,14 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.organizations_put_organization() + /// let response = client.organization_update() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn organizations_put_organization(&self) -> builder::OrganizationsPutOrganization { - builder::OrganizationsPutOrganization::new(self) + pub fn organization_update(&self) -> builder::OrganizationUpdate { + builder::OrganizationUpdate::new(self) } ///Delete a specific organization @@ -2103,13 +2649,13 @@ impl Client { /// - `organization_name`: The organization's unique name. /// ///```ignore - /// let response = client.organizations_delete_organization() + /// let response = client.organization_delete() /// .organization_name(organization_name) /// .send() /// .await; /// ``` - pub fn organizations_delete_organization(&self) -> builder::OrganizationsDeleteOrganization { - builder::OrganizationsDeleteOrganization::new(self) + pub fn organization_delete(&self) -> builder::OrganizationDelete { + builder::OrganizationDelete::new(self) } ///Fetch the IAM policy for this Organization @@ -2120,13 +2666,13 @@ impl Client { /// - `organization_name`: The organization's unique name. /// ///```ignore - /// let response = client.organization_get_policy() + /// let response = client.organization_policy_view() /// .organization_name(organization_name) /// .send() /// .await; /// ``` - pub fn organization_get_policy(&self) -> builder::OrganizationGetPolicy { - builder::OrganizationGetPolicy::new(self) + pub fn organization_policy_view(&self) -> builder::OrganizationPolicyView { + builder::OrganizationPolicyView::new(self) } ///Update the IAM policy for this Organization @@ -2138,14 +2684,14 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.organization_put_policy() + /// let response = client.organization_policy_update() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn organization_put_policy(&self) -> builder::OrganizationPutPolicy { - builder::OrganizationPutPolicy::new(self) + pub fn organization_policy_update(&self) -> builder::OrganizationPolicyUpdate { + builder::OrganizationPolicyUpdate::new(self) } ///List all projects @@ -2155,12 +2701,12 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.organization_projects_get() + /// let response = client.project_list() /// .organization_name(organization_name) /// .limit(limit) /// .page_token(page_token) @@ -2168,8 +2714,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn organization_projects_get(&self) -> builder::OrganizationProjectsGet { - builder::OrganizationProjectsGet::new(self) + pub fn project_list(&self) -> builder::ProjectList { + builder::ProjectList::new(self) } ///Create a new project @@ -2181,14 +2727,14 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.organization_projects_post() + /// let response = client.project_create() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn organization_projects_post(&self) -> builder::OrganizationProjectsPost { - builder::OrganizationProjectsPost::new(self) + pub fn project_create(&self) -> builder::ProjectCreate { + builder::ProjectCreate::new(self) } ///Fetch a specific project @@ -2201,14 +2747,14 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// ///```ignore - /// let response = client.organization_projects_get_project() + /// let response = client.project_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` - pub fn organization_projects_get_project(&self) -> builder::OrganizationProjectsGetProject { - builder::OrganizationProjectsGetProject::new(self) + pub fn project_view(&self) -> builder::ProjectView { + builder::ProjectView::new(self) } ///Update a specific project @@ -2222,15 +2768,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.organization_projects_put_project() + /// let response = client.project_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn organization_projects_put_project(&self) -> builder::OrganizationProjectsPutProject { - builder::OrganizationProjectsPutProject::new(self) + pub fn project_update(&self) -> builder::ProjectUpdate { + builder::ProjectUpdate::new(self) } ///Delete a specific project @@ -2243,16 +2789,14 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// ///```ignore - /// let response = client.organization_projects_delete_project() + /// let response = client.project_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` - pub fn organization_projects_delete_project( - &self, - ) -> builder::OrganizationProjectsDeleteProject { - builder::OrganizationProjectsDeleteProject::new(self) + pub fn project_delete(&self) -> builder::ProjectDelete { + builder::ProjectDelete::new(self) } ///List disks in a project @@ -2264,12 +2808,12 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_disks_get() + /// let response = client.disk_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2278,8 +2822,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_disks_get(&self) -> builder::ProjectDisksGet { - builder::ProjectDisksGet::new(self) + pub fn disk_list(&self) -> builder::DiskList { + builder::DiskList::new(self) } ///Create a disk in a project @@ -2293,15 +2837,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.project_disks_post() + /// let response = client.disk_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn project_disks_post(&self) -> builder::ProjectDisksPost { - builder::ProjectDisksPost::new(self) + pub fn disk_create(&self) -> builder::DiskCreate { + builder::DiskCreate::new(self) } ///Fetch a single disk in a project @@ -2309,15 +2853,15 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` ```ignore - /// let response = client.project_disks_get_disk() + /// let response = client.disk_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .send() /// .await; /// ``` - pub fn project_disks_get_disk(&self) -> builder::ProjectDisksGetDisk { - builder::ProjectDisksGetDisk::new(self) + pub fn disk_view(&self) -> builder::DiskView { + builder::DiskView::new(self) } ///Delete a disk from a project @@ -2325,15 +2869,15 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` ```ignore - /// let response = client.project_disks_delete_disk() + /// let response = client.disk_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .send() /// .await; /// ``` - pub fn project_disks_delete_disk(&self) -> builder::ProjectDisksDeleteDisk { - builder::ProjectDisksDeleteDisk::new(self) + pub fn disk_delete(&self) -> builder::DiskDelete { + builder::DiskDelete::new(self) } ///List images @@ -2348,12 +2892,12 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_images_get() + /// let response = client.image_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2362,8 +2906,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_images_get(&self) -> builder::ProjectImagesGet { - builder::ProjectImagesGet::new(self) + pub fn image_list(&self) -> builder::ImageList { + builder::ImageList::new(self) } ///Create an image @@ -2379,15 +2923,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.project_images_post() + /// let response = client.image_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn project_images_post(&self) -> builder::ProjectImagesPost { - builder::ProjectImagesPost::new(self) + pub fn image_create(&self) -> builder::ImageCreate { + builder::ImageCreate::new(self) } ///Get an image @@ -2397,15 +2941,15 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` ```ignore - /// let response = client.project_images_get_image() + /// let response = client.image_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .image_name(image_name) /// .send() /// .await; /// ``` - pub fn project_images_get_image(&self) -> builder::ProjectImagesGetImage { - builder::ProjectImagesGetImage::new(self) + pub fn image_view(&self) -> builder::ImageView { + builder::ImageView::new(self) } ///Delete an image @@ -2417,15 +2961,15 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` ```ignore - /// let response = client.project_images_delete_image() + /// let response = client.image_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .image_name(image_name) /// .send() /// .await; /// ``` - pub fn project_images_delete_image(&self) -> builder::ProjectImagesDeleteImage { - builder::ProjectImagesDeleteImage::new(self) + pub fn image_delete(&self) -> builder::ImageDelete { + builder::ImageDelete::new(self) } ///List instances in a project @@ -2437,12 +2981,12 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_instances_get() + /// let response = client.instance_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2451,8 +2995,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_instances_get(&self) -> builder::ProjectInstancesGet { - builder::ProjectInstancesGet::new(self) + pub fn instance_list(&self) -> builder::InstanceList { + builder::InstanceList::new(self) } ///Create an instance in a project @@ -2466,15 +3010,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.project_instances_post() + /// let response = client.instance_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn project_instances_post(&self) -> builder::ProjectInstancesPost { - builder::ProjectInstancesPost::new(self) + pub fn instance_create(&self) -> builder::InstanceCreate { + builder::InstanceCreate::new(self) } ///Get an instance in a project @@ -2482,15 +3026,15 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` ```ignore - /// let response = client.project_instances_get_instance() + /// let response = client.instance_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - pub fn project_instances_get_instance(&self) -> builder::ProjectInstancesGetInstance { - builder::ProjectInstancesGetInstance::new(self) + pub fn instance_view(&self) -> builder::InstanceView { + builder::InstanceView::new(self) } ///Delete an instance from a project @@ -2498,15 +3042,15 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` ```ignore - /// let response = client.project_instances_delete_instance() + /// let response = client.instance_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - pub fn project_instances_delete_instance(&self) -> builder::ProjectInstancesDeleteInstance { - builder::ProjectInstancesDeleteInstance::new(self) + pub fn instance_delete(&self) -> builder::InstanceDelete { + builder::InstanceDelete::new(self) } ///List disks attached to this instance @@ -2520,12 +3064,12 @@ impl Client { /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.instance_disks_get() + /// let response = client.instance_disk_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2535,14 +3079,14 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_disks_get(&self) -> builder::InstanceDisksGet { - builder::InstanceDisksGet::new(self) + pub fn instance_disk_list(&self) -> builder::InstanceDiskList { + builder::InstanceDiskList::new(self) } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/attach` ```ignore - /// let response = client.instance_disks_attach() + /// let response = client.instance_disk_attach() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2550,14 +3094,14 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_disks_attach(&self) -> builder::InstanceDisksAttach { - builder::InstanceDisksAttach::new(self) + pub fn instance_disk_attach(&self) -> builder::InstanceDiskAttach { + builder::InstanceDiskAttach::new(self) } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/detach` ```ignore - /// let response = client.instance_disks_detach() + /// let response = client.instance_disk_detach() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2565,8 +3109,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_disks_detach(&self) -> builder::InstanceDisksDetach { - builder::InstanceDisksDetach::new(self) + pub fn instance_disk_detach(&self) -> builder::InstanceDiskDetach { + builder::InstanceDiskDetach::new(self) } ///Migrate an instance to a different propolis-server, possibly on a @@ -2575,7 +3119,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/migrate` ```ignore - /// let response = client.project_instances_migrate_instance() + /// let response = client.instance_migrate() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2583,8 +3127,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_instances_migrate_instance(&self) -> builder::ProjectInstancesMigrateInstance { - builder::ProjectInstancesMigrateInstance::new(self) + pub fn instance_migrate(&self) -> builder::InstanceMigrate { + builder::InstanceMigrate::new(self) } ///List network interfaces attached to this instance @@ -2598,12 +3142,12 @@ impl Client { /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.instance_network_interfaces_get() + /// let response = client.instance_network_interface_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2613,8 +3157,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_network_interfaces_get(&self) -> builder::InstanceNetworkInterfacesGet { - builder::InstanceNetworkInterfacesGet::new(self) + pub fn instance_network_interface_list(&self) -> builder::InstanceNetworkInterfaceList { + builder::InstanceNetworkInterfaceList::new(self) } ///Create a network interface for an instance @@ -2622,7 +3166,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces` ```ignore - /// let response = client.instance_network_interfaces_post() + /// let response = client.instance_network_interface_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2630,8 +3174,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_network_interfaces_post(&self) -> builder::InstanceNetworkInterfacesPost { - builder::InstanceNetworkInterfacesPost::new(self) + pub fn instance_network_interface_create(&self) -> builder::InstanceNetworkInterfaceCreate { + builder::InstanceNetworkInterfaceCreate::new(self) } ///Get an interface attached to an instance @@ -2639,7 +3183,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore - /// let response = client.instance_network_interfaces_get_interface() + /// let response = client.instance_network_interface_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2647,18 +3191,39 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_network_interfaces_get_interface( - &self, - ) -> builder::InstanceNetworkInterfacesGetInterface { - builder::InstanceNetworkInterfacesGetInterface::new(self) + pub fn instance_network_interface_view(&self) -> builder::InstanceNetworkInterfaceView { + builder::InstanceNetworkInterfaceView::new(self) + } + + ///Update information about an instance's network interface + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/instances/ + /// {instance_name}/network-interfaces/{interface_name}` ```ignore + /// let response = client.instance_network_interface_update() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .instance_name(instance_name) + /// .interface_name(interface_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn instance_network_interface_update(&self) -> builder::InstanceNetworkInterfaceUpdate { + builder::InstanceNetworkInterfaceUpdate::new(self) } ///Detach a network interface from an instance /// + ///Note that the primary interface for an instance cannot be deleted if + /// there are any secondary interfaces. A new primary interface must be + /// designated first. The primary interface can be deleted if there are no + /// secondary interfaces. + /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore - /// let response = client.instance_network_interfaces_delete_interface() + /// let response = client.instance_network_interface_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) @@ -2666,10 +3231,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn instance_network_interfaces_delete_interface( - &self, - ) -> builder::InstanceNetworkInterfacesDeleteInterface { - builder::InstanceNetworkInterfacesDeleteInterface::new(self) + pub fn instance_network_interface_delete(&self) -> builder::InstanceNetworkInterfaceDelete { + builder::InstanceNetworkInterfaceDelete::new(self) } ///Reboot an instance @@ -2677,15 +3240,52 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/reboot` ```ignore - /// let response = client.project_instances_instance_reboot() + /// let response = client.instance_reboot() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - pub fn project_instances_instance_reboot(&self) -> builder::ProjectInstancesInstanceReboot { - builder::ProjectInstancesInstanceReboot::new(self) + pub fn instance_reboot(&self) -> builder::InstanceReboot { + builder::InstanceReboot::new(self) + } + + ///Get contents of an instance's serial console + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/instances/ + /// {instance_name}/serial-console` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `instance_name` + /// - `from_start`: Character index in the serial buffer from which to read, + /// counting the bytes output since instance start. If this is not + /// provided, `most_recent` must be provided, and if this *is* provided, + /// `most_recent` must *not* be provided. + /// - `max_bytes`: Maximum number of bytes of buffered serial console + /// contents to return. If the requested range runs to the end of the + /// available buffer, the data returned will be shorter than `max_bytes`. + /// - `most_recent`: Character index in the serial buffer from which to + /// read, counting *backward* from the most recently buffered data + /// retrieved from the instance. (See note on `from_start` about mutual + /// exclusivity) + /// + ///```ignore + /// let response = client.instance_serial_console() + /// .organization_name(organization_name) + /// .project_name(project_name) + /// .instance_name(instance_name) + /// .from_start(from_start) + /// .max_bytes(max_bytes) + /// .most_recent(most_recent) + /// .send() + /// .await; + /// ``` + pub fn instance_serial_console(&self) -> builder::InstanceSerialConsole { + builder::InstanceSerialConsole::new(self) } ///Boot an instance @@ -2693,15 +3293,15 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/start` ```ignore - /// let response = client.project_instances_instance_start() + /// let response = client.instance_start() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - pub fn project_instances_instance_start(&self) -> builder::ProjectInstancesInstanceStart { - builder::ProjectInstancesInstanceStart::new(self) + pub fn instance_start(&self) -> builder::InstanceStart { + builder::InstanceStart::new(self) } ///Halt an instance @@ -2709,15 +3309,15 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/stop` ```ignore - /// let response = client.project_instances_instance_stop() + /// let response = client.instance_stop() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` - pub fn project_instances_instance_stop(&self) -> builder::ProjectInstancesInstanceStop { - builder::ProjectInstancesInstanceStop::new(self) + pub fn instance_stop(&self) -> builder::InstanceStop { + builder::InstanceStop::new(self) } ///Fetch the IAM policy for this Project @@ -2730,16 +3330,14 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// ///```ignore - /// let response = client.organization_projects_get_project_policy() + /// let response = client.project_policy_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` - pub fn organization_projects_get_project_policy( - &self, - ) -> builder::OrganizationProjectsGetProjectPolicy { - builder::OrganizationProjectsGetProjectPolicy::new(self) + pub fn project_policy_view(&self) -> builder::ProjectPolicyView { + builder::ProjectPolicyView::new(self) } ///Update the IAM policy for this Project @@ -2753,17 +3351,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.organization_projects_put_project_policy() + /// let response = client.project_policy_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn organization_projects_put_project_policy( - &self, - ) -> builder::OrganizationProjectsPutProjectPolicy { - builder::OrganizationProjectsPutProjectPolicy::new(self) + pub fn project_policy_update(&self) -> builder::ProjectPolicyUpdate { + builder::ProjectPolicyUpdate::new(self) } ///List snapshots in a project @@ -2775,12 +3371,12 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_snapshots_get() + /// let response = client.snapshot_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2789,8 +3385,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_snapshots_get(&self) -> builder::ProjectSnapshotsGet { - builder::ProjectSnapshotsGet::new(self) + pub fn snapshot_list(&self) -> builder::SnapshotList { + builder::SnapshotList::new(self) } ///Create a snapshot of a disk @@ -2804,15 +3400,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.project_snapshots_post() + /// let response = client.snapshot_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn project_snapshots_post(&self) -> builder::ProjectSnapshotsPost { - builder::ProjectSnapshotsPost::new(self) + pub fn snapshot_create(&self) -> builder::SnapshotCreate { + builder::SnapshotCreate::new(self) } ///Get a snapshot in a project @@ -2820,15 +3416,15 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` ```ignore - /// let response = client.project_snapshots_get_snapshot() + /// let response = client.snapshot_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .snapshot_name(snapshot_name) /// .send() /// .await; /// ``` - pub fn project_snapshots_get_snapshot(&self) -> builder::ProjectSnapshotsGetSnapshot { - builder::ProjectSnapshotsGetSnapshot::new(self) + pub fn snapshot_view(&self) -> builder::SnapshotView { + builder::SnapshotView::new(self) } ///Delete a snapshot from a project @@ -2836,15 +3432,15 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` ```ignore - /// let response = client.project_snapshots_delete_snapshot() + /// let response = client.snapshot_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .snapshot_name(snapshot_name) /// .send() /// .await; /// ``` - pub fn project_snapshots_delete_snapshot(&self) -> builder::ProjectSnapshotsDeleteSnapshot { - builder::ProjectSnapshotsDeleteSnapshot::new(self) + pub fn snapshot_delete(&self) -> builder::SnapshotDelete { + builder::SnapshotDelete::new(self) } ///List VPCs in a project @@ -2856,12 +3452,12 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.project_vpcs_get() + /// let response = client.vpc_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) @@ -2870,8 +3466,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_vpcs_get(&self) -> builder::ProjectVpcsGet { - builder::ProjectVpcsGet::new(self) + pub fn vpc_list(&self) -> builder::VpcList { + builder::VpcList::new(self) } ///Create a VPC in a project @@ -2885,15 +3481,15 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.project_vpcs_post() + /// let response = client.vpc_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn project_vpcs_post(&self) -> builder::ProjectVpcsPost { - builder::ProjectVpcsPost::new(self) + pub fn vpc_create(&self) -> builder::VpcCreate { + builder::VpcCreate::new(self) } ///Get a VPC in a project @@ -2901,15 +3497,15 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` ```ignore - /// let response = client.project_vpcs_get_vpc() + /// let response = client.vpc_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` - pub fn project_vpcs_get_vpc(&self) -> builder::ProjectVpcsGetVpc { - builder::ProjectVpcsGetVpc::new(self) + pub fn vpc_view(&self) -> builder::VpcView { + builder::VpcView::new(self) } ///Update a VPC @@ -2917,7 +3513,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` ```ignore - /// let response = client.project_vpcs_put_vpc() + /// let response = client.vpc_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -2925,8 +3521,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn project_vpcs_put_vpc(&self) -> builder::ProjectVpcsPutVpc { - builder::ProjectVpcsPutVpc::new(self) + pub fn vpc_update(&self) -> builder::VpcUpdate { + builder::VpcUpdate::new(self) } ///Delete a vpc from a project @@ -2934,15 +3530,15 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` ```ignore - /// let response = client.project_vpcs_delete_vpc() + /// let response = client.vpc_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` - pub fn project_vpcs_delete_vpc(&self) -> builder::ProjectVpcsDeleteVpc { - builder::ProjectVpcsDeleteVpc::new(self) + pub fn vpc_delete(&self) -> builder::VpcDelete { + builder::VpcDelete::new(self) } ///List firewall rules for a VPC @@ -2950,15 +3546,15 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` ```ignore - /// let response = client.vpc_firewall_rules_get() + /// let response = client.vpc_firewall_rules_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` - pub fn vpc_firewall_rules_get(&self) -> builder::VpcFirewallRulesGet { - builder::VpcFirewallRulesGet::new(self) + pub fn vpc_firewall_rules_view(&self) -> builder::VpcFirewallRulesView { + builder::VpcFirewallRulesView::new(self) } ///Replace the firewall rules for a VPC @@ -2966,7 +3562,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` ```ignore - /// let response = client.vpc_firewall_rules_put() + /// let response = client.vpc_firewall_rules_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -2974,8 +3570,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_firewall_rules_put(&self) -> builder::VpcFirewallRulesPut { - builder::VpcFirewallRulesPut::new(self) + pub fn vpc_firewall_rules_update(&self) -> builder::VpcFirewallRulesUpdate { + builder::VpcFirewallRulesUpdate::new(self) } ///List VPC Custom and System Routers @@ -2989,12 +3585,12 @@ impl Client { /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.vpc_routers_get() + /// let response = client.vpc_router_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3004,8 +3600,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_routers_get(&self) -> builder::VpcRoutersGet { - builder::VpcRoutersGet::new(self) + pub fn vpc_router_list(&self) -> builder::VpcRouterList { + builder::VpcRouterList::new(self) } ///Create a VPC Router @@ -3013,7 +3609,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` ```ignore - /// let response = client.vpc_routers_post() + /// let response = client.vpc_router_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3021,8 +3617,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_routers_post(&self) -> builder::VpcRoutersPost { - builder::VpcRoutersPost::new(self) + pub fn vpc_router_create(&self) -> builder::VpcRouterCreate { + builder::VpcRouterCreate::new(self) } ///Get a VPC Router @@ -3030,7 +3626,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` ```ignore - /// let response = client.vpc_routers_get_router() + /// let response = client.vpc_router_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3038,8 +3634,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_routers_get_router(&self) -> builder::VpcRoutersGetRouter { - builder::VpcRoutersGetRouter::new(self) + pub fn vpc_router_view(&self) -> builder::VpcRouterView { + builder::VpcRouterView::new(self) } ///Update a VPC Router @@ -3047,7 +3643,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` ```ignore - /// let response = client.vpc_routers_put_router() + /// let response = client.vpc_router_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3056,8 +3652,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_routers_put_router(&self) -> builder::VpcRoutersPutRouter { - builder::VpcRoutersPutRouter::new(self) + pub fn vpc_router_update(&self) -> builder::VpcRouterUpdate { + builder::VpcRouterUpdate::new(self) } ///Delete a router from its VPC @@ -3065,7 +3661,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` ```ignore - /// let response = client.vpc_routers_delete_router() + /// let response = client.vpc_router_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3073,8 +3669,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_routers_delete_router(&self) -> builder::VpcRoutersDeleteRouter { - builder::VpcRoutersDeleteRouter::new(self) + pub fn vpc_router_delete(&self) -> builder::VpcRouterDelete { + builder::VpcRouterDelete::new(self) } ///List a Router's routes @@ -3089,12 +3685,12 @@ impl Client { /// - `vpc_name` /// - `router_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.routers_routes_get() + /// let response = client.vpc_router_route_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3105,8 +3701,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn routers_routes_get(&self) -> builder::RoutersRoutesGet { - builder::RoutersRoutesGet::new(self) + pub fn vpc_router_route_list(&self) -> builder::VpcRouterRouteList { + builder::VpcRouterRouteList::new(self) } ///Create a VPC Router @@ -3114,7 +3710,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` ```ignore - /// let response = client.routers_routes_post() + /// let response = client.vpc_router_route_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3123,8 +3719,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn routers_routes_post(&self) -> builder::RoutersRoutesPost { - builder::RoutersRoutesPost::new(self) + pub fn vpc_router_route_create(&self) -> builder::VpcRouterRouteCreate { + builder::VpcRouterRouteCreate::new(self) } ///Get a VPC Router route @@ -3132,7 +3728,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore - /// let response = client.routers_routes_get_route() + /// let response = client.vpc_router_route_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3141,8 +3737,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn routers_routes_get_route(&self) -> builder::RoutersRoutesGetRoute { - builder::RoutersRoutesGetRoute::new(self) + pub fn vpc_router_route_view(&self) -> builder::VpcRouterRouteView { + builder::VpcRouterRouteView::new(self) } ///Update a Router route @@ -3150,7 +3746,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore - /// let response = client.routers_routes_put_route() + /// let response = client.vpc_router_route_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3160,8 +3756,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn routers_routes_put_route(&self) -> builder::RoutersRoutesPutRoute { - builder::RoutersRoutesPutRoute::new(self) + pub fn vpc_router_route_update(&self) -> builder::VpcRouterRouteUpdate { + builder::VpcRouterRouteUpdate::new(self) } ///Delete a route from its router @@ -3169,7 +3765,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore - /// let response = client.routers_routes_delete_route() + /// let response = client.vpc_router_route_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3178,8 +3774,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn routers_routes_delete_route(&self) -> builder::RoutersRoutesDeleteRoute { - builder::RoutersRoutesDeleteRoute::new(self) + pub fn vpc_router_route_delete(&self) -> builder::VpcRouterRouteDelete { + builder::VpcRouterRouteDelete::new(self) } ///List subnets in a VPC @@ -3193,12 +3789,12 @@ impl Client { /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.vpc_subnets_get() + /// let response = client.vpc_subnet_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3208,8 +3804,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_subnets_get(&self) -> builder::VpcSubnetsGet { - builder::VpcSubnetsGet::new(self) + pub fn vpc_subnet_list(&self) -> builder::VpcSubnetList { + builder::VpcSubnetList::new(self) } ///Create a subnet in a VPC @@ -3217,7 +3813,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` ```ignore - /// let response = client.vpc_subnets_post() + /// let response = client.vpc_subnet_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3225,8 +3821,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_subnets_post(&self) -> builder::VpcSubnetsPost { - builder::VpcSubnetsPost::new(self) + pub fn vpc_subnet_create(&self) -> builder::VpcSubnetCreate { + builder::VpcSubnetCreate::new(self) } ///Get subnet in a VPC @@ -3234,7 +3830,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` ```ignore - /// let response = client.vpc_subnets_get_subnet() + /// let response = client.vpc_subnet_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3242,8 +3838,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_subnets_get_subnet(&self) -> builder::VpcSubnetsGetSubnet { - builder::VpcSubnetsGetSubnet::new(self) + pub fn vpc_subnet_view(&self) -> builder::VpcSubnetView { + builder::VpcSubnetView::new(self) } ///Update a VPC Subnet @@ -3251,7 +3847,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` ```ignore - /// let response = client.vpc_subnets_put_subnet() + /// let response = client.vpc_subnet_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3260,8 +3856,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_subnets_put_subnet(&self) -> builder::VpcSubnetsPutSubnet { - builder::VpcSubnetsPutSubnet::new(self) + pub fn vpc_subnet_update(&self) -> builder::VpcSubnetUpdate { + builder::VpcSubnetUpdate::new(self) } ///Delete a subnet from a VPC @@ -3269,7 +3865,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` ```ignore - /// let response = client.vpc_subnets_delete_subnet() + /// let response = client.vpc_subnet_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3277,8 +3873,8 @@ impl Client { /// .send() /// .await; /// ``` - pub fn vpc_subnets_delete_subnet(&self) -> builder::VpcSubnetsDeleteSubnet { - builder::VpcSubnetsDeleteSubnet::new(self) + pub fn vpc_subnet_delete(&self) -> builder::VpcSubnetDelete { + builder::VpcSubnetDelete::new(self) } ///List network interfaces in a VPC subnet @@ -3293,12 +3889,12 @@ impl Client { /// - `vpc_name` /// - `subnet_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.subnet_network_interfaces_get() + /// let response = client.vpc_subnet_list_network_interfaces() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) @@ -3309,33 +3905,33 @@ impl Client { /// .send() /// .await; /// ``` - pub fn subnet_network_interfaces_get(&self) -> builder::SubnetNetworkInterfacesGet { - builder::SubnetNetworkInterfacesGet::new(self) + pub fn vpc_subnet_list_network_interfaces(&self) -> builder::VpcSubnetListNetworkInterfaces { + builder::VpcSubnetListNetworkInterfaces::new(self) } ///Fetch the top-level IAM policy /// ///Sends a `GET` request to `/policy` ///```ignore - /// let response = client.policy_get() + /// let response = client.policy_view() /// .send() /// .await; /// ``` - pub fn policy_get(&self) -> builder::PolicyGet { - builder::PolicyGet::new(self) + pub fn policy_view(&self) -> builder::PolicyView { + builder::PolicyView::new(self) } ///Update the top-level IAM policy /// ///Sends a `PUT` request to `/policy` ///```ignore - /// let response = client.policy_put() + /// let response = client.policy_update() /// .body(body) /// .send() /// .await; /// ``` - pub fn policy_put(&self) -> builder::PolicyPut { - builder::PolicyPut::new(self) + pub fn policy_update(&self) -> builder::PolicyUpdate { + builder::PolicyUpdate::new(self) } ///List the built-in roles @@ -3344,18 +3940,18 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// ///```ignore - /// let response = client.roles_get() + /// let response = client.role_list() /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` - pub fn roles_get(&self) -> builder::RolesGet { - builder::RolesGet::new(self) + pub fn role_list(&self) -> builder::RoleList { + builder::RoleList::new(self) } ///Fetch a specific built-in role @@ -3366,13 +3962,13 @@ impl Client { /// - `role_name`: The built-in role's unique name. /// ///```ignore - /// let response = client.roles_get_role() + /// let response = client.role_view() /// .role_name(role_name) /// .send() /// .await; /// ``` - pub fn roles_get_role(&self) -> builder::RolesGetRole { - builder::RolesGetRole::new(self) + pub fn role_view(&self) -> builder::RoleView { + builder::RoleView::new(self) } ///List all sagas (for debugging) @@ -3381,33 +3977,33 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.sagas_get() + /// let response = client.saga_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn sagas_get(&self) -> builder::SagasGet { - builder::SagasGet::new(self) + pub fn saga_list(&self) -> builder::SagaList { + builder::SagaList::new(self) } ///Fetch information about a single saga (for debugging) /// ///Sends a `GET` request to `/sagas/{saga_id}` ///```ignore - /// let response = client.sagas_get_saga() + /// let response = client.saga_view() /// .saga_id(saga_id) /// .send() /// .await; /// ``` - pub fn sagas_get_saga(&self) -> builder::SagasGetSaga { - builder::SagasGetSaga::new(self) + pub fn saga_view(&self) -> builder::SagaView { + builder::SagaView::new(self) } ///Fetch the user associated with the current session @@ -3428,92 +4024,92 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.sshkeys_get() + /// let response = client.session_sshkey_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn sshkeys_get(&self) -> builder::SshkeysGet { - builder::SshkeysGet::new(self) + pub fn session_sshkey_list(&self) -> builder::SessionSshkeyList { + builder::SessionSshkeyList::new(self) } ///Create a new SSH public key for the current user /// ///Sends a `POST` request to `/session/me/sshkeys` ///```ignore - /// let response = client.sshkeys_post() + /// let response = client.session_sshkey_create() /// .body(body) /// .send() /// .await; /// ``` - pub fn sshkeys_post(&self) -> builder::SshkeysPost { - builder::SshkeysPost::new(self) + pub fn session_sshkey_create(&self) -> builder::SessionSshkeyCreate { + builder::SessionSshkeyCreate::new(self) } ///Get (by name) an SSH public key belonging to the current user /// ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` ///```ignore - /// let response = client.sshkeys_get_key() + /// let response = client.session_sshkey_view() /// .ssh_key_name(ssh_key_name) /// .send() /// .await; /// ``` - pub fn sshkeys_get_key(&self) -> builder::SshkeysGetKey { - builder::SshkeysGetKey::new(self) + pub fn session_sshkey_view(&self) -> builder::SessionSshkeyView { + builder::SessionSshkeyView::new(self) } ///Delete (by name) an SSH public key belonging to the current user /// ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` ///```ignore - /// let response = client.sshkeys_delete_key() + /// let response = client.session_sshkey_delete() /// .ssh_key_name(ssh_key_name) /// .send() /// .await; /// ``` - pub fn sshkeys_delete_key(&self) -> builder::SshkeysDeleteKey { - builder::SshkeysDeleteKey::new(self) + pub fn session_sshkey_delete(&self) -> builder::SessionSshkeyDelete { + builder::SessionSshkeyDelete::new(self) } ///Sends a `GET` request to `/silos` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.silos_get() + /// let response = client.silo_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn silos_get(&self) -> builder::SilosGet { - builder::SilosGet::new(self) + pub fn silo_list(&self) -> builder::SiloList { + builder::SiloList::new(self) } ///Create a new silo /// ///Sends a `POST` request to `/silos` ///```ignore - /// let response = client.silos_post() + /// let response = client.silo_create() /// .body(body) /// .send() /// .await; /// ``` - pub fn silos_post(&self) -> builder::SilosPost { - builder::SilosPost::new(self) + pub fn silo_create(&self) -> builder::SiloCreate { + builder::SiloCreate::new(self) } ///Fetch a specific silo @@ -3524,13 +4120,13 @@ impl Client { /// - `silo_name`: The silo's unique name. /// ///```ignore - /// let response = client.silos_get_silo() + /// let response = client.silo_view() /// .silo_name(silo_name) /// .send() /// .await; /// ``` - pub fn silos_get_silo(&self) -> builder::SilosGetSilo { - builder::SilosGetSilo::new(self) + pub fn silo_view(&self) -> builder::SiloView { + builder::SiloView::new(self) } ///Delete a specific silo @@ -3541,13 +4137,37 @@ impl Client { /// - `silo_name`: The silo's unique name. /// ///```ignore - /// let response = client.silos_delete_silo() + /// let response = client.silo_delete() /// .silo_name(silo_name) /// .send() /// .await; /// ``` - pub fn silos_delete_silo(&self) -> builder::SilosDeleteSilo { - builder::SilosDeleteSilo::new(self) + pub fn silo_delete(&self) -> builder::SiloDelete { + builder::SiloDelete::new(self) + } + + ///List Silo identity providers + /// + ///Sends a `GET` request to `/silos/{silo_name}/identity_providers` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.silo_identity_provider_list() + /// .silo_name(silo_name) + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + pub fn silo_identity_provider_list(&self) -> builder::SiloIdentityProviderList { + builder::SiloIdentityProviderList::new(self) } ///Fetch the IAM policy for this Silo @@ -3558,13 +4178,13 @@ impl Client { /// - `silo_name`: The silo's unique name. /// ///```ignore - /// let response = client.silos_get_silo_policy() + /// let response = client.silo_policy_view() /// .silo_name(silo_name) /// .send() /// .await; /// ``` - pub fn silos_get_silo_policy(&self) -> builder::SilosGetSiloPolicy { - builder::SilosGetSiloPolicy::new(self) + pub fn silo_policy_view(&self) -> builder::SiloPolicyView { + builder::SiloPolicyView::new(self) } ///Update the IAM policy for this Silo @@ -3576,14 +4196,92 @@ impl Client { /// - `body` /// ///```ignore - /// let response = client.silos_put_silo_policy() + /// let response = client.silo_policy_update() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` - pub fn silos_put_silo_policy(&self) -> builder::SilosPutSiloPolicy { - builder::SilosPutSiloPolicy::new(self) + pub fn silo_policy_update(&self) -> builder::SiloPolicyUpdate { + builder::SiloPolicyUpdate::new(self) + } + + ///Create a new SAML identity provider for a silo + /// + ///Sends a `POST` request to `/silos/{silo_name}/saml_identity_providers` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `body` + /// + ///```ignore + /// let response = client.silo_identity_provider_create() + /// .silo_name(silo_name) + /// .body(body) + /// .send() + /// .await; + /// ``` + pub fn silo_identity_provider_create(&self) -> builder::SiloIdentityProviderCreate { + builder::SiloIdentityProviderCreate::new(self) + } + + ///GET a silo's SAML identity provider + /// + ///Sends a `GET` request to + /// `/silos/{silo_name}/saml_identity_providers/{provider_name}` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `provider_name`: The SAML identity provider's name + /// + ///```ignore + /// let response = client.silo_identity_provider_view() + /// .silo_name(silo_name) + /// .provider_name(provider_name) + /// .send() + /// .await; + /// ``` + pub fn silo_identity_provider_view(&self) -> builder::SiloIdentityProviderView { + builder::SiloIdentityProviderView::new(self) + } + + ///List the built-in system users + /// + ///Sends a `GET` request to `/system/user` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + /// + ///```ignore + /// let response = client.system_user_list() + /// .limit(limit) + /// .page_token(page_token) + /// .sort_by(sort_by) + /// .send() + /// .await; + /// ``` + pub fn system_user_list(&self) -> builder::SystemUserList { + builder::SystemUserList::new(self) + } + + ///Fetch a specific built-in system user + /// + ///Sends a `GET` request to `/system/user/{user_name}` + /// + ///Arguments: + /// - `user_name`: The built-in user's unique name. + /// + ///```ignore + /// let response = client.system_user_view() + /// .user_name(user_name) + /// .send() + /// .await; + /// ``` + pub fn system_user_view(&self) -> builder::SystemUserView { + builder::SystemUserView::new(self) } ///List all timeseries schema @@ -3592,7 +4290,7 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// ///```ignore @@ -3618,64 +4316,189 @@ impl Client { builder::UpdatesRefresh::new(self) } - ///List the built-in system users + ///List users /// ///Sends a `GET` request to `/users` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore - /// let response = client.users_get() + /// let response = client.user_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - pub fn users_get(&self) -> builder::UsersGet { - builder::UsersGet::new(self) - } - - ///Fetch a specific built-in system user - /// - ///Sends a `GET` request to `/users/{user_name}` - /// - ///Arguments: - /// - `user_name`: The built-in user's unique name. - /// - ///```ignore - /// let response = client.users_get_user() - /// .user_name(user_name) - /// .send() - /// .await; - /// ``` - pub fn users_get_user(&self) -> builder::UsersGetUser { - builder::UsersGetUser::new(self) + pub fn user_list(&self) -> builder::UserList { + builder::UserList::new(self) } } pub mod builder { - #[allow(unused_imports)] - use super::encode_path; use super::types; #[allow(unused_imports)] - use super::{ByteStream, Error, ResponseValue}; - ///Builder for [`Client::hardware_racks_get`] + use super::{encode_path, ByteStream, Error, RequestBuilderExt, ResponseValue}; + ///Builder for [`Client::device_auth_request`] /// - ///[`Client::hardware_racks_get`]: super::Client::hardware_racks_get + ///[`Client::device_auth_request`]: super::Client::device_auth_request #[derive(Clone)] - pub struct HardwareRacksGet<'a> { + pub struct DeviceAuthRequest<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> DeviceAuthRequest<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::DeviceAuthRequest) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/device/auth` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/device/auth", client.baseurl,); + let 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))), + } + } + } + + ///Builder for [`Client::device_auth_confirm`] + /// + ///[`Client::device_auth_confirm`]: super::Client::device_auth_confirm + #[derive(Clone)] + pub struct DeviceAuthConfirm<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> DeviceAuthConfirm<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::DeviceAuthVerify) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/device/confirm` + pub async fn send(self) -> Result>, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/device/confirm", client.baseurl,); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`Client::device_access_token`] + /// + ///[`Client::device_access_token`]: super::Client::device_access_token + #[derive(Clone)] + pub struct DeviceAccessToken<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> DeviceAccessToken<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::DeviceAccessTokenRequest) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/device/token` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/device/token", client.baseurl,); + let 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))), + } + } + } + + ///Builder for [`Client::rack_list`] + /// + ///[`Client::rack_list`]: super::Client::rack_list + #[derive(Clone)] + pub struct RackList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> HardwareRacksGet<'a> { + impl<'a> RackList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -3784,16 +4607,16 @@ pub mod builder { } } - ///Builder for [`Client::hardware_racks_get_rack`] + ///Builder for [`Client::rack_view`] /// - ///[`Client::hardware_racks_get_rack`]: super::Client::hardware_racks_get_rack + ///[`Client::rack_view`]: super::Client::rack_view #[derive(Clone)] - pub struct HardwareRacksGetRack<'a> { + pub struct RackView<'a> { client: &'a super::Client, rack_id: Option, } - impl<'a> HardwareRacksGetRack<'a> { + impl<'a> RackView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -3843,18 +4666,18 @@ pub mod builder { } } - ///Builder for [`Client::hardware_sleds_get`] + ///Builder for [`Client::sled_list`] /// - ///[`Client::hardware_sleds_get`]: super::Client::hardware_sleds_get + ///[`Client::sled_list`]: super::Client::sled_list #[derive(Clone)] - pub struct HardwareSledsGet<'a> { + pub struct SledList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> HardwareSledsGet<'a> { + impl<'a> SledList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -3963,16 +4786,16 @@ pub mod builder { } } - ///Builder for [`Client::hardware_sleds_get_sled`] + ///Builder for [`Client::sled_view`] /// - ///[`Client::hardware_sleds_get_sled`]: super::Client::hardware_sleds_get_sled + ///[`Client::sled_view`]: super::Client::sled_view #[derive(Clone)] - pub struct HardwareSledsGetSled<'a> { + pub struct SledView<'a> { client: &'a super::Client, sled_id: Option, } - impl<'a> HardwareSledsGetSled<'a> { + impl<'a> SledView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4022,18 +4845,18 @@ pub mod builder { } } - ///Builder for [`Client::images_get`] + ///Builder for [`Client::image_global_list`] /// - ///[`Client::images_get`]: super::Client::images_get + ///[`Client::image_global_list`]: super::Client::image_global_list #[derive(Clone)] - pub struct ImagesGet<'a> { + pub struct ImageGlobalList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> ImagesGet<'a> { + impl<'a> ImageGlobalList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4142,21 +4965,21 @@ pub mod builder { } } - ///Builder for [`Client::images_post`] + ///Builder for [`Client::image_global_create`] /// - ///[`Client::images_post`]: super::Client::images_post + ///[`Client::image_global_create`]: super::Client::image_global_create #[derive(Clone)] - pub struct ImagesPost<'a> { + pub struct ImageGlobalCreate<'a> { client: &'a super::Client, - body: Option, + body: Option, } - impl<'a> ImagesPost<'a> { + impl<'a> ImageGlobalCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } - pub fn body(mut self, value: types::ImageCreate) -> Self { + pub fn body(mut self, value: types::GlobalImageCreate) -> Self { self.body = Some(value); self } @@ -4194,16 +5017,16 @@ pub mod builder { } } - ///Builder for [`Client::images_get_image`] + ///Builder for [`Client::image_global_view`] /// - ///[`Client::images_get_image`]: super::Client::images_get_image + ///[`Client::image_global_view`]: super::Client::image_global_view #[derive(Clone)] - pub struct ImagesGetImage<'a> { + pub struct ImageGlobalView<'a> { client: &'a super::Client, image_name: Option, } - impl<'a> ImagesGetImage<'a> { + impl<'a> ImageGlobalView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4253,16 +5076,16 @@ pub mod builder { } } - ///Builder for [`Client::images_delete_image`] + ///Builder for [`Client::image_global_delete`] /// - ///[`Client::images_delete_image`]: super::Client::images_delete_image + ///[`Client::image_global_delete`]: super::Client::image_global_delete #[derive(Clone)] - pub struct ImagesDeleteImage<'a> { + pub struct ImageGlobalDelete<'a> { client: &'a super::Client, image_name: Option, } - impl<'a> ImagesDeleteImage<'a> { + impl<'a> ImageGlobalDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4312,13 +5135,655 @@ pub mod builder { } } + ///Builder for [`Client::ip_pool_list`] + /// + ///[`Client::ip_pool_list`]: super::Client::ip_pool_list + #[derive(Clone)] + pub struct IpPoolList<'a> { + client: &'a super::Client, + limit: Option, + page_token: Option, + sort_by: Option, + } + + impl<'a> IpPoolList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + limit: None, + page_token: None, + sort_by: None, + } + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + pub fn sort_by(mut self, value: types::NameOrIdSortMode) -> Self { + self.sort_by = Some(value); + self + } + + ///Sends a `GET` request to `/ip-pools` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + limit, + page_token, + sort_by, + } = self; + let url = format!("{}/ip-pools", client.baseurl,); + let mut query = Vec::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/ip-pools` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + sort_by: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`Client::ip_pool_create`] + /// + ///[`Client::ip_pool_create`]: super::Client::ip_pool_create + #[derive(Clone)] + pub struct IpPoolCreate<'a> { + client: &'a super::Client, + body: Option, + } + + impl<'a> IpPoolCreate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client, body: None } + } + + pub fn body(mut self, value: types::IpPoolCreate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/ip-pools` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let (body,) = match (body,) { + (Some(body),) => (body,), + (body,) => { + let mut missing = Vec::new(); + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!("{}/ip-pools", client.baseurl,); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`Client::ip_pool_view`] + /// + ///[`Client::ip_pool_view`]: super::Client::ip_pool_view + #[derive(Clone)] + pub struct IpPoolView<'a> { + client: &'a super::Client, + pool_name: Option, + } + + impl<'a> IpPoolView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + ///Sends a `GET` request to `/ip-pools/{pool_name}` + pub async fn send(self) -> Result, Error> { + let Self { client, pool_name } = self; + let (pool_name,) = match (pool_name,) { + (Some(pool_name),) => (pool_name,), + (pool_name,) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.get(url).build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 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 [`Client::ip_pool_update`] + /// + ///[`Client::ip_pool_update`]: super::Client::ip_pool_update + #[derive(Clone)] + pub struct IpPoolUpdate<'a> { + client: &'a super::Client, + pool_name: Option, + body: Option, + } + + impl<'a> IpPoolUpdate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + body: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn body(mut self, value: types::IpPoolUpdate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `PUT` request to `/ip-pools/{pool_name}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + pool_name, + body, + } = self; + let (pool_name, body) = match (pool_name, body) { + (Some(pool_name), Some(body)) => (pool_name, body), + (pool_name, body) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.put(url).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)), + } + } + } + + ///Builder for [`Client::ip_pool_delete`] + /// + ///[`Client::ip_pool_delete`]: super::Client::ip_pool_delete + #[derive(Clone)] + pub struct IpPoolDelete<'a> { + client: &'a super::Client, + pool_name: Option, + } + + impl<'a> IpPoolDelete<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + ///Sends a `DELETE` request to `/ip-pools/{pool_name}` + pub async fn send(self) -> Result, Error> { + let Self { client, pool_name } = self; + let (pool_name,) = match (pool_name,) { + (Some(pool_name),) => (pool_name,), + (pool_name,) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.delete(url).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)), + } + } + } + + ///Builder for [`Client::ip_pool_range_list`] + /// + ///[`Client::ip_pool_range_list`]: super::Client::ip_pool_range_list + #[derive(Clone)] + pub struct IpPoolRangeList<'a> { + client: &'a super::Client, + pool_name: Option, + limit: Option, + page_token: Option, + } + + impl<'a> IpPoolRangeList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + limit: None, + page_token: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + pool_name, + limit, + page_token, + } = self; + let (pool_name,) = match (pool_name,) { + (Some(pool_name),) => (pool_name,), + (pool_name,) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}/ranges", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let mut query = Vec::new(); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/ip-pools/{pool_name}/ranges` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`Client::ip_pool_range_add`] + /// + ///[`Client::ip_pool_range_add`]: super::Client::ip_pool_range_add + #[derive(Clone)] + pub struct IpPoolRangeAdd<'a> { + client: &'a super::Client, + pool_name: Option, + body: Option, + } + + impl<'a> IpPoolRangeAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + body: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn body(mut self, value: types::IpRange) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/add` + pub async fn send(self) -> Result, Error> { + let Self { + client, + pool_name, + body, + } = self; + let (pool_name, body) = match (pool_name, body) { + (Some(pool_name), Some(body)) => (pool_name, body), + (pool_name, body) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}/ranges/add", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`Client::ip_pool_range_remove`] + /// + ///[`Client::ip_pool_range_remove`]: super::Client::ip_pool_range_remove + #[derive(Clone)] + pub struct IpPoolRangeRemove<'a> { + client: &'a super::Client, + pool_name: Option, + body: Option, + } + + impl<'a> IpPoolRangeRemove<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + pool_name: None, + body: None, + } + } + + pub fn pool_name(mut self, value: types::Name) -> Self { + self.pool_name = Some(value); + self + } + + pub fn body(mut self, value: types::IpRange) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/remove` + pub async fn send(self) -> Result, Error> { + let Self { + client, + pool_name, + body, + } = self; + let (pool_name, body) = match (pool_name, body) { + (Some(pool_name), Some(body)) => (pool_name, body), + (pool_name, body) => { + let mut missing = Vec::new(); + if pool_name.is_none() { + missing.push(stringify!(pool_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/ip-pools/{}/ranges/remove", + client.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = client.client.post(url).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)), + } + } + } + ///Builder for [`Client::spoof_login`] /// ///[`Client::spoof_login`]: super::Client::spoof_login #[derive(Clone)] pub struct SpoofLogin<'a> { client: &'a super::Client, - body: Option, + body: Option, } impl<'a> SpoofLogin<'a> { @@ -4326,7 +5791,7 @@ pub mod builder { Self { client, body: None } } - pub fn body(mut self, value: types::LoginParams) -> Self { + pub fn body(mut self, value: types::SpoofLoginBody) -> Self { self.body = Some(value); self } @@ -4358,6 +5823,162 @@ pub mod builder { } } + ///Builder for [`Client::login`] + /// + ///[`Client::login`]: super::Client::login + #[derive(Clone)] + pub struct Login<'a> { + client: &'a super::Client, + silo_name: Option, + provider_name: Option, + } + + impl<'a> Login<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + provider_name: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn provider_name(mut self, value: types::Name) -> Self { + self.provider_name = Some(value); + self + } + + ///Sends a `GET` request to `/login/{silo_name}/{provider_name}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + silo_name, + provider_name, + } = self; + let (silo_name, provider_name) = match (silo_name, provider_name) { + (Some(silo_name), Some(provider_name)) => (silo_name, provider_name), + (silo_name, provider_name) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if provider_name.is_none() { + missing.push(stringify!(provider_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/login/{}/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let 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::ErrorResponse(ResponseValue::stream(response))), + } + } + } + + ///Builder for [`Client::consume_credentials`] + /// + ///[`Client::consume_credentials`]: super::Client::consume_credentials + pub struct ConsumeCredentials<'a> { + client: &'a super::Client, + silo_name: Option, + provider_name: Option, + body: Option, + } + + impl<'a> ConsumeCredentials<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + provider_name: None, + body: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn provider_name(mut self, value: types::Name) -> Self { + self.provider_name = Some(value); + self + } + + pub fn body>(mut self, value: B) -> Self { + self.body = Some(value.into()); + self + } + + ///Sends a `POST` request to `/login/{silo_name}/{provider_name}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + silo_name, + provider_name, + body, + } = self; + let (silo_name, provider_name, body) = match (silo_name, provider_name, body) { + (Some(silo_name), Some(provider_name), Some(body)) => { + (silo_name, provider_name, body) + } + (silo_name, provider_name, body) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if provider_name.is_none() { + missing.push(stringify!(provider_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/login/{}/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let 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)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + } + ///Builder for [`Client::logout`] /// ///[`Client::logout`]: super::Client::logout @@ -4385,18 +6006,18 @@ pub mod builder { } } - ///Builder for [`Client::organizations_get`] + ///Builder for [`Client::organization_list`] /// - ///[`Client::organizations_get`]: super::Client::organizations_get + ///[`Client::organization_list`]: super::Client::organization_list #[derive(Clone)] - pub struct OrganizationsGet<'a> { + pub struct OrganizationList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> OrganizationsGet<'a> { + impl<'a> OrganizationList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4505,16 +6126,16 @@ pub mod builder { } } - ///Builder for [`Client::organizations_post`] + ///Builder for [`Client::organization_create`] /// - ///[`Client::organizations_post`]: super::Client::organizations_post + ///[`Client::organization_create`]: super::Client::organization_create #[derive(Clone)] - pub struct OrganizationsPost<'a> { + pub struct OrganizationCreate<'a> { client: &'a super::Client, body: Option, } - impl<'a> OrganizationsPost<'a> { + impl<'a> OrganizationCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } @@ -4557,16 +6178,16 @@ pub mod builder { } } - ///Builder for [`Client::organizations_get_organization`] + ///Builder for [`Client::organization_view`] /// - ///[`Client::organizations_get_organization`]: super::Client::organizations_get_organization + ///[`Client::organization_view`]: super::Client::organization_view #[derive(Clone)] - pub struct OrganizationsGetOrganization<'a> { + pub struct OrganizationView<'a> { client: &'a super::Client, organization_name: Option, } - impl<'a> OrganizationsGetOrganization<'a> { + impl<'a> OrganizationView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4619,17 +6240,17 @@ pub mod builder { } } - ///Builder for [`Client::organizations_put_organization`] + ///Builder for [`Client::organization_update`] /// - ///[`Client::organizations_put_organization`]: super::Client::organizations_put_organization + ///[`Client::organization_update`]: super::Client::organization_update #[derive(Clone)] - pub struct OrganizationsPutOrganization<'a> { + pub struct OrganizationUpdate<'a> { client: &'a super::Client, organization_name: Option, body: Option, } - impl<'a> OrganizationsPutOrganization<'a> { + impl<'a> OrganizationUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4692,16 +6313,16 @@ pub mod builder { } } - ///Builder for [`Client::organizations_delete_organization`] + ///Builder for [`Client::organization_delete`] /// - ///[`Client::organizations_delete_organization`]: super::Client::organizations_delete_organization + ///[`Client::organization_delete`]: super::Client::organization_delete #[derive(Clone)] - pub struct OrganizationsDeleteOrganization<'a> { + pub struct OrganizationDelete<'a> { client: &'a super::Client, organization_name: Option, } - impl<'a> OrganizationsDeleteOrganization<'a> { + impl<'a> OrganizationDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4754,16 +6375,16 @@ pub mod builder { } } - ///Builder for [`Client::organization_get_policy`] + ///Builder for [`Client::organization_policy_view`] /// - ///[`Client::organization_get_policy`]: super::Client::organization_get_policy + ///[`Client::organization_policy_view`]: super::Client::organization_policy_view #[derive(Clone)] - pub struct OrganizationGetPolicy<'a> { + pub struct OrganizationPolicyView<'a> { client: &'a super::Client, organization_name: Option, } - impl<'a> OrganizationGetPolicy<'a> { + impl<'a> OrganizationPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4779,7 +6400,7 @@ pub mod builder { ///Sends a `GET` request to `/organizations/{organization_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -4818,17 +6439,17 @@ pub mod builder { } } - ///Builder for [`Client::organization_put_policy`] + ///Builder for [`Client::organization_policy_update`] /// - ///[`Client::organization_put_policy`]: super::Client::organization_put_policy + ///[`Client::organization_policy_update`]: super::Client::organization_policy_update #[derive(Clone)] - pub struct OrganizationPutPolicy<'a> { + pub struct OrganizationPolicyUpdate<'a> { client: &'a super::Client, organization_name: Option, - body: Option, + body: Option, } - impl<'a> OrganizationPutPolicy<'a> { + impl<'a> OrganizationPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -4842,7 +6463,7 @@ pub mod builder { self } - pub fn body(mut self, value: types::OrganizationRolesPolicy) -> Self { + pub fn body(mut self, value: types::OrganizationRolePolicy) -> Self { self.body = Some(value); self } @@ -4850,7 +6471,7 @@ pub mod builder { ///Sends a `PUT` request to `/organizations/{organization_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -4893,11 +6514,11 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_get`] + ///Builder for [`Client::project_list`] /// - ///[`Client::organization_projects_get`]: super::Client::organization_projects_get + ///[`Client::project_list`]: super::Client::project_list #[derive(Clone)] - pub struct OrganizationProjectsGet<'a> { + pub struct ProjectList<'a> { client: &'a super::Client, organization_name: Option, limit: Option, @@ -4905,7 +6526,7 @@ pub mod builder { sort_by: Option, } - impl<'a> OrganizationProjectsGet<'a> { + impl<'a> ProjectList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5040,17 +6661,17 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_post`] + ///Builder for [`Client::project_create`] /// - ///[`Client::organization_projects_post`]: super::Client::organization_projects_post + ///[`Client::project_create`]: super::Client::project_create #[derive(Clone)] - pub struct OrganizationProjectsPost<'a> { + pub struct ProjectCreate<'a> { client: &'a super::Client, organization_name: Option, body: Option, } - impl<'a> OrganizationProjectsPost<'a> { + impl<'a> ProjectCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5114,17 +6735,17 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_get_project`] + ///Builder for [`Client::project_view`] /// - ///[`Client::organization_projects_get_project`]: super::Client::organization_projects_get_project + ///[`Client::project_view`]: super::Client::project_view #[derive(Clone)] - pub struct OrganizationProjectsGetProject<'a> { + pub struct ProjectView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, } - impl<'a> OrganizationProjectsGetProject<'a> { + impl<'a> ProjectView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5189,18 +6810,18 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_put_project`] + ///Builder for [`Client::project_update`] /// - ///[`Client::organization_projects_put_project`]: super::Client::organization_projects_put_project + ///[`Client::project_update`]: super::Client::project_update #[derive(Clone)] - pub struct OrganizationProjectsPutProject<'a> { + pub struct ProjectUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> OrganizationProjectsPutProject<'a> { + impl<'a> ProjectUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5278,17 +6899,17 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_delete_project`] + ///Builder for [`Client::project_delete`] /// - ///[`Client::organization_projects_delete_project`]: super::Client::organization_projects_delete_project + ///[`Client::project_delete`]: super::Client::project_delete #[derive(Clone)] - pub struct OrganizationProjectsDeleteProject<'a> { + pub struct ProjectDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, } - impl<'a> OrganizationProjectsDeleteProject<'a> { + impl<'a> ProjectDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5353,11 +6974,11 @@ pub mod builder { } } - ///Builder for [`Client::project_disks_get`] + ///Builder for [`Client::disk_list`] /// - ///[`Client::project_disks_get`]: super::Client::project_disks_get + ///[`Client::disk_list`]: super::Client::disk_list #[derive(Clone)] - pub struct ProjectDisksGet<'a> { + pub struct DiskList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -5366,7 +6987,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectDisksGet<'a> { + impl<'a> DiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5512,18 +7133,18 @@ pub mod builder { } } - ///Builder for [`Client::project_disks_post`] + ///Builder for [`Client::disk_create`] /// - ///[`Client::project_disks_post`]: super::Client::project_disks_post + ///[`Client::disk_create`]: super::Client::disk_create #[derive(Clone)] - pub struct ProjectDisksPost<'a> { + pub struct DiskCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectDisksPost<'a> { + impl<'a> DiskCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5601,18 +7222,18 @@ pub mod builder { } } - ///Builder for [`Client::project_disks_get_disk`] + ///Builder for [`Client::disk_view`] /// - ///[`Client::project_disks_get_disk`]: super::Client::project_disks_get_disk + ///[`Client::disk_view`]: super::Client::disk_view #[derive(Clone)] - pub struct ProjectDisksGetDisk<'a> { + pub struct DiskView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, disk_name: Option, } - impl<'a> ProjectDisksGetDisk<'a> { + impl<'a> DiskView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5692,18 +7313,18 @@ pub mod builder { } } - ///Builder for [`Client::project_disks_delete_disk`] + ///Builder for [`Client::disk_delete`] /// - ///[`Client::project_disks_delete_disk`]: super::Client::project_disks_delete_disk + ///[`Client::disk_delete`]: super::Client::disk_delete #[derive(Clone)] - pub struct ProjectDisksDeleteDisk<'a> { + pub struct DiskDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, disk_name: Option, } - impl<'a> ProjectDisksDeleteDisk<'a> { + impl<'a> DiskDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5783,11 +7404,11 @@ pub mod builder { } } - ///Builder for [`Client::project_images_get`] + ///Builder for [`Client::image_list`] /// - ///[`Client::project_images_get`]: super::Client::project_images_get + ///[`Client::image_list`]: super::Client::image_list #[derive(Clone)] - pub struct ProjectImagesGet<'a> { + pub struct ImageList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -5796,7 +7417,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectImagesGet<'a> { + impl<'a> ImageList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -5942,18 +7563,18 @@ pub mod builder { } } - ///Builder for [`Client::project_images_post`] + ///Builder for [`Client::image_create`] /// - ///[`Client::project_images_post`]: super::Client::project_images_post + ///[`Client::image_create`]: super::Client::image_create #[derive(Clone)] - pub struct ProjectImagesPost<'a> { + pub struct ImageCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectImagesPost<'a> { + impl<'a> ImageCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6031,18 +7652,18 @@ pub mod builder { } } - ///Builder for [`Client::project_images_get_image`] + ///Builder for [`Client::image_view`] /// - ///[`Client::project_images_get_image`]: super::Client::project_images_get_image + ///[`Client::image_view`]: super::Client::image_view #[derive(Clone)] - pub struct ProjectImagesGetImage<'a> { + pub struct ImageView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, image_name: Option, } - impl<'a> ProjectImagesGetImage<'a> { + impl<'a> ImageView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6122,18 +7743,18 @@ pub mod builder { } } - ///Builder for [`Client::project_images_delete_image`] + ///Builder for [`Client::image_delete`] /// - ///[`Client::project_images_delete_image`]: super::Client::project_images_delete_image + ///[`Client::image_delete`]: super::Client::image_delete #[derive(Clone)] - pub struct ProjectImagesDeleteImage<'a> { + pub struct ImageDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, image_name: Option, } - impl<'a> ProjectImagesDeleteImage<'a> { + impl<'a> ImageDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6213,11 +7834,11 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_get`] + ///Builder for [`Client::instance_list`] /// - ///[`Client::project_instances_get`]: super::Client::project_instances_get + ///[`Client::instance_list`]: super::Client::instance_list #[derive(Clone)] - pub struct ProjectInstancesGet<'a> { + pub struct InstanceList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -6226,7 +7847,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectInstancesGet<'a> { + impl<'a> InstanceList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6374,18 +7995,18 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_post`] + ///Builder for [`Client::instance_create`] /// - ///[`Client::project_instances_post`]: super::Client::project_instances_post + ///[`Client::instance_create`]: super::Client::instance_create #[derive(Clone)] - pub struct ProjectInstancesPost<'a> { + pub struct InstanceCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectInstancesPost<'a> { + impl<'a> InstanceCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6464,18 +8085,18 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_get_instance`] + ///Builder for [`Client::instance_view`] /// - ///[`Client::project_instances_get_instance`]: super::Client::project_instances_get_instance + ///[`Client::instance_view`]: super::Client::instance_view #[derive(Clone)] - pub struct ProjectInstancesGetInstance<'a> { + pub struct InstanceView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesGetInstance<'a> { + impl<'a> InstanceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6555,18 +8176,18 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_delete_instance`] + ///Builder for [`Client::instance_delete`] /// - ///[`Client::project_instances_delete_instance`]: super::Client::project_instances_delete_instance + ///[`Client::instance_delete`]: super::Client::instance_delete #[derive(Clone)] - pub struct ProjectInstancesDeleteInstance<'a> { + pub struct InstanceDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesDeleteInstance<'a> { + impl<'a> InstanceDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6646,11 +8267,11 @@ pub mod builder { } } - ///Builder for [`Client::instance_disks_get`] + ///Builder for [`Client::instance_disk_list`] /// - ///[`Client::instance_disks_get`]: super::Client::instance_disks_get + ///[`Client::instance_disk_list`]: super::Client::instance_disk_list #[derive(Clone)] - pub struct InstanceDisksGet<'a> { + pub struct InstanceDiskList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -6660,7 +8281,7 @@ pub mod builder { sort_by: Option, } - impl<'a> InstanceDisksGet<'a> { + impl<'a> InstanceDiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6822,11 +8443,11 @@ pub mod builder { } } - ///Builder for [`Client::instance_disks_attach`] + ///Builder for [`Client::instance_disk_attach`] /// - ///[`Client::instance_disks_attach`]: super::Client::instance_disks_attach + ///[`Client::instance_disk_attach`]: super::Client::instance_disk_attach #[derive(Clone)] - pub struct InstanceDisksAttach<'a> { + pub struct InstanceDiskAttach<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -6834,7 +8455,7 @@ pub mod builder { body: Option, } - impl<'a> InstanceDisksAttach<'a> { + impl<'a> InstanceDiskAttach<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -6927,11 +8548,11 @@ pub mod builder { } } - ///Builder for [`Client::instance_disks_detach`] + ///Builder for [`Client::instance_disk_detach`] /// - ///[`Client::instance_disks_detach`]: super::Client::instance_disks_detach + ///[`Client::instance_disk_detach`]: super::Client::instance_disk_detach #[derive(Clone)] - pub struct InstanceDisksDetach<'a> { + pub struct InstanceDiskDetach<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -6939,7 +8560,7 @@ pub mod builder { body: Option, } - impl<'a> InstanceDisksDetach<'a> { + impl<'a> InstanceDiskDetach<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7032,11 +8653,11 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_migrate_instance`] + ///Builder for [`Client::instance_migrate`] /// - ///[`Client::project_instances_migrate_instance`]: super::Client::project_instances_migrate_instance + ///[`Client::instance_migrate`]: super::Client::instance_migrate #[derive(Clone)] - pub struct ProjectInstancesMigrateInstance<'a> { + pub struct InstanceMigrate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7044,7 +8665,7 @@ pub mod builder { body: Option, } - impl<'a> ProjectInstancesMigrateInstance<'a> { + impl<'a> InstanceMigrate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7137,11 +8758,11 @@ pub mod builder { } } - ///Builder for [`Client::instance_network_interfaces_get`] + ///Builder for [`Client::instance_network_interface_list`] /// - ///[`Client::instance_network_interfaces_get`]: super::Client::instance_network_interfaces_get + ///[`Client::instance_network_interface_list`]: super::Client::instance_network_interface_list #[derive(Clone)] - pub struct InstanceNetworkInterfacesGet<'a> { + pub struct InstanceNetworkInterfaceList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7151,7 +8772,7 @@ pub mod builder { sort_by: Option, } - impl<'a> InstanceNetworkInterfacesGet<'a> { + impl<'a> InstanceNetworkInterfaceList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7314,11 +8935,11 @@ pub mod builder { } } - ///Builder for [`Client::instance_network_interfaces_post`] + ///Builder for [`Client::instance_network_interface_create`] /// - ///[`Client::instance_network_interfaces_post`]: super::Client::instance_network_interfaces_post + ///[`Client::instance_network_interface_create`]: super::Client::instance_network_interface_create #[derive(Clone)] - pub struct InstanceNetworkInterfacesPost<'a> { + pub struct InstanceNetworkInterfaceCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7326,7 +8947,7 @@ pub mod builder { body: Option, } - impl<'a> InstanceNetworkInterfacesPost<'a> { + impl<'a> InstanceNetworkInterfaceCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7421,11 +9042,11 @@ pub mod builder { } } - ///Builder for [`Client::instance_network_interfaces_get_interface`] + ///Builder for [`Client::instance_network_interface_view`] /// - ///[`Client::instance_network_interfaces_get_interface`]: super::Client::instance_network_interfaces_get_interface + ///[`Client::instance_network_interface_view`]: super::Client::instance_network_interface_view #[derive(Clone)] - pub struct InstanceNetworkInterfacesGetInterface<'a> { + pub struct InstanceNetworkInterfaceView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7433,7 +9054,7 @@ pub mod builder { interface_name: Option, } - impl<'a> InstanceNetworkInterfacesGetInterface<'a> { + impl<'a> InstanceNetworkInterfaceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7538,11 +9159,142 @@ pub mod builder { } } - ///Builder for [`Client::instance_network_interfaces_delete_interface`] + ///Builder for [`Client::instance_network_interface_update`] /// - ///[`Client::instance_network_interfaces_delete_interface`]: super::Client::instance_network_interfaces_delete_interface + ///[`Client::instance_network_interface_update`]: super::Client::instance_network_interface_update #[derive(Clone)] - pub struct InstanceNetworkInterfacesDeleteInterface<'a> { + pub struct InstanceNetworkInterfaceUpdate<'a> { + client: &'a super::Client, + organization_name: Option, + project_name: Option, + instance_name: Option, + interface_name: Option, + body: Option, + } + + impl<'a> InstanceNetworkInterfaceUpdate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + organization_name: None, + project_name: None, + instance_name: None, + interface_name: None, + body: None, + } + } + + pub fn organization_name(mut self, value: types::Name) -> Self { + self.organization_name = Some(value); + self + } + + pub fn project_name(mut self, value: types::Name) -> Self { + self.project_name = Some(value); + self + } + + pub fn instance_name(mut self, value: types::Name) -> Self { + self.instance_name = Some(value); + self + } + + pub fn interface_name(mut self, value: types::Name) -> Self { + self.interface_name = Some(value); + self + } + + pub fn body(mut self, value: types::NetworkInterfaceUpdate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/ + /// instances/{instance_name}/network-interfaces/{interface_name}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + organization_name, + project_name, + instance_name, + interface_name, + body, + } = self; + let (organization_name, project_name, instance_name, interface_name, body) = match ( + organization_name, + project_name, + instance_name, + interface_name, + body, + ) { + ( + Some(organization_name), + Some(project_name), + Some(instance_name), + Some(interface_name), + Some(body), + ) => ( + organization_name, + project_name, + instance_name, + interface_name, + body, + ), + (organization_name, project_name, instance_name, interface_name, body) => { + let mut missing = Vec::new(); + if organization_name.is_none() { + missing.push(stringify!(organization_name)); + } + if project_name.is_none() { + missing.push(stringify!(project_name)); + } + if instance_name.is_none() { + missing.push(stringify!(instance_name)); + } + if interface_name.is_none() { + missing.push(stringify!(interface_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + 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()), + ); + let request = client.client.put(url).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)), + } + } + } + + ///Builder for [`Client::instance_network_interface_delete`] + /// + ///[`Client::instance_network_interface_delete`]: super::Client::instance_network_interface_delete + #[derive(Clone)] + pub struct InstanceNetworkInterfaceDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -7550,7 +9302,7 @@ pub mod builder { interface_name: Option, } - impl<'a> InstanceNetworkInterfacesDeleteInterface<'a> { + impl<'a> InstanceNetworkInterfaceDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7653,18 +9405,18 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_instance_reboot`] + ///Builder for [`Client::instance_reboot`] /// - ///[`Client::project_instances_instance_reboot`]: super::Client::project_instances_instance_reboot + ///[`Client::instance_reboot`]: super::Client::instance_reboot #[derive(Clone)] - pub struct ProjectInstancesInstanceReboot<'a> { + pub struct InstanceReboot<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesInstanceReboot<'a> { + impl<'a> InstanceReboot<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7744,18 +9496,145 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_instance_start`] + ///Builder for [`Client::instance_serial_console`] /// - ///[`Client::project_instances_instance_start`]: super::Client::project_instances_instance_start + ///[`Client::instance_serial_console`]: super::Client::instance_serial_console #[derive(Clone)] - pub struct ProjectInstancesInstanceStart<'a> { + pub struct InstanceSerialConsole<'a> { + client: &'a super::Client, + organization_name: Option, + project_name: Option, + instance_name: Option, + from_start: Option, + max_bytes: Option, + most_recent: Option, + } + + impl<'a> InstanceSerialConsole<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + organization_name: None, + project_name: None, + instance_name: None, + from_start: None, + max_bytes: None, + most_recent: None, + } + } + + pub fn organization_name(mut self, value: types::Name) -> Self { + self.organization_name = Some(value); + self + } + + pub fn project_name(mut self, value: types::Name) -> Self { + self.project_name = Some(value); + self + } + + pub fn instance_name(mut self, value: types::Name) -> Self { + self.instance_name = Some(value); + self + } + + pub fn from_start(mut self, value: u64) -> Self { + self.from_start = Some(value); + self + } + + pub fn max_bytes(mut self, value: u64) -> Self { + self.max_bytes = Some(value); + self + } + + pub fn most_recent(mut self, value: u64) -> Self { + self.most_recent = Some(value); + self + } + + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/ + /// instances/{instance_name}/serial-console` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + organization_name, + project_name, + instance_name, + from_start, + max_bytes, + most_recent, + } = self; + let (organization_name, project_name, instance_name) = + match (organization_name, project_name, instance_name) { + (Some(organization_name), Some(project_name), Some(instance_name)) => { + (organization_name, project_name, instance_name) + } + (organization_name, project_name, instance_name) => { + let mut missing = Vec::new(); + if organization_name.is_none() { + missing.push(stringify!(organization_name)); + } + if project_name.is_none() { + missing.push(stringify!(project_name)); + } + if instance_name.is_none() { + missing.push(stringify!(instance_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + 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::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + } + + ///Builder for [`Client::instance_start`] + /// + ///[`Client::instance_start`]: super::Client::instance_start + #[derive(Clone)] + pub struct InstanceStart<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesInstanceStart<'a> { + impl<'a> InstanceStart<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7835,18 +9714,18 @@ pub mod builder { } } - ///Builder for [`Client::project_instances_instance_stop`] + ///Builder for [`Client::instance_stop`] /// - ///[`Client::project_instances_instance_stop`]: super::Client::project_instances_instance_stop + ///[`Client::instance_stop`]: super::Client::instance_stop #[derive(Clone)] - pub struct ProjectInstancesInstanceStop<'a> { + pub struct InstanceStop<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, instance_name: Option, } - impl<'a> ProjectInstancesInstanceStop<'a> { + impl<'a> InstanceStop<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7926,17 +9805,17 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_get_project_policy`] + ///Builder for [`Client::project_policy_view`] /// - ///[`Client::organization_projects_get_project_policy`]: super::Client::organization_projects_get_project_policy + ///[`Client::project_policy_view`]: super::Client::project_policy_view #[derive(Clone)] - pub struct OrganizationProjectsGetProjectPolicy<'a> { + pub struct ProjectPolicyView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, } - impl<'a> OrganizationProjectsGetProjectPolicy<'a> { + impl<'a> ProjectPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -7959,7 +9838,7 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -8003,18 +9882,18 @@ pub mod builder { } } - ///Builder for [`Client::organization_projects_put_project_policy`] + ///Builder for [`Client::project_policy_update`] /// - ///[`Client::organization_projects_put_project_policy`]: super::Client::organization_projects_put_project_policy + ///[`Client::project_policy_update`]: super::Client::project_policy_update #[derive(Clone)] - pub struct OrganizationProjectsPutProjectPolicy<'a> { + pub struct ProjectPolicyUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, - body: Option, + body: Option, } - impl<'a> OrganizationProjectsPutProjectPolicy<'a> { + impl<'a> ProjectPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8034,7 +9913,7 @@ pub mod builder { self } - pub fn body(mut self, value: types::ProjectRolesPolicy) -> Self { + pub fn body(mut self, value: types::ProjectRolePolicy) -> Self { self.body = Some(value); self } @@ -8043,7 +9922,7 @@ pub mod builder { /// `/organizations/{organization_name}/projects/{project_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, organization_name, @@ -8094,11 +9973,11 @@ pub mod builder { } } - ///Builder for [`Client::project_snapshots_get`] + ///Builder for [`Client::snapshot_list`] /// - ///[`Client::project_snapshots_get`]: super::Client::project_snapshots_get + ///[`Client::snapshot_list`]: super::Client::snapshot_list #[derive(Clone)] - pub struct ProjectSnapshotsGet<'a> { + pub struct SnapshotList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -8107,7 +9986,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectSnapshotsGet<'a> { + impl<'a> SnapshotList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8255,18 +10134,18 @@ pub mod builder { } } - ///Builder for [`Client::project_snapshots_post`] + ///Builder for [`Client::snapshot_create`] /// - ///[`Client::project_snapshots_post`]: super::Client::project_snapshots_post + ///[`Client::snapshot_create`]: super::Client::snapshot_create #[derive(Clone)] - pub struct ProjectSnapshotsPost<'a> { + pub struct SnapshotCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectSnapshotsPost<'a> { + impl<'a> SnapshotCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8345,18 +10224,18 @@ pub mod builder { } } - ///Builder for [`Client::project_snapshots_get_snapshot`] + ///Builder for [`Client::snapshot_view`] /// - ///[`Client::project_snapshots_get_snapshot`]: super::Client::project_snapshots_get_snapshot + ///[`Client::snapshot_view`]: super::Client::snapshot_view #[derive(Clone)] - pub struct ProjectSnapshotsGetSnapshot<'a> { + pub struct SnapshotView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, snapshot_name: Option, } - impl<'a> ProjectSnapshotsGetSnapshot<'a> { + impl<'a> SnapshotView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8436,18 +10315,18 @@ pub mod builder { } } - ///Builder for [`Client::project_snapshots_delete_snapshot`] + ///Builder for [`Client::snapshot_delete`] /// - ///[`Client::project_snapshots_delete_snapshot`]: super::Client::project_snapshots_delete_snapshot + ///[`Client::snapshot_delete`]: super::Client::snapshot_delete #[derive(Clone)] - pub struct ProjectSnapshotsDeleteSnapshot<'a> { + pub struct SnapshotDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, snapshot_name: Option, } - impl<'a> ProjectSnapshotsDeleteSnapshot<'a> { + impl<'a> SnapshotDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8527,11 +10406,11 @@ pub mod builder { } } - ///Builder for [`Client::project_vpcs_get`] + ///Builder for [`Client::vpc_list`] /// - ///[`Client::project_vpcs_get`]: super::Client::project_vpcs_get + ///[`Client::vpc_list`]: super::Client::vpc_list #[derive(Clone)] - pub struct ProjectVpcsGet<'a> { + pub struct VpcList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -8540,7 +10419,7 @@ pub mod builder { sort_by: Option, } - impl<'a> ProjectVpcsGet<'a> { + impl<'a> VpcList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8686,18 +10565,18 @@ pub mod builder { } } - ///Builder for [`Client::project_vpcs_post`] + ///Builder for [`Client::vpc_create`] /// - ///[`Client::project_vpcs_post`]: super::Client::project_vpcs_post + ///[`Client::vpc_create`]: super::Client::vpc_create #[derive(Clone)] - pub struct ProjectVpcsPost<'a> { + pub struct VpcCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, body: Option, } - impl<'a> ProjectVpcsPost<'a> { + impl<'a> VpcCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8775,18 +10654,18 @@ pub mod builder { } } - ///Builder for [`Client::project_vpcs_get_vpc`] + ///Builder for [`Client::vpc_view`] /// - ///[`Client::project_vpcs_get_vpc`]: super::Client::project_vpcs_get_vpc + ///[`Client::vpc_view`]: super::Client::vpc_view #[derive(Clone)] - pub struct ProjectVpcsGetVpc<'a> { + pub struct VpcView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, vpc_name: Option, } - impl<'a> ProjectVpcsGetVpc<'a> { + impl<'a> VpcView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8866,11 +10745,11 @@ pub mod builder { } } - ///Builder for [`Client::project_vpcs_put_vpc`] + ///Builder for [`Client::vpc_update`] /// - ///[`Client::project_vpcs_put_vpc`]: super::Client::project_vpcs_put_vpc + ///[`Client::vpc_update`]: super::Client::vpc_update #[derive(Clone)] - pub struct ProjectVpcsPutVpc<'a> { + pub struct VpcUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -8878,7 +10757,7 @@ pub mod builder { body: Option, } - impl<'a> ProjectVpcsPutVpc<'a> { + impl<'a> VpcUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -8968,18 +10847,18 @@ pub mod builder { } } - ///Builder for [`Client::project_vpcs_delete_vpc`] + ///Builder for [`Client::vpc_delete`] /// - ///[`Client::project_vpcs_delete_vpc`]: super::Client::project_vpcs_delete_vpc + ///[`Client::vpc_delete`]: super::Client::vpc_delete #[derive(Clone)] - pub struct ProjectVpcsDeleteVpc<'a> { + pub struct VpcDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, vpc_name: Option, } - impl<'a> ProjectVpcsDeleteVpc<'a> { + impl<'a> VpcDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9059,18 +10938,18 @@ pub mod builder { } } - ///Builder for [`Client::vpc_firewall_rules_get`] + ///Builder for [`Client::vpc_firewall_rules_view`] /// - ///[`Client::vpc_firewall_rules_get`]: super::Client::vpc_firewall_rules_get + ///[`Client::vpc_firewall_rules_view`]: super::Client::vpc_firewall_rules_view #[derive(Clone)] - pub struct VpcFirewallRulesGet<'a> { + pub struct VpcFirewallRulesView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, vpc_name: Option, } - impl<'a> VpcFirewallRulesGet<'a> { + impl<'a> VpcFirewallRulesView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9152,11 +11031,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_firewall_rules_put`] + ///Builder for [`Client::vpc_firewall_rules_update`] /// - ///[`Client::vpc_firewall_rules_put`]: super::Client::vpc_firewall_rules_put + ///[`Client::vpc_firewall_rules_update`]: super::Client::vpc_firewall_rules_update #[derive(Clone)] - pub struct VpcFirewallRulesPut<'a> { + pub struct VpcFirewallRulesUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9164,7 +11043,7 @@ pub mod builder { body: Option, } - impl<'a> VpcFirewallRulesPut<'a> { + impl<'a> VpcFirewallRulesUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9256,11 +11135,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_routers_get`] + ///Builder for [`Client::vpc_router_list`] /// - ///[`Client::vpc_routers_get`]: super::Client::vpc_routers_get + ///[`Client::vpc_router_list`]: super::Client::vpc_router_list #[derive(Clone)] - pub struct VpcRoutersGet<'a> { + pub struct VpcRouterList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9270,7 +11149,7 @@ pub mod builder { sort_by: Option, } - impl<'a> VpcRoutersGet<'a> { + impl<'a> VpcRouterList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9432,11 +11311,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_routers_post`] + ///Builder for [`Client::vpc_router_create`] /// - ///[`Client::vpc_routers_post`]: super::Client::vpc_routers_post + ///[`Client::vpc_router_create`]: super::Client::vpc_router_create #[derive(Clone)] - pub struct VpcRoutersPost<'a> { + pub struct VpcRouterCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9444,7 +11323,7 @@ pub mod builder { body: Option, } - impl<'a> VpcRoutersPost<'a> { + impl<'a> VpcRouterCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9534,11 +11413,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_routers_get_router`] + ///Builder for [`Client::vpc_router_view`] /// - ///[`Client::vpc_routers_get_router`]: super::Client::vpc_routers_get_router + ///[`Client::vpc_router_view`]: super::Client::vpc_router_view #[derive(Clone)] - pub struct VpcRoutersGetRouter<'a> { + pub struct VpcRouterView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9546,7 +11425,7 @@ pub mod builder { router_name: Option, } - impl<'a> VpcRoutersGetRouter<'a> { + impl<'a> VpcRouterView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9640,11 +11519,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_routers_put_router`] + ///Builder for [`Client::vpc_router_update`] /// - ///[`Client::vpc_routers_put_router`]: super::Client::vpc_routers_put_router + ///[`Client::vpc_router_update`]: super::Client::vpc_router_update #[derive(Clone)] - pub struct VpcRoutersPutRouter<'a> { + pub struct VpcRouterUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9653,7 +11532,7 @@ pub mod builder { body: Option, } - impl<'a> VpcRoutersPutRouter<'a> { + impl<'a> VpcRouterUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9758,11 +11637,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_routers_delete_router`] + ///Builder for [`Client::vpc_router_delete`] /// - ///[`Client::vpc_routers_delete_router`]: super::Client::vpc_routers_delete_router + ///[`Client::vpc_router_delete`]: super::Client::vpc_router_delete #[derive(Clone)] - pub struct VpcRoutersDeleteRouter<'a> { + pub struct VpcRouterDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9770,7 +11649,7 @@ pub mod builder { router_name: Option, } - impl<'a> VpcRoutersDeleteRouter<'a> { + impl<'a> VpcRouterDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -9864,11 +11743,11 @@ pub mod builder { } } - ///Builder for [`Client::routers_routes_get`] + ///Builder for [`Client::vpc_router_route_list`] /// - ///[`Client::routers_routes_get`]: super::Client::routers_routes_get + ///[`Client::vpc_router_route_list`]: super::Client::vpc_router_route_list #[derive(Clone)] - pub struct RoutersRoutesGet<'a> { + pub struct VpcRouterRouteList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -9879,7 +11758,7 @@ pub mod builder { sort_by: Option, } - impl<'a> RoutersRoutesGet<'a> { + impl<'a> VpcRouterRouteList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10055,11 +11934,11 @@ pub mod builder { } } - ///Builder for [`Client::routers_routes_post`] + ///Builder for [`Client::vpc_router_route_create`] /// - ///[`Client::routers_routes_post`]: super::Client::routers_routes_post + ///[`Client::vpc_router_route_create`]: super::Client::vpc_router_route_create #[derive(Clone)] - pub struct RoutersRoutesPost<'a> { + pub struct VpcRouterRouteCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10068,7 +11947,7 @@ pub mod builder { body: Option, } - impl<'a> RoutersRoutesPost<'a> { + impl<'a> VpcRouterRouteCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10173,11 +12052,11 @@ pub mod builder { } } - ///Builder for [`Client::routers_routes_get_route`] + ///Builder for [`Client::vpc_router_route_view`] /// - ///[`Client::routers_routes_get_route`]: super::Client::routers_routes_get_route + ///[`Client::vpc_router_route_view`]: super::Client::vpc_router_route_view #[derive(Clone)] - pub struct RoutersRoutesGetRoute<'a> { + pub struct VpcRouterRouteView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10186,7 +12065,7 @@ pub mod builder { route_name: Option, } - impl<'a> RoutersRoutesGetRoute<'a> { + impl<'a> VpcRouterRouteView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10303,11 +12182,11 @@ pub mod builder { } } - ///Builder for [`Client::routers_routes_put_route`] + ///Builder for [`Client::vpc_router_route_update`] /// - ///[`Client::routers_routes_put_route`]: super::Client::routers_routes_put_route + ///[`Client::vpc_router_route_update`]: super::Client::vpc_router_route_update #[derive(Clone)] - pub struct RoutersRoutesPutRoute<'a> { + pub struct VpcRouterRouteUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10317,7 +12196,7 @@ pub mod builder { body: Option, } - impl<'a> RoutersRoutesPutRoute<'a> { + impl<'a> VpcRouterRouteUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10447,11 +12326,11 @@ pub mod builder { } } - ///Builder for [`Client::routers_routes_delete_route`] + ///Builder for [`Client::vpc_router_route_delete`] /// - ///[`Client::routers_routes_delete_route`]: super::Client::routers_routes_delete_route + ///[`Client::vpc_router_route_delete`]: super::Client::vpc_router_route_delete #[derive(Clone)] - pub struct RoutersRoutesDeleteRoute<'a> { + pub struct VpcRouterRouteDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10460,7 +12339,7 @@ pub mod builder { route_name: Option, } - impl<'a> RoutersRoutesDeleteRoute<'a> { + impl<'a> VpcRouterRouteDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10577,11 +12456,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_subnets_get`] + ///Builder for [`Client::vpc_subnet_list`] /// - ///[`Client::vpc_subnets_get`]: super::Client::vpc_subnets_get + ///[`Client::vpc_subnet_list`]: super::Client::vpc_subnet_list #[derive(Clone)] - pub struct VpcSubnetsGet<'a> { + pub struct VpcSubnetList<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10591,7 +12470,7 @@ pub mod builder { sort_by: Option, } - impl<'a> VpcSubnetsGet<'a> { + impl<'a> VpcSubnetList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10753,11 +12632,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_subnets_post`] + ///Builder for [`Client::vpc_subnet_create`] /// - ///[`Client::vpc_subnets_post`]: super::Client::vpc_subnets_post + ///[`Client::vpc_subnet_create`]: super::Client::vpc_subnet_create #[derive(Clone)] - pub struct VpcSubnetsPost<'a> { + pub struct VpcSubnetCreate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10765,7 +12644,7 @@ pub mod builder { body: Option, } - impl<'a> VpcSubnetsPost<'a> { + impl<'a> VpcSubnetCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10855,11 +12734,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_subnets_get_subnet`] + ///Builder for [`Client::vpc_subnet_view`] /// - ///[`Client::vpc_subnets_get_subnet`]: super::Client::vpc_subnets_get_subnet + ///[`Client::vpc_subnet_view`]: super::Client::vpc_subnet_view #[derive(Clone)] - pub struct VpcSubnetsGetSubnet<'a> { + pub struct VpcSubnetView<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10867,7 +12746,7 @@ pub mod builder { subnet_name: Option, } - impl<'a> VpcSubnetsGetSubnet<'a> { + impl<'a> VpcSubnetView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -10961,11 +12840,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_subnets_put_subnet`] + ///Builder for [`Client::vpc_subnet_update`] /// - ///[`Client::vpc_subnets_put_subnet`]: super::Client::vpc_subnets_put_subnet + ///[`Client::vpc_subnet_update`]: super::Client::vpc_subnet_update #[derive(Clone)] - pub struct VpcSubnetsPutSubnet<'a> { + pub struct VpcSubnetUpdate<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -10974,7 +12853,7 @@ pub mod builder { body: Option, } - impl<'a> VpcSubnetsPutSubnet<'a> { + impl<'a> VpcSubnetUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11079,11 +12958,11 @@ pub mod builder { } } - ///Builder for [`Client::vpc_subnets_delete_subnet`] + ///Builder for [`Client::vpc_subnet_delete`] /// - ///[`Client::vpc_subnets_delete_subnet`]: super::Client::vpc_subnets_delete_subnet + ///[`Client::vpc_subnet_delete`]: super::Client::vpc_subnet_delete #[derive(Clone)] - pub struct VpcSubnetsDeleteSubnet<'a> { + pub struct VpcSubnetDelete<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -11091,7 +12970,7 @@ pub mod builder { subnet_name: Option, } - impl<'a> VpcSubnetsDeleteSubnet<'a> { + impl<'a> VpcSubnetDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11185,11 +13064,11 @@ pub mod builder { } } - ///Builder for [`Client::subnet_network_interfaces_get`] + ///Builder for [`Client::vpc_subnet_list_network_interfaces`] /// - ///[`Client::subnet_network_interfaces_get`]: super::Client::subnet_network_interfaces_get + ///[`Client::vpc_subnet_list_network_interfaces`]: super::Client::vpc_subnet_list_network_interfaces #[derive(Clone)] - pub struct SubnetNetworkInterfacesGet<'a> { + pub struct VpcSubnetListNetworkInterfaces<'a> { client: &'a super::Client, organization_name: Option, project_name: Option, @@ -11200,7 +13079,7 @@ pub mod builder { sort_by: Option, } - impl<'a> SubnetNetworkInterfacesGet<'a> { + impl<'a> VpcSubnetListNetworkInterfaces<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11377,15 +13256,15 @@ pub mod builder { } } - ///Builder for [`Client::policy_get`] + ///Builder for [`Client::policy_view`] /// - ///[`Client::policy_get`]: super::Client::policy_get + ///[`Client::policy_view`]: super::Client::policy_view #[derive(Clone)] - pub struct PolicyGet<'a> { + pub struct PolicyView<'a> { client: &'a super::Client, } - impl<'a> PolicyGet<'a> { + impl<'a> PolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } @@ -11393,7 +13272,7 @@ pub mod builder { ///Sends a `GET` request to `/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client } = self; let url = format!("{}/policy", client.baseurl,); let request = client.client.get(url).build()?; @@ -11412,21 +13291,21 @@ pub mod builder { } } - ///Builder for [`Client::policy_put`] + ///Builder for [`Client::policy_update`] /// - ///[`Client::policy_put`]: super::Client::policy_put + ///[`Client::policy_update`]: super::Client::policy_update #[derive(Clone)] - pub struct PolicyPut<'a> { + pub struct PolicyUpdate<'a> { client: &'a super::Client, - body: Option, + body: Option, } - impl<'a> PolicyPut<'a> { + impl<'a> PolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } - pub fn body(mut self, value: types::FleetRolesPolicy) -> Self { + pub fn body(mut self, value: types::FleetRolePolicy) -> Self { self.body = Some(value); self } @@ -11434,7 +13313,7 @@ pub mod builder { ///Sends a `PUT` request to `/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, body } = self; let (body,) = match (body,) { (Some(body),) => (body,), @@ -11466,17 +13345,17 @@ pub mod builder { } } - ///Builder for [`Client::roles_get`] + ///Builder for [`Client::role_list`] /// - ///[`Client::roles_get`]: super::Client::roles_get + ///[`Client::role_list`]: super::Client::role_list #[derive(Clone)] - pub struct RolesGet<'a> { + pub struct RoleList<'a> { client: &'a super::Client, limit: Option, page_token: Option, } - impl<'a> RolesGet<'a> { + impl<'a> RoleList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11574,16 +13453,16 @@ pub mod builder { } } - ///Builder for [`Client::roles_get_role`] + ///Builder for [`Client::role_view`] /// - ///[`Client::roles_get_role`]: super::Client::roles_get_role + ///[`Client::role_view`]: super::Client::role_view #[derive(Clone)] - pub struct RolesGetRole<'a> { + pub struct RoleView<'a> { client: &'a super::Client, role_name: Option, } - impl<'a> RolesGetRole<'a> { + impl<'a> RoleView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11633,18 +13512,18 @@ pub mod builder { } } - ///Builder for [`Client::sagas_get`] + ///Builder for [`Client::saga_list`] /// - ///[`Client::sagas_get`]: super::Client::sagas_get + ///[`Client::saga_list`]: super::Client::saga_list #[derive(Clone)] - pub struct SagasGet<'a> { + pub struct SagaList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> SagasGet<'a> { + impl<'a> SagaList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11753,16 +13632,16 @@ pub mod builder { } } - ///Builder for [`Client::sagas_get_saga`] + ///Builder for [`Client::saga_view`] /// - ///[`Client::sagas_get_saga`]: super::Client::sagas_get_saga + ///[`Client::saga_view`]: super::Client::saga_view #[derive(Clone)] - pub struct SagasGetSaga<'a> { + pub struct SagaView<'a> { client: &'a super::Client, saga_id: Option, } - impl<'a> SagasGetSaga<'a> { + impl<'a> SagaView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11845,18 +13724,18 @@ pub mod builder { } } - ///Builder for [`Client::sshkeys_get`] + ///Builder for [`Client::session_sshkey_list`] /// - ///[`Client::sshkeys_get`]: super::Client::sshkeys_get + ///[`Client::session_sshkey_list`]: super::Client::session_sshkey_list #[derive(Clone)] - pub struct SshkeysGet<'a> { + pub struct SessionSshkeyList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> SshkeysGet<'a> { + impl<'a> SessionSshkeyList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -11965,16 +13844,16 @@ pub mod builder { } } - ///Builder for [`Client::sshkeys_post`] + ///Builder for [`Client::session_sshkey_create`] /// - ///[`Client::sshkeys_post`]: super::Client::sshkeys_post + ///[`Client::session_sshkey_create`]: super::Client::session_sshkey_create #[derive(Clone)] - pub struct SshkeysPost<'a> { + pub struct SessionSshkeyCreate<'a> { client: &'a super::Client, body: Option, } - impl<'a> SshkeysPost<'a> { + impl<'a> SessionSshkeyCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } @@ -12017,16 +13896,16 @@ pub mod builder { } } - ///Builder for [`Client::sshkeys_get_key`] + ///Builder for [`Client::session_sshkey_view`] /// - ///[`Client::sshkeys_get_key`]: super::Client::sshkeys_get_key + ///[`Client::session_sshkey_view`]: super::Client::session_sshkey_view #[derive(Clone)] - pub struct SshkeysGetKey<'a> { + pub struct SessionSshkeyView<'a> { client: &'a super::Client, ssh_key_name: Option, } - impl<'a> SshkeysGetKey<'a> { + impl<'a> SessionSshkeyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12079,16 +13958,16 @@ pub mod builder { } } - ///Builder for [`Client::sshkeys_delete_key`] + ///Builder for [`Client::session_sshkey_delete`] /// - ///[`Client::sshkeys_delete_key`]: super::Client::sshkeys_delete_key + ///[`Client::session_sshkey_delete`]: super::Client::session_sshkey_delete #[derive(Clone)] - pub struct SshkeysDeleteKey<'a> { + pub struct SessionSshkeyDelete<'a> { client: &'a super::Client, ssh_key_name: Option, } - impl<'a> SshkeysDeleteKey<'a> { + impl<'a> SessionSshkeyDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12141,18 +14020,18 @@ pub mod builder { } } - ///Builder for [`Client::silos_get`] + ///Builder for [`Client::silo_list`] /// - ///[`Client::silos_get`]: super::Client::silos_get + ///[`Client::silo_list`]: super::Client::silo_list #[derive(Clone)] - pub struct SilosGet<'a> { + pub struct SiloList<'a> { client: &'a super::Client, limit: Option, page_token: Option, sort_by: Option, } - impl<'a> SilosGet<'a> { + impl<'a> SiloList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12261,16 +14140,16 @@ pub mod builder { } } - ///Builder for [`Client::silos_post`] + ///Builder for [`Client::silo_create`] /// - ///[`Client::silos_post`]: super::Client::silos_post + ///[`Client::silo_create`]: super::Client::silo_create #[derive(Clone)] - pub struct SilosPost<'a> { + pub struct SiloCreate<'a> { client: &'a super::Client, body: Option, } - impl<'a> SilosPost<'a> { + impl<'a> SiloCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: None } } @@ -12313,16 +14192,16 @@ pub mod builder { } } - ///Builder for [`Client::silos_get_silo`] + ///Builder for [`Client::silo_view`] /// - ///[`Client::silos_get_silo`]: super::Client::silos_get_silo + ///[`Client::silo_view`]: super::Client::silo_view #[derive(Clone)] - pub struct SilosGetSilo<'a> { + pub struct SiloView<'a> { client: &'a super::Client, silo_name: Option, } - impl<'a> SilosGetSilo<'a> { + impl<'a> SiloView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12372,16 +14251,16 @@ pub mod builder { } } - ///Builder for [`Client::silos_delete_silo`] + ///Builder for [`Client::silo_delete`] /// - ///[`Client::silos_delete_silo`]: super::Client::silos_delete_silo + ///[`Client::silo_delete`]: super::Client::silo_delete #[derive(Clone)] - pub struct SilosDeleteSilo<'a> { + pub struct SiloDelete<'a> { client: &'a super::Client, silo_name: Option, } - impl<'a> SilosDeleteSilo<'a> { + impl<'a> SiloDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12431,16 +14310,162 @@ pub mod builder { } } - ///Builder for [`Client::silos_get_silo_policy`] + ///Builder for [`Client::silo_identity_provider_list`] /// - ///[`Client::silos_get_silo_policy`]: super::Client::silos_get_silo_policy + ///[`Client::silo_identity_provider_list`]: super::Client::silo_identity_provider_list #[derive(Clone)] - pub struct SilosGetSiloPolicy<'a> { + pub struct SiloIdentityProviderList<'a> { + client: &'a super::Client, + silo_name: Option, + limit: Option, + page_token: Option, + sort_by: Option, + } + + impl<'a> SiloIdentityProviderList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + limit: None, + page_token: None, + sort_by: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + pub fn sort_by(mut self, value: types::NameSortMode) -> Self { + self.sort_by = Some(value); + self + } + + ///Sends a `GET` request to `/silos/{silo_name}/identity_providers` + pub async fn send( + self, + ) -> Result, Error> + { + let Self { + client, + silo_name, + limit, + page_token, + sort_by, + } = self; + let (silo_name,) = match (silo_name,) { + (Some(silo_name),) => (silo_name,), + (silo_name,) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/silos/{}/identity_providers", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/silos/{silo_name}/identity_providers` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + sort_by: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`Client::silo_policy_view`] + /// + ///[`Client::silo_policy_view`]: super::Client::silo_policy_view + #[derive(Clone)] + pub struct SiloPolicyView<'a> { client: &'a super::Client, silo_name: Option, } - impl<'a> SilosGetSiloPolicy<'a> { + impl<'a> SiloPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12456,7 +14481,7 @@ pub mod builder { ///Sends a `GET` request to `/silos/{silo_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, silo_name } = self; let (silo_name,) = match (silo_name,) { (Some(silo_name),) => (silo_name,), @@ -12492,17 +14517,17 @@ pub mod builder { } } - ///Builder for [`Client::silos_put_silo_policy`] + ///Builder for [`Client::silo_policy_update`] /// - ///[`Client::silos_put_silo_policy`]: super::Client::silos_put_silo_policy + ///[`Client::silo_policy_update`]: super::Client::silo_policy_update #[derive(Clone)] - pub struct SilosPutSiloPolicy<'a> { + pub struct SiloPolicyUpdate<'a> { client: &'a super::Client, silo_name: Option, - body: Option, + body: Option, } - impl<'a> SilosPutSiloPolicy<'a> { + impl<'a> SiloPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12516,7 +14541,7 @@ pub mod builder { self } - pub fn body(mut self, value: types::SiloRolesPolicy) -> Self { + pub fn body(mut self, value: types::SiloRolePolicy) -> Self { self.body = Some(value); self } @@ -12524,7 +14549,7 @@ pub mod builder { ///Sends a `PUT` request to `/silos/{silo_name}/policy` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, silo_name, @@ -12567,6 +14592,338 @@ pub mod builder { } } + ///Builder for [`Client::silo_identity_provider_create`] + /// + ///[`Client::silo_identity_provider_create`]: super::Client::silo_identity_provider_create + #[derive(Clone)] + pub struct SiloIdentityProviderCreate<'a> { + client: &'a super::Client, + silo_name: Option, + body: Option, + } + + impl<'a> SiloIdentityProviderCreate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + body: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn body(mut self, value: types::SamlIdentityProviderCreate) -> Self { + self.body = Some(value); + self + } + + ///Sends a `POST` request to + /// `/silos/{silo_name}/saml_identity_providers` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + silo_name, + body, + } = self; + let (silo_name, body) = match (silo_name, body) { + (Some(silo_name), Some(body)) => (silo_name, body), + (silo_name, body) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if body.is_none() { + missing.push(stringify!(body)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/silos/{}/saml_identity_providers", + client.baseurl, + encode_path(&silo_name.to_string()), + ); + let request = client.client.post(url).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)), + } + } + } + + ///Builder for [`Client::silo_identity_provider_view`] + /// + ///[`Client::silo_identity_provider_view`]: super::Client::silo_identity_provider_view + #[derive(Clone)] + pub struct SiloIdentityProviderView<'a> { + client: &'a super::Client, + silo_name: Option, + provider_name: Option, + } + + impl<'a> SiloIdentityProviderView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + silo_name: None, + provider_name: None, + } + } + + pub fn silo_name(mut self, value: types::Name) -> Self { + self.silo_name = Some(value); + self + } + + pub fn provider_name(mut self, value: types::Name) -> Self { + self.provider_name = Some(value); + self + } + + ///Sends a `GET` request to + /// `/silos/{silo_name}/saml_identity_providers/{provider_name}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + silo_name, + provider_name, + } = self; + let (silo_name, provider_name) = match (silo_name, provider_name) { + (Some(silo_name), Some(provider_name)) => (silo_name, provider_name), + (silo_name, provider_name) => { + let mut missing = Vec::new(); + if silo_name.is_none() { + missing.push(stringify!(silo_name)); + } + if provider_name.is_none() { + missing.push(stringify!(provider_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/silos/{}/saml_identity_providers/{}", + client.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let request = client.client.get(url).build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 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 [`Client::system_user_list`] + /// + ///[`Client::system_user_list`]: super::Client::system_user_list + #[derive(Clone)] + pub struct SystemUserList<'a> { + client: &'a super::Client, + limit: Option, + page_token: Option, + sort_by: Option, + } + + impl<'a> SystemUserList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + limit: None, + page_token: None, + sort_by: None, + } + } + + pub fn limit(mut self, value: std::num::NonZeroU32) -> Self { + self.limit = Some(value); + self + } + + pub fn page_token(mut self, value: String) -> Self { + self.page_token = Some(value); + self + } + + pub fn sort_by(mut self, value: types::NameSortMode) -> Self { + self.sort_by = Some(value); + self + } + + ///Sends a `GET` request to `/system/user` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + limit, + page_token, + sort_by, + } = self; + let url = format!("{}/system/user", client.baseurl,); + let mut query = Vec::new(); + 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())); + } + let request = client.client.get(url).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)), + } + } + + ///Streams `GET` requests to `/system/user` + pub fn stream( + self, + ) -> impl futures::Stream>> + Unpin + 'a + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + limit: None, + page_token: None, + sort_by: None, + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: next_page, + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + ///Builder for [`Client::system_user_view`] + /// + ///[`Client::system_user_view`]: super::Client::system_user_view + #[derive(Clone)] + pub struct SystemUserView<'a> { + client: &'a super::Client, + user_name: Option, + } + + impl<'a> SystemUserView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client, + user_name: None, + } + } + + pub fn user_name(mut self, value: types::Name) -> Self { + self.user_name = Some(value); + self + } + + ///Sends a `GET` request to `/system/user/{user_name}` + pub async fn send(self) -> Result, Error> { + let Self { client, user_name } = self; + let (user_name,) = match (user_name,) { + (Some(user_name),) => (user_name,), + (user_name,) => { + let mut missing = Vec::new(); + if user_name.is_none() { + missing.push(stringify!(user_name)); + } + return Err(super::Error::InvalidRequest(format!( + "the following parameters are required: {}", + missing.join(", "), + ))); + } + }; + let url = format!( + "{}/system/user/{}", + client.baseurl, + encode_path(&user_name.to_string()), + ); + let request = client.client.get(url).build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 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 [`Client::timeseries_schema_get`] /// ///[`Client::timeseries_schema_get`]: super::Client::timeseries_schema_get @@ -12709,18 +15066,18 @@ pub mod builder { } } - ///Builder for [`Client::users_get`] + ///Builder for [`Client::user_list`] /// - ///[`Client::users_get`]: super::Client::users_get + ///[`Client::user_list`]: super::Client::user_list #[derive(Clone)] - pub struct UsersGet<'a> { + pub struct UserList<'a> { client: &'a super::Client, limit: Option, page_token: Option, - sort_by: Option, + sort_by: Option, } - impl<'a> UsersGet<'a> { + impl<'a> UserList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, @@ -12740,7 +15097,7 @@ pub mod builder { self } - pub fn sort_by(mut self, value: types::NameSortMode) -> Self { + pub fn sort_by(mut self, value: types::IdSortMode) -> Self { self.sort_by = Some(value); self } @@ -12828,63 +15185,4 @@ pub mod builder { .boxed() } } - - ///Builder for [`Client::users_get_user`] - /// - ///[`Client::users_get_user`]: super::Client::users_get_user - #[derive(Clone)] - pub struct UsersGetUser<'a> { - client: &'a super::Client, - user_name: Option, - } - - impl<'a> UsersGetUser<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { - client, - user_name: None, - } - } - - pub fn user_name(mut self, value: types::Name) -> Self { - self.user_name = Some(value); - self - } - - ///Sends a `GET` request to `/users/{user_name}` - pub async fn send(self) -> Result, Error> { - let Self { client, user_name } = self; - let (user_name,) = match (user_name,) { - (Some(user_name),) => (user_name,), - (user_name,) => { - let mut missing = Vec::new(); - if user_name.is_none() { - missing.push(stringify!(user_name)); - } - return Err(super::Error::InvalidRequest(format!( - "the following parameters are required: {}", - missing.join(", "), - ))); - } - }; - let url = format!( - "{}/users/{}", - client.baseurl, - encode_path(&user_name.to_string()), - ); - let request = client.client.get(url).build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } } diff --git a/progenitor-impl/tests/output/nexus-positional.out b/progenitor-impl/tests/output/nexus-positional.out index 984b11d..510b250 100644 --- a/progenitor-impl/tests/output/nexus-positional.out +++ b/progenitor-impl/tests/output/nexus-positional.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; @@ -78,6 +78,31 @@ pub mod types { } } + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DerEncodedKeyPair { + ///request signing private key (base64 encoded der file) + pub private_key: String, + ///request signing public certificate (base64 encoded der file) + pub public_cert: String, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DeviceAccessTokenRequest { + pub client_id: uuid::Uuid, + pub device_code: String, + pub grant_type: String, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DeviceAuthRequest { + pub client_id: uuid::Uuid, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct DeviceAuthVerify { + pub user_code: String, + } + #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Digest { #[serde(rename = "type")] @@ -99,7 +124,7 @@ pub mod types { } } - ///Client view of an [`Disk`] + ///Client view of a [`Disk`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Disk { pub block_size: ByteCount, @@ -197,6 +222,15 @@ pub mod types { Faulted, } + ///OS image distribution + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct Distribution { + ///The name of the distribution (e.g. "alpine" or "ubuntu") + pub name: Name, + ///The version of the distribution (e.g. "3.10" or "18.04") + pub version: String, + } + ///Error information from a response. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Error { @@ -260,7 +294,7 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum FleetRoles { + pub enum FleetRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -269,12 +303,12 @@ pub mod types { Viewer, } - impl ToString for FleetRoles { + impl ToString for FleetRole { fn to_string(&self) -> String { match *self { - FleetRoles::Admin => "admin".to_string(), - FleetRoles::Collaborator => "collaborator".to_string(), - FleetRoles::Viewer => "viewer".to_string(), + FleetRole::Admin => "admin".to_string(), + FleetRole::Collaborator => "collaborator".to_string(), + FleetRole::Viewer => "viewer".to_string(), } } } @@ -286,9 +320,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct FleetRolesPolicy { + pub struct FleetRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -298,10 +332,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct FleetRolesRoleAssignment { + pub struct FleetRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: FleetRoles, + pub role_name: FleetRole, } ///Client view of global Images @@ -314,6 +348,8 @@ pub mod types { ///Hash of the image contents, if applicable #[serde(default, skip_serializing_if = "Option::is_none")] pub digest: Option, + ///Image distribution + pub distribution: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource @@ -327,9 +363,22 @@ pub mod types { ///URL source of this image, if any #[serde(default, skip_serializing_if = "Option::is_none")] pub url: Option, - ///Version of this, if any - #[serde(default, skip_serializing_if = "Option::is_none")] - pub version: Option, + ///Image version + pub version: String, + } + + ///Create-time parameters for an + /// [`GlobalImage`](omicron_common::api::external::GlobalImage) + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct GlobalImageCreate { + ///block size in bytes + pub block_size: BlockSize, + pub description: String, + ///OS image distribution + pub distribution: Distribution, + pub name: Name, + ///The source of the image's contents. + pub source: ImageSource, } ///A single page of results @@ -359,6 +408,47 @@ pub mod types { } } + ///Client view of an [`IdentityProvider`] + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IdentityProvider { + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///Identity provider type + pub provider_type: IdentityProviderType, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IdentityProviderResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] + pub enum IdentityProviderType { + #[serde(rename = "saml")] + Saml, + } + + impl ToString for IdentityProviderType { + fn to_string(&self) -> String { + match *self { + IdentityProviderType::Saml => "saml".to_string(), + } + } + } + ///Describes what kind of identity is described by an id #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] pub enum IdentityType { @@ -374,6 +464,15 @@ pub mod types { } } + #[derive(Serialize, Deserialize, Debug, Clone)] + #[serde(tag = "type")] + pub enum IdpMetadataSource { + #[serde(rename = "url")] + Url { url: String }, + #[serde(rename = "base64_encoded_xml")] + Base64EncodedXml { data: String }, + } + ///Client view of project Images #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Image { @@ -428,12 +527,14 @@ pub mod types { ///The source of the underlying image. #[derive(Serialize, Deserialize, Debug, Clone)] - #[serde(tag = "type", content = "src")] + #[serde(tag = "type")] pub enum ImageSource { #[serde(rename = "url")] - Url(String), + Url { url: String }, #[serde(rename = "snapshot")] - Snapshot(uuid::Uuid), + Snapshot { id: uuid::Uuid }, + #[serde(rename = "you_can_boot_anything_as_long_as_its_alpine")] + YouCanBootAnythingAsLongAsItsAlpine, } ///Client view of an [`Instance`] @@ -523,7 +624,7 @@ pub mod types { /// [`Instance`](omicron_common::api::external::Instance) #[derive(Serialize, Deserialize, Debug, Clone)] pub struct InstanceMigrate { - pub dst_sled_uuid: uuid::Uuid, + pub dst_sled_id: uuid::Uuid, } ///Describes an attachment of a `NetworkInterface` to an `Instance`, at the @@ -531,7 +632,10 @@ pub mod types { #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(tag = "type", content = "params")] pub enum InstanceNetworkInterfaceAttachment { - ///Create one or more `NetworkInterface`s for the `Instance` + ///Create one or more `NetworkInterface`s for the `Instance`. + /// + ///If more than one interface is provided, then the first will be + /// designated the primary interface for the instance. #[serde(rename = "create")] Create(Vec), #[serde(rename = "default")] @@ -550,6 +654,18 @@ pub mod types { pub next_page: Option, } + ///Contents of an Instance's serial console buffer. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct InstanceSerialConsoleData { + ///The bytes starting from the requested offset up to either the end of + /// the buffer or the request's `max_bytes`. Provided as a u8 array + /// rather than a string, as it may not be UTF-8. + pub data: Vec, + ///The absolute offset since boot (suitable for use as `byte_offset` in + /// a subsequent request) of the last byte returned in `data`. + pub last_byte_offset: u64, + } + ///Running state of an Instance (primarily: booted or stopped) /// ///This typically reflects whether it's starting, running, stopping, or @@ -602,6 +718,74 @@ pub mod types { V6(Ipv6Net), } + ///Identity-related metadata that's included in nearly all public API + /// objects + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPool { + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///Create-time parameters for an IP Pool. + /// + ///See [`IpPool`](omicron_nexus::external_api::views::IpPool) + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolCreate { + pub description: String, + pub name: Name, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolRange { + pub id: uuid::Uuid, + pub range: IpRange, + pub time_created: chrono::DateTime, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolRangeResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///Parameters for updating an IP Pool + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct IpPoolUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone)] + #[serde(untagged)] + pub enum IpRange { + V4(Ipv4Range), + V6(Ipv6Range), + } + ///An IPv4 subnet, including prefix and subnet mask #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Ipv4Net(pub String); @@ -612,6 +796,15 @@ pub mod types { } } + ///A non-decreasing IPv4 address range, inclusive of both ends. + /// + ///The first address must be less than or equal to the last address. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct Ipv4Range { + pub first: std::net::Ipv4Addr, + pub last: std::net::Ipv4Addr, + } + ///An IPv6 subnet, including prefix and subnet mask #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Ipv6Net(pub String); @@ -622,6 +815,15 @@ pub mod types { } } + ///A non-decreasing IPv6 address range, inclusive of both ends. + /// + ///The first address must be less than or equal to the last address. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct Ipv6Range { + pub first: std::net::Ipv6Addr, + pub last: std::net::Ipv6Addr, + } + ///An inclusive-inclusive range of IP ports. The second port may be omitted /// to represent a single port #[derive(Serialize, Deserialize, Debug, Clone)] @@ -633,11 +835,6 @@ pub mod types { } } - #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct LoginParams { - pub username: String, - } - ///A Media Access Control address, in EUI-48 format #[derive(Serialize, Deserialize, Debug, Clone)] pub struct MacAddr(pub String); @@ -713,6 +910,9 @@ pub mod types { pub mac: MacAddr, ///unique, mutable, user-controlled identifier for each resource pub name: Name, + ///True if this interface is the primary for the instance to which it's + /// attached. + pub primary: bool, ///The subnet to which the interface belongs. pub subnet_id: uuid::Uuid, ///timestamp when this resource was created @@ -749,6 +949,41 @@ pub mod types { pub next_page: Option, } + ///Parameters for updating a + /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface). + /// + ///Note that modifying IP addresses for an interface is not yet supported, + /// a new interface must be created instead. + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct NetworkInterfaceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + ///Make a secondary interface the instance's primary interface. + /// + ///If applied to a secondary interface, that interface will become the + /// primary on the next reboot of the instance. Note that this may have + /// implications for routing between instances, as the new primary + /// interface will be on a distinct subnet from the previous primary + /// interface. + /// + ///Note that this can only be used to select a new primary interface + /// for an instance. Requests to change the primary interface into a + /// secondary will return an error. + #[serde(default)] + pub make_primary: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] + pub enum Null {} + + impl ToString for Null { + fn to_string(&self) -> String { + match *self {} + } + } + ///Client view of an [`Organization`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Organization { @@ -783,18 +1018,21 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum OrganizationRoles { + pub enum OrganizationRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, + #[serde(rename = "viewer")] + Viewer, } - impl ToString for OrganizationRoles { + impl ToString for OrganizationRole { fn to_string(&self) -> String { match *self { - OrganizationRoles::Admin => "admin".to_string(), - OrganizationRoles::Collaborator => "collaborator".to_string(), + OrganizationRole::Admin => "admin".to_string(), + OrganizationRole::Collaborator => "collaborator".to_string(), + OrganizationRole::Viewer => "viewer".to_string(), } } } @@ -806,9 +1044,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct OrganizationRolesPolicy { + pub struct OrganizationRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -818,10 +1056,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct OrganizationRolesRoleAssignment { + pub struct OrganizationRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: OrganizationRoles, + pub role_name: OrganizationRole, } ///Updateable properties of an @@ -869,7 +1107,7 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum ProjectRoles { + pub enum ProjectRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -878,12 +1116,12 @@ pub mod types { Viewer, } - impl ToString for ProjectRoles { + impl ToString for ProjectRole { fn to_string(&self) -> String { match *self { - ProjectRoles::Admin => "admin".to_string(), - ProjectRoles::Collaborator => "collaborator".to_string(), - ProjectRoles::Viewer => "viewer".to_string(), + ProjectRole::Admin => "admin".to_string(), + ProjectRole::Collaborator => "collaborator".to_string(), + ProjectRole::Viewer => "viewer".to_string(), } } } @@ -895,9 +1133,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct ProjectRolesPolicy { + pub struct ProjectRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -907,10 +1145,10 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct ProjectRolesRoleAssignment { + pub struct ProjectRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: ProjectRoles, + pub role_name: ProjectRole, } ///Updateable properties of a @@ -926,12 +1164,8 @@ pub mod types { ///Client view of an [`Rack`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Rack { - ///human-readable free-form text about a resource - pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, - ///unique, mutable, user-controlled identifier for each resource - pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified @@ -1145,6 +1379,58 @@ pub mod types { }, } + ///Identity-related metadata that's included in nearly all public API + /// objects + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct SamlIdentityProvider { + ///service provider endpoint where the response will be sent + pub acs_url: String, + ///human-readable free-form text about a resource + pub description: String, + ///unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + ///idp's entity id + pub idp_entity_id: String, + ///unique, mutable, user-controlled identifier for each resource + pub name: Name, + ///optional request signing public certificate (base64 encoded der + /// file) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public_cert: Option, + ///service provider endpoint where the idp should send log out requests + pub slo_url: String, + ///sp's client id + pub sp_client_id: String, + ///customer's technical contact for saml configuration + pub technical_contact_email: String, + ///timestamp when this resource was created + pub time_created: chrono::DateTime, + ///timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + ///Create-time identity-related parameters + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct SamlIdentityProviderCreate { + ///service provider endpoint where the response will be sent + pub acs_url: String, + pub description: String, + ///idp's entity id + pub idp_entity_id: String, + ///the source of an identity provider metadata descriptor + pub idp_metadata_source: IdpMetadataSource, + pub name: Name, + ///optional request signing key pair + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signing_keypair: Option, + ///service provider endpoint where the idp should send log out requests + pub slo_url: String, + ///sp's client id + pub sp_client_id: String, + ///customer's technical contact for saml configuration + pub technical_contact_email: String, + } + ///Client view of currently authed user. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct SessionUser { @@ -1167,6 +1453,8 @@ pub mod types { pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, + ///User provision type + pub user_provision_type: UserProvisionType, } ///Create-time parameters for a [`Silo`](crate::external_api::views::Silo) @@ -1175,6 +1463,7 @@ pub mod types { pub description: String, pub discoverable: bool, pub name: Name, + pub user_provision_type: UserProvisionType, } ///A single page of results @@ -1188,7 +1477,7 @@ pub mod types { } #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] - pub enum SiloRoles { + pub enum SiloRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] @@ -1197,12 +1486,12 @@ pub mod types { Viewer, } - impl ToString for SiloRoles { + impl ToString for SiloRole { fn to_string(&self) -> String { match *self { - SiloRoles::Admin => "admin".to_string(), - SiloRoles::Collaborator => "collaborator".to_string(), - SiloRoles::Viewer => "viewer".to_string(), + SiloRole::Admin => "admin".to_string(), + SiloRole::Collaborator => "collaborator".to_string(), + SiloRole::Viewer => "viewer".to_string(), } } } @@ -1214,9 +1503,9 @@ pub mod types { /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct SiloRolesPolicy { + pub struct SiloRolePolicy { ///Roles directly assigned on this resource - pub role_assignments: Vec, + pub role_assignments: Vec, } ///Describes the assignment of a particular role on a particular resource @@ -1226,21 +1515,17 @@ pub mod types { /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Serialize, Deserialize, Debug, Clone)] - pub struct SiloRolesRoleAssignment { + pub struct SiloRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, - pub role_name: SiloRoles, + pub role_name: SiloRole, } ///Client view of an [`Sled`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Sled { - ///human-readable free-form text about a resource - pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, - ///unique, mutable, user-controlled identifier for each resource - pub name: Name, pub service_address: String, ///timestamp when this resource was created pub time_created: chrono::DateTime, @@ -1296,6 +1581,11 @@ pub mod types { pub next_page: Option, } + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct SpoofLoginBody { + pub username: String, + } + ///Client view of a [`SshKey`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct SshKey { @@ -1372,6 +1662,14 @@ pub mod types { ///Client view of a [`User`] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct User { + ///Human-readable name that can identify the user + pub display_name: String, + pub id: uuid::Uuid, + } + + ///Client view of a [`UserBuiltin`] + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct UserBuiltin { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource @@ -1384,6 +1682,34 @@ pub mod types { pub time_modified: chrono::DateTime, } + ///A single page of results + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct UserBuiltinResultsPage { + ///list of items on this page of results + pub items: Vec, + ///token used to fetch the next page of results (if any) + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_page: Option, + } + + ///How users will be provisioned in a silo during authentication. + #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] + pub enum UserProvisionType { + #[serde(rename = "fixed")] + Fixed, + #[serde(rename = "jit")] + Jit, + } + + impl ToString for UserProvisionType { + fn to_string(&self) -> String { + match *self { + UserProvisionType::Fixed => "fixed".to_string(), + UserProvisionType::Jit => "jit".to_string(), + } + } + } + ///A single page of results #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UserResultsPage { @@ -1814,16 +2140,85 @@ impl Client { } impl Client { + ///Start an OAuth 2.0 Device Authorization Grant + /// + ///This endpoint is designed to be accessed from an *unauthenticated* API + /// client. It generates and records a `device_code` and `user_code` which + /// must be verified and confirmed prior to a token being granted. + /// + ///Sends a `POST` request to `/device/auth` + pub async fn device_auth_request<'a>( + &'a self, + body: &'a types::DeviceAuthRequest, + ) -> Result, Error> { + let url = format!("{}/device/auth", self.baseurl,); + let request = self.client.post(url).form_urlencoded(&body)?.build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + + ///Confirm an OAuth 2.0 Device Authorization Grant + /// + ///This endpoint is designed to be accessed by the user agent (browser), + /// not the client requesting the token. So we do not actually return the + /// token here; it will be returned in response to the poll on + /// `/device/token`. + /// + ///Sends a `POST` request to `/device/confirm` + pub async fn device_auth_confirm<'a>( + &'a self, + body: &'a types::DeviceAuthVerify, + ) -> Result>, Error> { + let url = format!("{}/device/confirm", self.baseurl,); + let request = self.client.post(url).json(&body).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///Request a device access token + /// + ///This endpoint should be polled by the client until the user code is + /// verified and the grant is confirmed. + /// + ///Sends a `POST` request to `/device/token` + pub async fn device_access_token<'a>( + &'a self, + body: &'a types::DeviceAccessTokenRequest, + ) -> Result, Error> { + let url = format!("{}/device/token", self.baseurl,); + let request = self.client.post(url).form_urlencoded(&body)?.build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + ///List racks in the system /// ///Sends a `GET` request to `/hardware/racks` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn hardware_racks_get<'a>( + pub async fn rack_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -1866,7 +2261,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn hardware_racks_get_stream<'a>( + pub fn rack_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -1874,7 +2269,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.hardware_racks_get(limit, None, sort_by) + self.rack_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -1882,7 +2277,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.hardware_racks_get(None, state.as_deref(), None) + self.rack_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -1906,7 +2301,7 @@ impl Client { /// ///Arguments: /// - `rack_id`: The rack's unique ID. - pub async fn hardware_racks_get_rack<'a>( + pub async fn rack_view<'a>( &'a self, rack_id: &'a uuid::Uuid, ) -> Result, Error> { @@ -1936,10 +2331,10 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn hardware_sleds_get<'a>( + pub async fn sled_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -1982,7 +2377,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn hardware_sleds_get_stream<'a>( + pub fn sled_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -1990,7 +2385,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.hardware_sleds_get(limit, None, sort_by) + self.sled_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -1998,7 +2393,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.hardware_sleds_get(None, state.as_deref(), None) + self.sled_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -2022,7 +2417,7 @@ impl Client { /// ///Arguments: /// - `sled_id`: The sled's unique ID. - pub async fn hardware_sleds_get_sled<'a>( + pub async fn sled_view<'a>( &'a self, sled_id: &'a uuid::Uuid, ) -> Result, Error> { @@ -2055,10 +2450,10 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn images_get<'a>( + pub async fn image_global_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -2104,7 +2499,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn images_get_stream<'a>( + pub fn image_global_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -2113,7 +2508,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.images_get(limit, None, sort_by) + self.image_global_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -2121,7 +2516,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.images_get(None, state.as_deref(), None) + self.image_global_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -2145,9 +2540,9 @@ impl Client { /// base for instances. /// ///Sends a `POST` request to `/images` - pub async fn images_post<'a>( + pub async fn image_global_create<'a>( &'a self, - body: &'a types::ImageCreate, + body: &'a types::GlobalImageCreate, ) -> Result, Error> { let url = format!("{}/images", self.baseurl,); let request = self.client.post(url).json(&body).build()?; @@ -2170,7 +2565,7 @@ impl Client { ///Returns the details of a specific global image. /// ///Sends a `GET` request to `/images/{image_name}` - pub async fn images_get_image<'a>( + pub async fn image_global_view<'a>( &'a self, image_name: &'a types::Name, ) -> Result, Error> { @@ -2201,7 +2596,7 @@ impl Client { /// instances can not be created with this image. /// ///Sends a `DELETE` request to `/images/{image_name}` - pub async fn images_delete_image<'a>( + pub async fn image_global_delete<'a>( &'a self, image_name: &'a types::Name, ) -> Result, Error> { @@ -2225,10 +2620,348 @@ impl Client { } } + ///List IP Pools + /// + ///Sends a `GET` request to `/ip-pools` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + pub async fn ip_pool_list<'a>( + &'a self, + limit: Option, + page_token: Option<&'a str>, + sort_by: Option, + ) -> Result, Error> { + let url = format!("{}/ip-pools", self.baseurl,); + let mut query = Vec::new(); + 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())); + } + + let request = self.client.get(url).query(&query).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///List IP Pools as a Stream + /// + ///Sends repeated `GET` requests to `/ip-pools` until there are no more + /// results. + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `sort_by` + pub fn ip_pool_list_stream<'a>( + &'a self, + limit: Option, + sort_by: Option, + ) -> impl futures::Stream>> + Unpin + '_ { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + self.ip_pool_list(limit, None, sort_by) + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold(page.next_page, move |state| async move { + if state.is_none() { + Ok(None) + } else { + self.ip_pool_list(None, state.as_deref(), None) + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + page.next_page, + )) + }) + .await + } + }) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + + ///Create a new IP Pool + /// + ///Sends a `POST` request to `/ip-pools` + pub async fn ip_pool_create<'a>( + &'a self, + body: &'a types::IpPoolCreate, + ) -> Result, Error> { + let url = format!("{}/ip-pools", self.baseurl,); + let request = self.client.post(url).json(&body).build()?; + let result = self.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)), + } + } + + ///Fetch a single IP Pool + /// + ///Sends a `GET` request to `/ip-pools/{pool_name}` + pub async fn ip_pool_view<'a>( + &'a self, + pool_name: &'a types::Name, + ) -> Result, Error> { + let url = format!( + "{}/ip-pools/{}", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = self.client.get(url).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///Update an IP Pool + /// + ///Sends a `PUT` request to `/ip-pools/{pool_name}` + pub async fn ip_pool_update<'a>( + &'a self, + pool_name: &'a types::Name, + body: &'a types::IpPoolUpdate, + ) -> Result, Error> { + let url = format!( + "{}/ip-pools/{}", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = self.client.put(url).json(&body).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///Delete an IP Pool + /// + ///Sends a `DELETE` request to `/ip-pools/{pool_name}` + pub async fn ip_pool_delete<'a>( + &'a self, + pool_name: &'a types::Name, + ) -> Result, Error> { + let url = format!( + "{}/ip-pools/{}", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = self.client.delete(url).build()?; + let result = self.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)), + } + } + + ///List the ranges of IP addresses within an existing IP Pool + /// + ///Note that ranges are listed sorted by their first address. + /// + ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` + /// + ///Arguments: + /// - `pool_name` + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + pub async fn ip_pool_range_list<'a>( + &'a self, + pool_name: &'a types::Name, + limit: Option, + page_token: Option<&'a str>, + ) -> Result, Error> { + let url = format!( + "{}/ip-pools/{}/ranges", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let mut query = Vec::new(); + if let Some(v) = &limit { + query.push(("limit", v.to_string())); + } + + if let Some(v) = &page_token { + query.push(("page_token", v.to_string())); + } + + let request = self.client.get(url).query(&query).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///List the ranges of IP addresses within an existing IP Pool as a Stream + /// + ///Note that ranges are listed sorted by their first address. + /// + ///Sends repeated `GET` requests to `/ip-pools/{pool_name}/ranges` until + /// there are no more results. + /// + ///Arguments: + /// - `pool_name` + /// - `limit`: Maximum number of items returned by a single call + pub fn ip_pool_range_list_stream<'a>( + &'a self, + pool_name: &'a types::Name, + limit: Option, + ) -> impl futures::Stream>> + Unpin + '_ + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + self.ip_pool_range_list(pool_name, limit, None) + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold(page.next_page, move |state| async move { + if state.is_none() { + Ok(None) + } else { + self.ip_pool_range_list(pool_name, None, state.as_deref()) + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + page.next_page, + )) + }) + .await + } + }) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + + ///Add a new range to an existing IP Pool + /// + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/add` + pub async fn ip_pool_range_add<'a>( + &'a self, + pool_name: &'a types::Name, + body: &'a types::IpRange, + ) -> Result, Error> { + let url = format!( + "{}/ip-pools/{}/ranges/add", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = self.client.post(url).json(&body).build()?; + let result = self.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)), + } + } + + ///Remove a range from an existing IP Pool + /// + ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/remove` + pub async fn ip_pool_range_remove<'a>( + &'a self, + pool_name: &'a types::Name, + body: &'a types::IpRange, + ) -> Result, Error> { + let url = format!( + "{}/ip-pools/{}/ranges/remove", + self.baseurl, + encode_path(&pool_name.to_string()), + ); + let request = self.client.post(url).json(&body).build()?; + let result = self.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)), + } + } + ///Sends a `POST` request to `/login` pub async fn spoof_login<'a>( &'a self, - body: &'a types::LoginParams, + body: &'a types::SpoofLoginBody, ) -> Result, Error> { let url = format!("{}/login", self.baseurl,); let request = self.client.post(url).json(&body).build()?; @@ -2240,6 +2973,68 @@ impl Client { } } + ///Ask the user to login to their identity provider + /// + ///Either display a page asking a user for their credentials, or redirect + /// them to their identity provider. + /// + ///Sends a `GET` request to `/login/{silo_name}/{provider_name}` + pub async fn login<'a>( + &'a self, + silo_name: &'a types::Name, + provider_name: &'a types::Name, + ) -> Result, Error> { + let url = format!( + "{}/login/{}/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let request = self.client.get(url).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + + ///Consume some sort of credentials, and authenticate a user + /// + ///Either receive a username and password, or some sort of identity + /// provider data (like a SAMLResponse). Use these to set the user's session + /// cookie. + /// + ///Sends a `POST` request to `/login/{silo_name}/{provider_name}` + pub async fn consume_credentials<'a, B: Into>( + &'a self, + silo_name: &'a types::Name, + provider_name: &'a types::Name, + body: B, + ) -> Result, Error> { + let url = format!( + "{}/login/{}/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let request = 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() { + 200..=299 => Ok(ResponseValue::stream(response)), + _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), + } + } + ///Sends a `POST` request to `/logout` pub async fn logout<'a>(&'a self) -> Result, Error> { let url = format!("{}/logout", self.baseurl,); @@ -2258,10 +3053,10 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn organizations_get<'a>( + pub async fn organization_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -2304,7 +3099,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn organizations_get_stream<'a>( + pub fn organization_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -2313,7 +3108,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.organizations_get(limit, None, sort_by) + self.organization_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -2321,7 +3116,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.organizations_get(None, state.as_deref(), None) + self.organization_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -2342,7 +3137,7 @@ impl Client { ///Create a new organization /// ///Sends a `POST` request to `/organizations` - pub async fn organizations_post<'a>( + pub async fn organization_create<'a>( &'a self, body: &'a types::OrganizationCreate, ) -> Result, Error> { @@ -2368,7 +3163,7 @@ impl Client { /// ///Arguments: /// - `organization_name`: The organization's unique name. - pub async fn organizations_get_organization<'a>( + pub async fn organization_view<'a>( &'a self, organization_name: &'a types::Name, ) -> Result, Error> { @@ -2399,7 +3194,7 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `body` - pub async fn organizations_put_organization<'a>( + pub async fn organization_update<'a>( &'a self, organization_name: &'a types::Name, body: &'a types::OrganizationUpdate, @@ -2430,7 +3225,7 @@ impl Client { /// ///Arguments: /// - `organization_name`: The organization's unique name. - pub async fn organizations_delete_organization<'a>( + pub async fn organization_delete<'a>( &'a self, organization_name: &'a types::Name, ) -> Result, Error> { @@ -2460,10 +3255,10 @@ impl Client { /// ///Arguments: /// - `organization_name`: The organization's unique name. - pub async fn organization_get_policy<'a>( + pub async fn organization_policy_view<'a>( &'a self, organization_name: &'a types::Name, - ) -> Result, Error> { + ) -> Result, Error> { let url = format!( "{}/organizations/{}/policy", self.baseurl, @@ -2491,11 +3286,11 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `body` - pub async fn organization_put_policy<'a>( + pub async fn organization_policy_update<'a>( &'a self, organization_name: &'a types::Name, - body: &'a types::OrganizationRolesPolicy, - ) -> Result, Error> { + body: &'a types::OrganizationRolePolicy, + ) -> Result, Error> { let url = format!( "{}/organizations/{}/policy", self.baseurl, @@ -2523,10 +3318,10 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn organization_projects_get<'a>( + pub async fn project_list<'a>( &'a self, organization_name: &'a types::Name, limit: Option, @@ -2576,7 +3371,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn organization_projects_get_stream<'a>( + pub fn project_list_stream<'a>( &'a self, organization_name: &'a types::Name, limit: Option, @@ -2585,7 +3380,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.organization_projects_get(organization_name, limit, None, sort_by) + self.project_list(organization_name, limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -2593,20 +3388,15 @@ impl Client { if state.is_none() { Ok(None) } else { - self.organization_projects_get( - organization_name, - None, - state.as_deref(), - None, - ) - .map_ok(|page| { - let page = page.into_inner(); - Some(( - futures::stream::iter(page.items.into_iter().map(Ok)), - page.next_page, - )) - }) - .await + self.project_list(organization_name, None, state.as_deref(), None) + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + page.next_page, + )) + }) + .await } }) .try_flatten(); @@ -2623,7 +3413,7 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `body` - pub async fn organization_projects_post<'a>( + pub async fn project_create<'a>( &'a self, organization_name: &'a types::Name, body: &'a types::ProjectCreate, @@ -2656,7 +3446,7 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. - pub async fn organization_projects_get_project<'a>( + pub async fn project_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2691,7 +3481,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn organization_projects_put_project<'a>( + pub async fn project_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2726,7 +3516,7 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. - pub async fn organization_projects_delete_project<'a>( + pub async fn project_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2761,10 +3551,10 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn project_disks_get<'a>( + pub async fn disk_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2817,7 +3607,7 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn project_disks_get_stream<'a>( + pub fn disk_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2827,7 +3617,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.project_disks_get(organization_name, project_name, limit, None, sort_by) + self.disk_list(organization_name, project_name, limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -2835,7 +3625,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.project_disks_get( + self.disk_list( organization_name, project_name, None, @@ -2868,7 +3658,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn project_disks_post<'a>( + pub async fn disk_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2900,7 +3690,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` - pub async fn project_disks_get_disk<'a>( + pub async fn disk_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2933,7 +3723,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` - pub async fn project_disks_delete_disk<'a>( + pub async fn disk_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -2973,10 +3763,10 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn project_images_get<'a>( + pub async fn image_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3032,7 +3822,7 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn project_images_get_stream<'a>( + pub fn image_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3042,7 +3832,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.project_images_get(organization_name, project_name, limit, None, sort_by) + self.image_list(organization_name, project_name, limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -3050,7 +3840,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.project_images_get( + self.image_list( organization_name, project_name, None, @@ -3085,7 +3875,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn project_images_post<'a>( + pub async fn image_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3119,7 +3909,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` - pub async fn project_images_get_image<'a>( + pub async fn image_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3156,7 +3946,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` - pub async fn project_images_delete_image<'a>( + pub async fn image_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3193,10 +3983,10 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn project_instances_get<'a>( + pub async fn instance_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3249,7 +4039,7 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn project_instances_get_stream<'a>( + pub fn instance_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3260,7 +4050,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.project_instances_get(organization_name, project_name, limit, None, sort_by) + self.instance_list(organization_name, project_name, limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -3268,7 +4058,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.project_instances_get( + self.instance_list( organization_name, project_name, None, @@ -3301,7 +4091,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn project_instances_post<'a>( + pub async fn instance_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3333,7 +4123,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` - pub async fn project_instances_get_instance<'a>( + pub async fn instance_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3366,7 +4156,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` - pub async fn project_instances_delete_instance<'a>( + pub async fn instance_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3405,10 +4195,10 @@ impl Client { /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn instance_disks_get<'a>( + pub async fn instance_disk_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3464,7 +4254,7 @@ impl Client { /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn instance_disks_get_stream<'a>( + pub fn instance_disk_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3475,7 +4265,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.instance_disks_get( + self.instance_disk_list( organization_name, project_name, instance_name, @@ -3490,7 +4280,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.instance_disks_get( + self.instance_disk_list( organization_name, project_name, instance_name, @@ -3518,7 +4308,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/attach` - pub async fn instance_disks_attach<'a>( + pub async fn instance_disk_attach<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3550,7 +4340,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/detach` - pub async fn instance_disks_detach<'a>( + pub async fn instance_disk_detach<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3585,7 +4375,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/migrate` - pub async fn project_instances_migrate_instance<'a>( + pub async fn instance_migrate<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3625,10 +4415,10 @@ impl Client { /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn instance_network_interfaces_get<'a>( + pub async fn instance_network_interface_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3684,7 +4474,7 @@ impl Client { /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn instance_network_interfaces_get_stream<'a>( + pub fn instance_network_interface_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3696,7 +4486,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.instance_network_interfaces_get( + self.instance_network_interface_list( organization_name, project_name, instance_name, @@ -3711,7 +4501,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.instance_network_interfaces_get( + self.instance_network_interface_list( organization_name, project_name, instance_name, @@ -3741,7 +4531,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces` - pub async fn instance_network_interfaces_post<'a>( + pub async fn instance_network_interface_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3775,7 +4565,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` - pub async fn instance_network_interfaces_get_interface<'a>( + pub async fn instance_network_interface_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3805,12 +4595,53 @@ impl Client { } } + ///Update information about an instance's network interface + /// + ///Sends a `PUT` request to + /// `/organizations/{organization_name}/projects/{project_name}/instances/ + /// {instance_name}/network-interfaces/{interface_name}` + pub async fn instance_network_interface_update<'a>( + &'a self, + organization_name: &'a types::Name, + project_name: &'a types::Name, + instance_name: &'a types::Name, + 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()), + ); + let request = self.client.put(url).json(&body).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + ///Detach a network interface from an instance /// + ///Note that the primary interface for an instance cannot be deleted if + /// there are any secondary interfaces. A new primary interface must be + /// designated first. The primary interface can be deleted if there are no + /// secondary interfaces. + /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` - pub async fn instance_network_interfaces_delete_interface<'a>( + pub async fn instance_network_interface_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3845,7 +4676,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/reboot` - pub async fn project_instances_instance_reboot<'a>( + pub async fn instance_reboot<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3873,12 +4704,77 @@ impl Client { } } + ///Get contents of an instance's serial console + /// + ///Sends a `GET` request to + /// `/organizations/{organization_name}/projects/{project_name}/instances/ + /// {instance_name}/serial-console` + /// + ///Arguments: + /// - `organization_name` + /// - `project_name` + /// - `instance_name` + /// - `from_start`: Character index in the serial buffer from which to read, + /// counting the bytes output since instance start. If this is not + /// provided, `most_recent` must be provided, and if this *is* provided, + /// `most_recent` must *not* be provided. + /// - `max_bytes`: Maximum number of bytes of buffered serial console + /// contents to return. If the requested range runs to the end of the + /// available buffer, the data returned will be shorter than `max_bytes`. + /// - `most_recent`: Character index in the serial buffer from which to + /// read, counting *backward* from the most recently buffered data + /// retrieved from the instance. (See note on `from_start` about mutual + /// exclusivity) + pub async fn instance_serial_console<'a>( + &'a self, + organization_name: &'a types::Name, + project_name: &'a types::Name, + instance_name: &'a types::Name, + from_start: Option, + 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::new(); + 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())); + } + + let request = self.client.get(url).query(&query).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + ///Boot an instance /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/start` - pub async fn project_instances_instance_start<'a>( + pub async fn instance_start<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3911,7 +4807,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/stop` - pub async fn project_instances_instance_stop<'a>( + pub async fn instance_stop<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -3947,11 +4843,11 @@ impl Client { ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. - pub async fn organization_projects_get_project_policy<'a>( + pub async fn project_policy_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, - ) -> Result, Error> { + ) -> Result, Error> { let url = format!( "{}/organizations/{}/projects/{}/policy", self.baseurl, @@ -3982,12 +4878,12 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn organization_projects_put_project_policy<'a>( + pub async fn project_policy_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, - body: &'a types::ProjectRolesPolicy, - ) -> Result, Error> { + body: &'a types::ProjectRolePolicy, + ) -> Result, Error> { let url = format!( "{}/organizations/{}/projects/{}/policy", self.baseurl, @@ -4018,10 +4914,10 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn project_snapshots_get<'a>( + pub async fn snapshot_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4074,7 +4970,7 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn project_snapshots_get_stream<'a>( + pub fn snapshot_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4085,7 +4981,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.project_snapshots_get(organization_name, project_name, limit, None, sort_by) + self.snapshot_list(organization_name, project_name, limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -4093,7 +4989,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.project_snapshots_get( + self.snapshot_list( organization_name, project_name, None, @@ -4126,7 +5022,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn project_snapshots_post<'a>( + pub async fn snapshot_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4158,7 +5054,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` - pub async fn project_snapshots_get_snapshot<'a>( + pub async fn snapshot_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4191,7 +5087,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` - pub async fn project_snapshots_delete_snapshot<'a>( + pub async fn snapshot_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4228,10 +5124,10 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn project_vpcs_get<'a>( + pub async fn vpc_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4284,7 +5180,7 @@ impl Client { /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn project_vpcs_get_stream<'a>( + pub fn vpc_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4294,7 +5190,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.project_vpcs_get(organization_name, project_name, limit, None, sort_by) + self.vpc_list(organization_name, project_name, limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -4302,7 +5198,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.project_vpcs_get( + self.vpc_list( organization_name, project_name, None, @@ -4335,7 +5231,7 @@ impl Client { /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` - pub async fn project_vpcs_post<'a>( + pub async fn vpc_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4367,7 +5263,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` - pub async fn project_vpcs_get_vpc<'a>( + pub async fn vpc_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4400,7 +5296,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` - pub async fn project_vpcs_put_vpc<'a>( + pub async fn vpc_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4434,7 +5330,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` - pub async fn project_vpcs_delete_vpc<'a>( + pub async fn vpc_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4467,7 +5363,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` - pub async fn vpc_firewall_rules_get<'a>( + pub async fn vpc_firewall_rules_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4500,7 +5396,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` - pub async fn vpc_firewall_rules_put<'a>( + pub async fn vpc_firewall_rules_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4540,10 +5436,10 @@ impl Client { /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn vpc_routers_get<'a>( + pub async fn vpc_router_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4599,7 +5495,7 @@ impl Client { /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn vpc_routers_get_stream<'a>( + pub fn vpc_router_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4611,7 +5507,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.vpc_routers_get( + self.vpc_router_list( organization_name, project_name, vpc_name, @@ -4626,7 +5522,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.vpc_routers_get( + self.vpc_router_list( organization_name, project_name, vpc_name, @@ -4656,7 +5552,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` - pub async fn vpc_routers_post<'a>( + pub async fn vpc_router_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4690,7 +5586,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` - pub async fn vpc_routers_get_router<'a>( + pub async fn vpc_router_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4725,7 +5621,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` - pub async fn vpc_routers_put_router<'a>( + pub async fn vpc_router_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4761,7 +5657,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` - pub async fn vpc_routers_delete_router<'a>( + pub async fn vpc_router_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4803,10 +5699,10 @@ impl Client { /// - `vpc_name` /// - `router_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn routers_routes_get<'a>( + pub async fn vpc_router_route_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4866,7 +5762,7 @@ impl Client { /// - `router_name` /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn routers_routes_get_stream<'a>( + pub fn vpc_router_route_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4879,7 +5775,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.routers_routes_get( + self.vpc_router_route_list( organization_name, project_name, vpc_name, @@ -4895,7 +5791,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.routers_routes_get( + self.vpc_router_route_list( organization_name, project_name, vpc_name, @@ -4926,7 +5822,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` - pub async fn routers_routes_post<'a>( + pub async fn vpc_router_route_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4962,7 +5858,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` - pub async fn routers_routes_get_route<'a>( + pub async fn vpc_router_route_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -4999,7 +5895,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` - pub async fn routers_routes_put_route<'a>( + pub async fn vpc_router_route_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5037,7 +5933,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` - pub async fn routers_routes_delete_route<'a>( + pub async fn vpc_router_route_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5080,10 +5976,10 @@ impl Client { /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn vpc_subnets_get<'a>( + pub async fn vpc_subnet_list<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5139,7 +6035,7 @@ impl Client { /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn vpc_subnets_get_stream<'a>( + pub fn vpc_subnet_list_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5151,7 +6047,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.vpc_subnets_get( + self.vpc_subnet_list( organization_name, project_name, vpc_name, @@ -5166,7 +6062,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.vpc_subnets_get( + self.vpc_subnet_list( organization_name, project_name, vpc_name, @@ -5196,7 +6092,7 @@ impl Client { ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` - pub async fn vpc_subnets_post<'a>( + pub async fn vpc_subnet_create<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5230,7 +6126,7 @@ impl Client { ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` - pub async fn vpc_subnets_get_subnet<'a>( + pub async fn vpc_subnet_view<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5265,7 +6161,7 @@ impl Client { ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` - pub async fn vpc_subnets_put_subnet<'a>( + pub async fn vpc_subnet_update<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5301,7 +6197,7 @@ impl Client { ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` - pub async fn vpc_subnets_delete_subnet<'a>( + pub async fn vpc_subnet_delete<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5343,10 +6239,10 @@ impl Client { /// - `vpc_name` /// - `subnet_name` /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn subnet_network_interfaces_get<'a>( + pub async fn vpc_subnet_list_network_interfaces<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5406,7 +6302,7 @@ impl Client { /// - `subnet_name` /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn subnet_network_interfaces_get_stream<'a>( + pub fn vpc_subnet_list_network_interfaces_stream<'a>( &'a self, organization_name: &'a types::Name, project_name: &'a types::Name, @@ -5419,7 +6315,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.subnet_network_interfaces_get( + self.vpc_subnet_list_network_interfaces( organization_name, project_name, vpc_name, @@ -5435,7 +6331,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.subnet_network_interfaces_get( + self.vpc_subnet_list_network_interfaces( organization_name, project_name, vpc_name, @@ -5464,9 +6360,9 @@ impl Client { ///Fetch the top-level IAM policy /// ///Sends a `GET` request to `/policy` - pub async fn policy_get<'a>( + pub async fn policy_view<'a>( &'a self, - ) -> Result, Error> { + ) -> Result, Error> { let url = format!("{}/policy", self.baseurl,); let request = self.client.get(url).build()?; let result = self.client.execute(request).await; @@ -5486,10 +6382,10 @@ impl Client { ///Update the top-level IAM policy /// ///Sends a `PUT` request to `/policy` - pub async fn policy_put<'a>( + pub async fn policy_update<'a>( &'a self, - body: &'a types::FleetRolesPolicy, - ) -> Result, Error> { + body: &'a types::FleetRolePolicy, + ) -> Result, Error> { let url = format!("{}/policy", self.baseurl,); let request = self.client.put(url).json(&body).build()?; let result = self.client.execute(request).await; @@ -5512,9 +6408,9 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page - pub async fn roles_get<'a>( + pub async fn role_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -5551,14 +6447,14 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - pub fn roles_get_stream<'a>( + pub fn role_list_stream<'a>( &'a self, limit: Option, ) -> impl futures::Stream>> + Unpin + '_ { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.roles_get(limit, None) + self.role_list(limit, None) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -5566,7 +6462,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.roles_get(None, state.as_deref()) + self.role_list(None, state.as_deref()) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -5590,7 +6486,7 @@ impl Client { /// ///Arguments: /// - `role_name`: The built-in role's unique name. - pub async fn roles_get_role<'a>( + pub async fn role_view<'a>( &'a self, role_name: &'a str, ) -> Result, Error> { @@ -5620,10 +6516,10 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn sagas_get<'a>( + pub async fn saga_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -5666,7 +6562,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn sagas_get_stream<'a>( + pub fn saga_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -5674,7 +6570,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.sagas_get(limit, None, sort_by) + self.saga_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -5682,7 +6578,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.sagas_get(None, state.as_deref(), None) + self.saga_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -5703,7 +6599,7 @@ impl Client { ///Fetch information about a single saga (for debugging) /// ///Sends a `GET` request to `/sagas/{saga_id}` - pub async fn sagas_get_saga<'a>( + pub async fn saga_view<'a>( &'a self, saga_id: &'a uuid::Uuid, ) -> Result, Error> { @@ -5755,10 +6651,10 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn sshkeys_get<'a>( + pub async fn session_sshkey_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -5801,7 +6697,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn sshkeys_get_stream<'a>( + pub fn session_sshkey_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -5809,7 +6705,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.sshkeys_get(limit, None, sort_by) + self.session_sshkey_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -5817,7 +6713,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.sshkeys_get(None, state.as_deref(), None) + self.session_sshkey_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -5838,7 +6734,7 @@ impl Client { ///Create a new SSH public key for the current user /// ///Sends a `POST` request to `/session/me/sshkeys` - pub async fn sshkeys_post<'a>( + pub async fn session_sshkey_create<'a>( &'a self, body: &'a types::SshKeyCreate, ) -> Result, Error> { @@ -5861,7 +6757,7 @@ impl Client { ///Get (by name) an SSH public key belonging to the current user /// ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` - pub async fn sshkeys_get_key<'a>( + pub async fn session_sshkey_view<'a>( &'a self, ssh_key_name: &'a types::Name, ) -> Result, Error> { @@ -5888,7 +6784,7 @@ impl Client { ///Delete (by name) an SSH public key belonging to the current user /// ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` - pub async fn sshkeys_delete_key<'a>( + pub async fn session_sshkey_delete<'a>( &'a self, ssh_key_name: &'a types::Name, ) -> Result, Error> { @@ -5916,10 +6812,10 @@ impl Client { /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn silos_get<'a>( + pub async fn silo_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, @@ -5960,7 +6856,7 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn silos_get_stream<'a>( + pub fn silo_list_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -5968,7 +6864,7 @@ impl Client { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.silos_get(limit, None, sort_by) + self.silo_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -5976,7 +6872,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.silos_get(None, state.as_deref(), None) + self.silo_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -5997,7 +6893,7 @@ impl Client { ///Create a new silo /// ///Sends a `POST` request to `/silos` - pub async fn silos_post<'a>( + pub async fn silo_create<'a>( &'a self, body: &'a types::SiloCreate, ) -> Result, Error> { @@ -6023,7 +6919,7 @@ impl Client { /// ///Arguments: /// - `silo_name`: The silo's unique name. - pub async fn silos_get_silo<'a>( + pub async fn silo_view<'a>( &'a self, silo_name: &'a types::Name, ) -> Result, Error> { @@ -6053,7 +6949,7 @@ impl Client { /// ///Arguments: /// - `silo_name`: The silo's unique name. - pub async fn silos_delete_silo<'a>( + pub async fn silo_delete<'a>( &'a self, silo_name: &'a types::Name, ) -> Result, Error> { @@ -6077,16 +6973,111 @@ impl Client { } } + ///List Silo identity providers + /// + ///Sends a `GET` request to `/silos/{silo_name}/identity_providers` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + pub async fn silo_identity_provider_list<'a>( + &'a self, + silo_name: &'a types::Name, + limit: Option, + page_token: Option<&'a str>, + sort_by: Option, + ) -> Result, Error> { + let url = format!( + "{}/silos/{}/identity_providers", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + let mut query = Vec::new(); + 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())); + } + + let request = self.client.get(url).query(&query).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///List Silo identity providers as a Stream + /// + ///Sends repeated `GET` requests to `/silos/{silo_name}/identity_providers` + /// until there are no more results. + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `limit`: Maximum number of items returned by a single call + /// - `sort_by` + pub fn silo_identity_provider_list_stream<'a>( + &'a self, + silo_name: &'a types::Name, + limit: Option, + sort_by: Option, + ) -> impl futures::Stream>> + Unpin + '_ + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + self.silo_identity_provider_list(silo_name, limit, None, sort_by) + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold(page.next_page, move |state| async move { + if state.is_none() { + Ok(None) + } else { + self.silo_identity_provider_list(silo_name, None, state.as_deref(), None) + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + page.next_page, + )) + }) + .await + } + }) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + ///Fetch the IAM policy for this Silo /// ///Sends a `GET` request to `/silos/{silo_name}/policy` /// ///Arguments: /// - `silo_name`: The silo's unique name. - pub async fn silos_get_silo_policy<'a>( + pub async fn silo_policy_view<'a>( &'a self, silo_name: &'a types::Name, - ) -> Result, Error> { + ) -> Result, Error> { let url = format!( "{}/silos/{}/policy", self.baseurl, @@ -6114,11 +7105,11 @@ impl Client { ///Arguments: /// - `silo_name`: The silo's unique name. /// - `body` - pub async fn silos_put_silo_policy<'a>( + pub async fn silo_policy_update<'a>( &'a self, silo_name: &'a types::Name, - body: &'a types::SiloRolesPolicy, - ) -> Result, Error> { + body: &'a types::SiloRolePolicy, + ) -> Result, Error> { let url = format!( "{}/silos/{}/policy", self.baseurl, @@ -6139,13 +7130,196 @@ impl Client { } } + ///Create a new SAML identity provider for a silo + /// + ///Sends a `POST` request to `/silos/{silo_name}/saml_identity_providers` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `body` + pub async fn silo_identity_provider_create<'a>( + &'a self, + silo_name: &'a types::Name, + body: &'a types::SamlIdentityProviderCreate, + ) -> Result, Error> { + let url = format!( + "{}/silos/{}/saml_identity_providers", + self.baseurl, + encode_path(&silo_name.to_string()), + ); + let request = self.client.post(url).json(&body).build()?; + let result = self.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)), + } + } + + ///GET a silo's SAML identity provider + /// + ///Sends a `GET` request to + /// `/silos/{silo_name}/saml_identity_providers/{provider_name}` + /// + ///Arguments: + /// - `silo_name`: The silo's unique name. + /// - `provider_name`: The SAML identity provider's name + pub async fn silo_identity_provider_view<'a>( + &'a self, + silo_name: &'a types::Name, + provider_name: &'a types::Name, + ) -> Result, Error> { + let url = format!( + "{}/silos/{}/saml_identity_providers/{}", + self.baseurl, + encode_path(&silo_name.to_string()), + encode_path(&provider_name.to_string()), + ); + let request = self.client.get(url).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///List the built-in system users + /// + ///Sends a `GET` request to `/system/user` + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `page_token`: Token returned by previous call to retrieve the + /// subsequent page + /// - `sort_by` + pub async fn system_user_list<'a>( + &'a self, + limit: Option, + page_token: Option<&'a str>, + sort_by: Option, + ) -> Result, Error> { + let url = format!("{}/system/user", self.baseurl,); + let mut query = Vec::new(); + 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())); + } + + let request = self.client.get(url).query(&query).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + + ///List the built-in system users as a Stream + /// + ///Sends repeated `GET` requests to `/system/user` until there are no more + /// results. + /// + ///Arguments: + /// - `limit`: Maximum number of items returned by a single call + /// - `sort_by` + pub fn system_user_list_stream<'a>( + &'a self, + limit: Option, + sort_by: Option, + ) -> impl futures::Stream>> + Unpin + '_ + { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + self.system_user_list(limit, None, sort_by) + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items.into_iter().map(Ok)); + let rest = futures::stream::try_unfold(page.next_page, move |state| async move { + if state.is_none() { + Ok(None) + } else { + self.system_user_list(None, state.as_deref(), None) + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items.into_iter().map(Ok)), + page.next_page, + )) + }) + .await + } + }) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + + ///Fetch a specific built-in system user + /// + ///Sends a `GET` request to `/system/user/{user_name}` + /// + ///Arguments: + /// - `user_name`: The built-in user's unique name. + pub async fn system_user_view<'a>( + &'a self, + user_name: &'a types::Name, + ) -> Result, Error> { + let url = format!( + "{}/system/user/{}", + self.baseurl, + encode_path(&user_name.to_string()), + ); + let request = self.client.get(url).build()?; + let result = self.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + ///List all timeseries schema /// ///Sends a `GET` request to `/timeseries/schema` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page pub async fn timeseries_schema_get<'a>( &'a self, @@ -6238,20 +7412,20 @@ impl Client { } } - ///List the built-in system users + ///List users /// ///Sends a `GET` request to `/users` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call - /// - `page_token`: Token returned by previous call to retreive the + /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` - pub async fn users_get<'a>( + pub async fn user_list<'a>( &'a self, limit: Option, page_token: Option<&'a str>, - sort_by: Option, + sort_by: Option, ) -> Result, Error> { let url = format!("{}/users", self.baseurl,); let mut query = Vec::new(); @@ -6282,7 +7456,7 @@ impl Client { } } - ///List the built-in system users as a Stream + ///List users as a Stream /// ///Sends repeated `GET` requests to `/users` until there are no more /// results. @@ -6290,15 +7464,15 @@ impl Client { ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `sort_by` - pub fn users_get_stream<'a>( + pub fn user_list_stream<'a>( &'a self, limit: Option, - sort_by: Option, + sort_by: Option, ) -> impl futures::Stream>> + Unpin + '_ { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; - self.users_get(limit, None, sort_by) + self.user_list(limit, None, sort_by) .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); @@ -6306,7 +7480,7 @@ impl Client { if state.is_none() { Ok(None) } else { - self.users_get(None, state.as_deref(), None) + self.user_list(None, state.as_deref(), None) .map_ok(|page| { let page = page.into_inner(); Some(( @@ -6323,34 +7497,4 @@ impl Client { .try_flatten_stream() .boxed() } - - ///Fetch a specific built-in system user - /// - ///Sends a `GET` request to `/users/{user_name}` - /// - ///Arguments: - /// - `user_name`: The built-in user's unique name. - pub async fn users_get_user<'a>( - &'a self, - user_name: &'a types::Name, - ) -> Result, Error> { - let url = format!( - "{}/users/{}", - self.baseurl, - encode_path(&user_name.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } } diff --git a/progenitor-impl/tests/output/test_default_params.out b/progenitor-impl/tests/output/test_default_params.out index 8cb3921..84ceb2b 100644 --- a/progenitor-impl/tests/output/test_default_params.out +++ b/progenitor-impl/tests/output/test_default_params.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; diff --git a/progenitor-impl/tests/output/test_freeform_response.out b/progenitor-impl/tests/output/test_freeform_response.out index a11367e..b92b297 100644 --- a/progenitor-impl/tests/output/test_freeform_response.out +++ b/progenitor-impl/tests/output/test_freeform_response.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; diff --git a/progenitor-impl/tests/output/test_renamed_parameters.out b/progenitor-impl/tests/output/test_renamed_parameters.out index 5c73d9c..c9a5431 100644 --- a/progenitor-impl/tests/output/test_renamed_parameters.out +++ b/progenitor-impl/tests/output/test_renamed_parameters.out @@ -1,5 +1,5 @@ #[allow(unused_imports)] -use progenitor_client::encode_path; +use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; pub mod types { use serde::{Deserialize, Serialize}; diff --git a/progenitor/src/main.rs b/progenitor/src/main.rs index 317bf6f..b5ab5d5 100644 --- a/progenitor/src/main.rs +++ b/progenitor/src/main.rs @@ -85,7 +85,6 @@ fn main() -> Result<()> { let args = Args::parse(); let api = load_api(&args.input)?; - //let mut builder = Generator::default(); let mut builder = Generator::new( GenerationSettings::default() .with_interface(args.interface.into()) diff --git a/progenitor/tests/build_nexus.rs b/progenitor/tests/build_nexus.rs index 1a41d24..41e2698 100644 --- a/progenitor/tests/build_nexus.rs +++ b/progenitor/tests/build_nexus.rs @@ -15,7 +15,7 @@ mod positional { let org = types::Name("org".to_string()); let project = types::Name("project".to_string()); let instance = types::Name("instance".to_string()); - let stream = client.instance_disks_get_stream( + let stream = client.instance_disk_list_stream( &org, &project, &instance, None, None, ); let _ = stream.collect::>(); @@ -39,7 +39,7 @@ mod builder_untagged { pub fn _ignore() { let client = Client::new(""); let stream = client - .instance_disks_get() + .instance_disk_list() .organization_name(types::Name("org".to_string())) .project_name(types::Name("project".to_string())) .instance_name(types::Name("instance".to_string())) @@ -64,7 +64,7 @@ mod builder_tagged { fn _ignore() { let client = Client::new(""); let stream = client - .instance_disks_get() + .instance_disk_list() .organization_name(types::Name("org".to_string())) .project_name(types::Name("project".to_string())) .instance_name(types::Name("instance".to_string())) diff --git a/sample_openapi/nexus.json b/sample_openapi/nexus.json index ce865b0..10f926b 100644 --- a/sample_openapi/nexus.json +++ b/sample_openapi/nexus.json @@ -10,13 +10,115 @@ "version": "0.0.1" }, "paths": { + "/device/auth": { + "post": { + "tags": [ + "hidden" + ], + "summary": "Start an OAuth 2.0 Device Authorization Grant", + "description": "This endpoint is designed to be accessed from an *unauthenticated* API client. It generates and records a `device_code` and `user_code` which must be verified and confirmed prior to a token being granted.", + "operationId": "device_auth_request", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DeviceAuthRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "*/*": { + "schema": {} + } + } + } + } + } + }, + "/device/confirm": { + "post": { + "tags": [ + "hidden" + ], + "summary": "Confirm an OAuth 2.0 Device Authorization Grant", + "description": "This endpoint is designed to be accessed by the user agent (browser), not the client requesting the token. So we do not actually return the token here; it will be returned in response to the poll on `/device/token`.", + "operationId": "device_auth_confirm", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeviceAuthVerify" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "title": "Null", + "type": "string", + "enum": [ + null + ] + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/device/token": { + "post": { + "tags": [ + "hidden" + ], + "summary": "Request a device access token", + "description": "This endpoint should be polled by the client until the user code is verified and the grant is confirmed.", + "operationId": "device_access_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DeviceAccessTokenRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "*/*": { + "schema": {} + } + } + } + } + } + }, "/hardware/racks": { "get": { "tags": [ - "racks" + "hardware" ], "summary": "List racks in the system.", - "operationId": "hardware_racks_get", + "operationId": "rack_list", "parameters": [ { "in": "query", @@ -33,7 +135,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -73,10 +175,10 @@ "/hardware/racks/{rack_id}": { "get": { "tags": [ - "racks" + "hardware" ], "summary": "Fetch information about a particular rack.", - "operationId": "hardware_racks_get_rack", + "operationId": "rack_view", "parameters": [ { "in": "path", @@ -113,10 +215,10 @@ "/hardware/sleds": { "get": { "tags": [ - "sleds" + "hardware" ], "summary": "List sleds in the system.", - "operationId": "hardware_sleds_get", + "operationId": "sled_list", "parameters": [ { "in": "query", @@ -133,7 +235,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -173,10 +275,10 @@ "/hardware/sleds/{sled_id}": { "get": { "tags": [ - "sleds" + "hardware" ], "summary": "Fetch information about a sled in the system.", - "operationId": "hardware_sleds_get_sled", + "operationId": "sled_view", "parameters": [ { "in": "path", @@ -217,7 +319,7 @@ ], "summary": "List global images.", "description": "Returns a list of all the global images. Global images are returned sorted by creation date, with the most recent images appearing first.", - "operationId": "images_get", + "operationId": "image_global_list", "parameters": [ { "in": "query", @@ -234,7 +336,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -276,12 +378,12 @@ ], "summary": "Create a global image.", "description": "Create a new global image. This image can then be used by any user as a base for instances.", - "operationId": "images_post", + "operationId": "image_global_create", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ImageCreate" + "$ref": "#/components/schemas/GlobalImageCreate" } } }, @@ -314,7 +416,7 @@ ], "summary": "Get a global image.", "description": "Returns the details of a specific global image.", - "operationId": "images_get_image", + "operationId": "image_global_view", "parameters": [ { "in": "path", @@ -351,7 +453,7 @@ ], "summary": "Delete a global image.", "description": "Permanently delete a global image. This operation cannot be undone. Any instances using the global image will continue to run, however new instances can not be created with this image.", - "operationId": "images_delete_image", + "operationId": "image_global_delete", "parameters": [ { "in": "path", @@ -376,6 +478,365 @@ } } }, + "/ip-pools": { + "get": { + "tags": [ + "ip-pools" + ], + "summary": "List IP Pools.", + "operationId": "ip_pool_list", + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "style": "form" + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + }, + "style": "form" + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/NameOrIdSortMode" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPoolResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": true + }, + "post": { + "tags": [ + "ip-pools" + ], + "summary": "Create a new IP Pool.", + "operationId": "ip_pool_create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPoolCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPool" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/ip-pools/{pool_name}": { + "get": { + "tags": [ + "ip-pools" + ], + "summary": "Fetch a single IP Pool.", + "operationId": "ip_pool_view", + "parameters": [ + { + "in": "path", + "name": "pool_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPool" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "put": { + "tags": [ + "ip-pools" + ], + "summary": "Update an IP Pool.", + "operationId": "ip_pool_update", + "parameters": [ + { + "in": "path", + "name": "pool_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPoolUpdate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPool" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "delete": { + "tags": [ + "ip-pools" + ], + "summary": "Delete an IP Pool.", + "operationId": "ip_pool_delete", + "parameters": [ + { + "in": "path", + "name": "pool_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/ip-pools/{pool_name}/ranges": { + "get": { + "tags": [ + "ip-pools" + ], + "summary": "List the ranges of IP addresses within an existing IP Pool.", + "description": "Note that ranges are listed sorted by their first address.", + "operationId": "ip_pool_range_list", + "parameters": [ + { + "in": "path", + "name": "pool_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "style": "form" + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPoolRangeResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": true + } + }, + "/ip-pools/{pool_name}/ranges/add": { + "post": { + "tags": [ + "ip-pools" + ], + "summary": "Add a new range to an existing IP Pool.", + "operationId": "ip_pool_range_add", + "parameters": [ + { + "in": "path", + "name": "pool_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpRange" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpPoolRange" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/ip-pools/{pool_name}/ranges/remove": { + "post": { + "tags": [ + "ip-pools" + ], + "summary": "Remove a range from an existing IP Pool.", + "operationId": "ip_pool_range_remove", + "parameters": [ + { + "in": "path", + "name": "pool_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IpRange" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "resource updated" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, "/login": { "post": { "tags": [ @@ -386,7 +847,96 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoginParams" + "$ref": "#/components/schemas/SpoofLoginBody" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "*/*": { + "schema": {} + } + } + } + } + } + }, + "/login/{silo_name}/{provider_name}": { + "get": { + "tags": [ + "login" + ], + "summary": "Ask the user to login to their identity provider", + "description": "Either display a page asking a user for their credentials, or redirect them to their identity provider.", + "operationId": "login", + "parameters": [ + { + "in": "path", + "name": "provider_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "silo_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "responses": { + "default": { + "description": "", + "content": { + "*/*": { + "schema": {} + } + } + } + } + }, + "post": { + "tags": [ + "login" + ], + "summary": "Consume some sort of credentials, and authenticate a user.", + "description": "Either receive a username and password, or some sort of identity provider data (like a SAMLResponse). Use these to set the user's session cookie.", + "operationId": "consume_credentials", + "parameters": [ + { + "in": "path", + "name": "provider_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "silo_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" } } }, @@ -428,7 +978,7 @@ "organizations" ], "summary": "List all organizations.", - "operationId": "organizations_get", + "operationId": "organization_list", "parameters": [ { "in": "query", @@ -445,7 +995,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -486,7 +1036,7 @@ "organizations" ], "summary": "Create a new organization.", - "operationId": "organizations_post", + "operationId": "organization_create", "requestBody": { "content": { "application/json": { @@ -523,7 +1073,7 @@ "organizations" ], "summary": "Fetch a specific organization", - "operationId": "organizations_get_organization", + "operationId": "organization_view", "parameters": [ { "in": "path", @@ -560,7 +1110,7 @@ "organizations" ], "summary": "Update a specific organization.", - "operationId": "organizations_put_organization", + "operationId": "organization_update", "parameters": [ { "in": "path", @@ -607,7 +1157,7 @@ "organizations" ], "summary": "Delete a specific organization.", - "operationId": "organizations_delete_organization", + "operationId": "organization_delete", "parameters": [ { "in": "path", @@ -639,7 +1189,7 @@ "organizations" ], "summary": "Fetch the IAM policy for this Organization", - "operationId": "organization_get_policy", + "operationId": "organization_policy_view", "parameters": [ { "in": "path", @@ -658,7 +1208,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationRolesPolicy" + "$ref": "#/components/schemas/OrganizationRolePolicy" } } } @@ -676,7 +1226,7 @@ "organizations" ], "summary": "Update the IAM policy for this Organization", - "operationId": "organization_put_policy", + "operationId": "organization_policy_update", "parameters": [ { "in": "path", @@ -693,7 +1243,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationRolesPolicy" + "$ref": "#/components/schemas/OrganizationRolePolicy" } } }, @@ -705,7 +1255,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationRolesPolicy" + "$ref": "#/components/schemas/OrganizationRolePolicy" } } } @@ -725,7 +1275,7 @@ "projects" ], "summary": "List all projects.", - "operationId": "organization_projects_get", + "operationId": "project_list", "parameters": [ { "in": "query", @@ -742,7 +1292,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -793,7 +1343,7 @@ "projects" ], "summary": "Create a new project.", - "operationId": "organization_projects_post", + "operationId": "project_create", "parameters": [ { "in": "path", @@ -842,7 +1392,7 @@ "projects" ], "summary": "Fetch a specific project", - "operationId": "organization_projects_get_project", + "operationId": "project_view", "parameters": [ { "in": "path", @@ -889,7 +1439,7 @@ "projects" ], "summary": "Update a specific project.", - "operationId": "organization_projects_put_project", + "operationId": "project_update", "parameters": [ { "in": "path", @@ -946,7 +1496,7 @@ "projects" ], "summary": "Delete a specific project.", - "operationId": "organization_projects_delete_project", + "operationId": "project_delete", "parameters": [ { "in": "path", @@ -988,7 +1538,7 @@ "disks" ], "summary": "List disks in a project.", - "operationId": "project_disks_get", + "operationId": "disk_list", "parameters": [ { "in": "query", @@ -1005,7 +1555,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -1066,7 +1616,7 @@ "disks" ], "summary": "Create a disk in a project.", - "operationId": "project_disks_post", + "operationId": "disk_create", "parameters": [ { "in": "path", @@ -1125,7 +1675,7 @@ "disks" ], "summary": "Fetch a single disk in a project.", - "operationId": "project_disks_get_disk", + "operationId": "disk_view", "parameters": [ { "in": "path", @@ -1179,7 +1729,7 @@ "disks" ], "summary": "Delete a disk from a project.", - "operationId": "project_disks_delete_disk", + "operationId": "disk_delete", "parameters": [ { "in": "path", @@ -1229,7 +1779,7 @@ ], "summary": "List images", "description": "List images in a project. The images are returned sorted by creation date, with the most recent images appearing first.", - "operationId": "project_images_get", + "operationId": "image_list", "parameters": [ { "in": "query", @@ -1246,7 +1796,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -1308,7 +1858,7 @@ ], "summary": "Create an image", "description": "Create a new image in a project.", - "operationId": "project_images_post", + "operationId": "image_create", "parameters": [ { "in": "path", @@ -1368,7 +1918,7 @@ ], "summary": "Get an image", "description": "Get the details of a specific image in a project.", - "operationId": "project_images_get_image", + "operationId": "image_view", "parameters": [ { "in": "path", @@ -1423,7 +1973,7 @@ ], "summary": "Delete an image", "description": "Permanently delete an image from a project. This operation cannot be undone. Any instances in the project using the image will continue to run, however new instances can not be created with this image.", - "operationId": "project_images_delete_image", + "operationId": "image_delete", "parameters": [ { "in": "path", @@ -1472,7 +2022,7 @@ "instances" ], "summary": "List instances in a project.", - "operationId": "project_instances_get", + "operationId": "instance_list", "parameters": [ { "in": "query", @@ -1489,7 +2039,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -1550,7 +2100,7 @@ "instances" ], "summary": "Create an instance in a project.", - "operationId": "project_instances_post", + "operationId": "instance_create", "parameters": [ { "in": "path", @@ -1609,7 +2159,7 @@ "instances" ], "summary": "Get an instance in a project.", - "operationId": "project_instances_get_instance", + "operationId": "instance_view", "parameters": [ { "in": "path", @@ -1663,7 +2213,7 @@ "instances" ], "summary": "Delete an instance from a project.", - "operationId": "project_instances_delete_instance", + "operationId": "instance_delete", "parameters": [ { "in": "path", @@ -1712,7 +2262,7 @@ "instances" ], "summary": "List disks attached to this instance.", - "operationId": "instance_disks_get", + "operationId": "instance_disk_list", "parameters": [ { "in": "query", @@ -1729,7 +2279,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -1798,7 +2348,7 @@ "tags": [ "instances" ], - "operationId": "instance_disks_attach", + "operationId": "instance_disk_attach", "parameters": [ { "in": "path", @@ -1863,7 +2413,7 @@ "tags": [ "instances" ], - "operationId": "instance_disks_detach", + "operationId": "instance_disk_detach", "parameters": [ { "in": "path", @@ -1929,7 +2479,7 @@ "instances" ], "summary": "Migrate an instance to a different propolis-server, possibly on a different sled.", - "operationId": "project_instances_migrate_instance", + "operationId": "instance_migrate", "parameters": [ { "in": "path", @@ -1995,7 +2545,7 @@ "instances" ], "summary": "List network interfaces attached to this instance.", - "operationId": "instance_network_interfaces_get", + "operationId": "instance_network_interface_list", "parameters": [ { "in": "query", @@ -2012,7 +2562,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -2080,7 +2630,7 @@ "instances" ], "summary": "Create a network interface for an instance.", - "operationId": "instance_network_interfaces_post", + "operationId": "instance_network_interface_create", "parameters": [ { "in": "path", @@ -2146,7 +2696,7 @@ "instances" ], "summary": "Get an interface attached to an instance.", - "operationId": "instance_network_interfaces_get_interface", + "operationId": "instance_network_interface_view", "parameters": [ { "in": "path", @@ -2204,12 +2754,86 @@ } } }, + "put": { + "tags": [ + "instances" + ], + "summary": "Update information about an instance's network interface", + "operationId": "instance_network_interface_update", + "parameters": [ + { + "in": "path", + "name": "instance_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "interface_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "organization_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "project_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NetworkInterfaceUpdate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NetworkInterface" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, "delete": { "tags": [ "instances" ], "summary": "Detach a network interface from an instance.", - "operationId": "instance_network_interfaces_delete_interface", + "description": "Note that the primary interface for an instance cannot be deleted if there are any secondary interfaces. A new primary interface must be designated first. The primary interface can be deleted if there are no secondary interfaces.", + "operationId": "instance_network_interface_delete", "parameters": [ { "in": "path", @@ -2267,7 +2891,7 @@ "instances" ], "summary": "Reboot an instance.", - "operationId": "project_instances_instance_reboot", + "operationId": "instance_reboot", "parameters": [ { "in": "path", @@ -2317,13 +2941,105 @@ } } }, + "/organizations/{organization_name}/projects/{project_name}/instances/{instance_name}/serial-console": { + "get": { + "tags": [ + "instances" + ], + "summary": "Get contents of an instance's serial console.", + "operationId": "instance_serial_console", + "parameters": [ + { + "in": "path", + "name": "instance_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "organization_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "project_name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "query", + "name": "from_start", + "description": "Character index in the serial buffer from which to read, counting the bytes output since instance start. If this is not provided, `most_recent` must be provided, and if this *is* provided, `most_recent` must *not* be provided.", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "style": "form" + }, + { + "in": "query", + "name": "max_bytes", + "description": "Maximum number of bytes of buffered serial console contents to return. If the requested range runs to the end of the available buffer, the data returned will be shorter than `max_bytes`.", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "style": "form" + }, + { + "in": "query", + "name": "most_recent", + "description": "Character index in the serial buffer from which to read, counting *backward* from the most recently buffered data retrieved from the instance. (See note on `from_start` about mutual exclusivity)", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InstanceSerialConsoleData" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, "/organizations/{organization_name}/projects/{project_name}/instances/{instance_name}/start": { "post": { "tags": [ "instances" ], "summary": "Boot an instance.", - "operationId": "project_instances_instance_start", + "operationId": "instance_start", "parameters": [ { "in": "path", @@ -2379,7 +3095,7 @@ "instances" ], "summary": "Halt an instance.", - "operationId": "project_instances_instance_stop", + "operationId": "instance_stop", "parameters": [ { "in": "path", @@ -2435,7 +3151,7 @@ "projects" ], "summary": "Fetch the IAM policy for this Project", - "operationId": "organization_projects_get_project_policy", + "operationId": "project_policy_view", "parameters": [ { "in": "path", @@ -2464,7 +3180,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProjectRolesPolicy" + "$ref": "#/components/schemas/ProjectRolePolicy" } } } @@ -2482,7 +3198,7 @@ "projects" ], "summary": "Update the IAM policy for this Project", - "operationId": "organization_projects_put_project_policy", + "operationId": "project_policy_update", "parameters": [ { "in": "path", @@ -2509,7 +3225,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProjectRolesPolicy" + "$ref": "#/components/schemas/ProjectRolePolicy" } } }, @@ -2521,7 +3237,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProjectRolesPolicy" + "$ref": "#/components/schemas/ProjectRolePolicy" } } } @@ -2541,7 +3257,7 @@ "snapshots" ], "summary": "List snapshots in a project.", - "operationId": "project_snapshots_get", + "operationId": "snapshot_list", "parameters": [ { "in": "query", @@ -2558,7 +3274,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -2619,7 +3335,7 @@ "snapshots" ], "summary": "Create a snapshot of a disk.", - "operationId": "project_snapshots_post", + "operationId": "snapshot_create", "parameters": [ { "in": "path", @@ -2678,7 +3394,7 @@ "snapshots" ], "summary": "Get a snapshot in a project.", - "operationId": "project_snapshots_get_snapshot", + "operationId": "snapshot_view", "parameters": [ { "in": "path", @@ -2732,7 +3448,7 @@ "snapshots" ], "summary": "Delete a snapshot from a project.", - "operationId": "project_snapshots_delete_snapshot", + "operationId": "snapshot_delete", "parameters": [ { "in": "path", @@ -2781,7 +3497,7 @@ "vpcs" ], "summary": "List VPCs in a project.", - "operationId": "project_vpcs_get", + "operationId": "vpc_list", "parameters": [ { "in": "query", @@ -2798,7 +3514,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -2859,7 +3575,7 @@ "vpcs" ], "summary": "Create a VPC in a project.", - "operationId": "project_vpcs_post", + "operationId": "vpc_create", "parameters": [ { "in": "path", @@ -2918,7 +3634,7 @@ "vpcs" ], "summary": "Get a VPC in a project.", - "operationId": "project_vpcs_get_vpc", + "operationId": "vpc_view", "parameters": [ { "in": "path", @@ -2972,7 +3688,7 @@ "vpcs" ], "summary": "Update a VPC.", - "operationId": "project_vpcs_put_vpc", + "operationId": "vpc_update", "parameters": [ { "in": "path", @@ -3036,7 +3752,7 @@ "vpcs" ], "summary": "Delete a vpc from a project.", - "operationId": "project_vpcs_delete_vpc", + "operationId": "vpc_delete", "parameters": [ { "in": "path", @@ -3082,10 +3798,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/firewall/rules": { "get": { "tags": [ - "firewall" + "vpcs" ], "summary": "List firewall rules for a VPC.", - "operationId": "vpc_firewall_rules_get", + "operationId": "vpc_firewall_rules_view", "parameters": [ { "in": "path", @@ -3136,10 +3852,10 @@ }, "put": { "tags": [ - "firewall" + "vpcs" ], "summary": "Replace the firewall rules for a VPC", - "operationId": "vpc_firewall_rules_put", + "operationId": "vpc_firewall_rules_update", "parameters": [ { "in": "path", @@ -3202,10 +3918,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/routers": { "get": { "tags": [ - "routers" + "vpcs" ], "summary": "List VPC Custom and System Routers", - "operationId": "vpc_routers_get", + "operationId": "vpc_router_list", "parameters": [ { "in": "query", @@ -3222,7 +3938,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -3287,10 +4003,10 @@ }, "post": { "tags": [ - "routers" + "vpcs" ], "summary": "Create a VPC Router", - "operationId": "vpc_routers_post", + "operationId": "vpc_router_create", "parameters": [ { "in": "path", @@ -3353,10 +4069,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/routers/{router_name}": { "get": { "tags": [ - "routers" + "vpcs" ], "summary": "Get a VPC Router", - "operationId": "vpc_routers_get_router", + "operationId": "vpc_router_view", "parameters": [ { "in": "path", @@ -3416,10 +4132,10 @@ }, "put": { "tags": [ - "routers" + "vpcs" ], "summary": "Update a VPC Router", - "operationId": "vpc_routers_put_router", + "operationId": "vpc_router_update", "parameters": [ { "in": "path", @@ -3489,10 +4205,10 @@ }, "delete": { "tags": [ - "routers" + "vpcs" ], "summary": "Delete a router from its VPC", - "operationId": "vpc_routers_delete_router", + "operationId": "vpc_router_delete", "parameters": [ { "in": "path", @@ -3547,10 +4263,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/routers/{router_name}/routes": { "get": { "tags": [ - "routes" + "vpcs" ], "summary": "List a Router's routes", - "operationId": "routers_routes_get", + "operationId": "vpc_router_route_list", "parameters": [ { "in": "query", @@ -3567,7 +4283,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -3641,10 +4357,10 @@ }, "post": { "tags": [ - "routes" + "vpcs" ], "summary": "Create a VPC Router", - "operationId": "routers_routes_post", + "operationId": "vpc_router_route_create", "parameters": [ { "in": "path", @@ -3716,10 +4432,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/routers/{router_name}/routes/{route_name}": { "get": { "tags": [ - "routes" + "vpcs" ], "summary": "Get a VPC Router route", - "operationId": "routers_routes_get_route", + "operationId": "vpc_router_route_view", "parameters": [ { "in": "path", @@ -3788,10 +4504,10 @@ }, "put": { "tags": [ - "routes" + "vpcs" ], "summary": "Update a Router route", - "operationId": "routers_routes_put_route", + "operationId": "vpc_router_route_update", "parameters": [ { "in": "path", @@ -3870,10 +4586,10 @@ }, "delete": { "tags": [ - "routes" + "vpcs" ], "summary": "Delete a route from its router", - "operationId": "routers_routes_delete_route", + "operationId": "vpc_router_route_delete", "parameters": [ { "in": "path", @@ -3937,10 +4653,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/subnets": { "get": { "tags": [ - "subnets" + "vpcs" ], "summary": "List subnets in a VPC.", - "operationId": "vpc_subnets_get", + "operationId": "vpc_subnet_list", "parameters": [ { "in": "query", @@ -3957,7 +4673,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -4022,10 +4738,10 @@ }, "post": { "tags": [ - "subnets" + "vpcs" ], "summary": "Create a subnet in a VPC.", - "operationId": "vpc_subnets_post", + "operationId": "vpc_subnet_create", "parameters": [ { "in": "path", @@ -4088,10 +4804,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/subnets/{subnet_name}": { "get": { "tags": [ - "subnets" + "vpcs" ], "summary": "Get subnet in a VPC.", - "operationId": "vpc_subnets_get_subnet", + "operationId": "vpc_subnet_view", "parameters": [ { "in": "path", @@ -4151,10 +4867,10 @@ }, "put": { "tags": [ - "subnets" + "vpcs" ], "summary": "Update a VPC Subnet.", - "operationId": "vpc_subnets_put_subnet", + "operationId": "vpc_subnet_update", "parameters": [ { "in": "path", @@ -4224,10 +4940,10 @@ }, "delete": { "tags": [ - "subnets" + "vpcs" ], "summary": "Delete a subnet from a VPC.", - "operationId": "vpc_subnets_delete_subnet", + "operationId": "vpc_subnet_delete", "parameters": [ { "in": "path", @@ -4282,10 +4998,10 @@ "/organizations/{organization_name}/projects/{project_name}/vpcs/{vpc_name}/subnets/{subnet_name}/network-interfaces": { "get": { "tags": [ - "subnets" + "vpcs" ], "summary": "List network interfaces in a VPC subnet.", - "operationId": "subnet_network_interfaces_get", + "operationId": "vpc_subnet_list_network_interfaces", "parameters": [ { "in": "query", @@ -4302,7 +5018,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -4381,14 +5097,14 @@ "policy" ], "summary": "Fetch the top-level IAM policy", - "operationId": "policy_get", + "operationId": "policy_view", "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FleetRolesPolicy" + "$ref": "#/components/schemas/FleetRolePolicy" } } } @@ -4406,12 +5122,12 @@ "policy" ], "summary": "Update the top-level IAM policy", - "operationId": "policy_put", + "operationId": "policy_update", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FleetRolesPolicy" + "$ref": "#/components/schemas/FleetRolePolicy" } } }, @@ -4423,7 +5139,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FleetRolesPolicy" + "$ref": "#/components/schemas/FleetRolePolicy" } } } @@ -4443,7 +5159,7 @@ "roles" ], "summary": "List the built-in roles", - "operationId": "roles_get", + "operationId": "role_list", "parameters": [ { "in": "query", @@ -4460,7 +5176,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -4495,7 +5211,7 @@ "roles" ], "summary": "Fetch a specific built-in role", - "operationId": "roles_get_role", + "operationId": "role_view", "parameters": [ { "in": "path", @@ -4534,7 +5250,7 @@ "sagas" ], "summary": "List all sagas (for debugging)", - "operationId": "sagas_get", + "operationId": "saga_list", "parameters": [ { "in": "query", @@ -4551,7 +5267,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -4594,7 +5310,7 @@ "sagas" ], "summary": "Fetch information about a single saga (for debugging)", - "operationId": "sagas_get_saga", + "operationId": "saga_view", "parameters": [ { "in": "path", @@ -4657,10 +5373,10 @@ "/session/me/sshkeys": { "get": { "tags": [ - "sshkeys" + "session" ], "summary": "List the current user's SSH public keys", - "operationId": "sshkeys_get", + "operationId": "session_sshkey_list", "parameters": [ { "in": "query", @@ -4677,7 +5393,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -4715,10 +5431,10 @@ }, "post": { "tags": [ - "sshkeys" + "session" ], "summary": "Create a new SSH public key for the current user", - "operationId": "sshkeys_post", + "operationId": "session_sshkey_create", "requestBody": { "content": { "application/json": { @@ -4752,10 +5468,10 @@ "/session/me/sshkeys/{ssh_key_name}": { "get": { "tags": [ - "sshkeys" + "session" ], "summary": "Get (by name) an SSH public key belonging to the current user", - "operationId": "sshkeys_get_key", + "operationId": "session_sshkey_view", "parameters": [ { "in": "path", @@ -4788,10 +5504,10 @@ }, "delete": { "tags": [ - "sshkeys" + "session" ], "summary": "Delete (by name) an SSH public key belonging to the current user", - "operationId": "sshkeys_delete_key", + "operationId": "session_sshkey_delete", "parameters": [ { "in": "path", @@ -4821,7 +5537,7 @@ "tags": [ "silos" ], - "operationId": "silos_get", + "operationId": "silo_list", "parameters": [ { "in": "query", @@ -4838,7 +5554,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -4879,7 +5595,7 @@ "silos" ], "summary": "Create a new silo.", - "operationId": "silos_post", + "operationId": "silo_create", "requestBody": { "content": { "application/json": { @@ -4916,7 +5632,7 @@ "silos" ], "summary": "Fetch a specific silo", - "operationId": "silos_get_silo", + "operationId": "silo_view", "parameters": [ { "in": "path", @@ -4953,7 +5669,7 @@ "silos" ], "summary": "Delete a specific silo.", - "operationId": "silos_delete_silo", + "operationId": "silo_delete", "parameters": [ { "in": "path", @@ -4979,13 +5695,83 @@ } } }, + "/silos/{silo_name}/identity_providers": { + "get": { + "tags": [ + "silos" + ], + "summary": "List Silo identity providers", + "operationId": "silo_identity_provider_list", + "parameters": [ + { + "in": "path", + "name": "silo_name", + "description": "The silo's unique name.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "style": "form" + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + }, + "style": "form" + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/NameSortMode" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IdentityProviderResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": true + } + }, "/silos/{silo_name}/policy": { "get": { "tags": [ "silos" ], "summary": "Fetch the IAM policy for this Silo", - "operationId": "silos_get_silo_policy", + "operationId": "silo_policy_view", "parameters": [ { "in": "path", @@ -5004,7 +5790,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SiloRolesPolicy" + "$ref": "#/components/schemas/SiloRolePolicy" } } } @@ -5022,7 +5808,7 @@ "silos" ], "summary": "Update the IAM policy for this Silo", - "operationId": "silos_put_silo_policy", + "operationId": "silo_policy_update", "parameters": [ { "in": "path", @@ -5039,7 +5825,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SiloRolesPolicy" + "$ref": "#/components/schemas/SiloRolePolicy" } } }, @@ -5051,7 +5837,204 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SiloRolesPolicy" + "$ref": "#/components/schemas/SiloRolePolicy" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/silos/{silo_name}/saml_identity_providers": { + "post": { + "tags": [ + "silos" + ], + "summary": "Create a new SAML identity provider for a silo.", + "operationId": "silo_identity_provider_create", + "parameters": [ + { + "in": "path", + "name": "silo_name", + "description": "The silo's unique name.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SamlIdentityProviderCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SamlIdentityProvider" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/silos/{silo_name}/saml_identity_providers/{provider_name}": { + "get": { + "tags": [ + "silos" + ], + "summary": "GET a silo's SAML identity provider", + "operationId": "silo_identity_provider_view", + "parameters": [ + { + "in": "path", + "name": "provider_name", + "description": "The SAML identity provider's name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "silo_name", + "description": "The silo's unique name.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SamlIdentityProvider" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/system/user": { + "get": { + "tags": [ + "system" + ], + "summary": "List the built-in system users", + "operationId": "system_user_list", + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "style": "form" + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + }, + "style": "form" + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/NameSortMode" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserBuiltinResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": true + } + }, + "/system/user/{user_name}": { + "get": { + "tags": [ + "system" + ], + "summary": "Fetch a specific built-in system user", + "operationId": "system_user_view", + "parameters": [ + { + "in": "path", + "name": "user_name", + "description": "The built-in user's unique name.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserBuiltin" } } } @@ -5088,7 +6071,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -5140,10 +6123,10 @@ "/users": { "get": { "tags": [ - "users" + "silos" ], - "summary": "List the built-in system users", - "operationId": "users_get", + "summary": "List users", + "operationId": "user_list", "parameters": [ { "in": "query", @@ -5160,7 +6143,7 @@ { "in": "query", "name": "page_token", - "description": "Token returned by previous call to retreive the subsequent page", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { "nullable": true, "type": "string" @@ -5171,7 +6154,7 @@ "in": "query", "name": "sort_by", "schema": { - "$ref": "#/components/schemas/NameSortMode" + "$ref": "#/components/schemas/IdSortMode" }, "style": "form" } @@ -5196,45 +6179,6 @@ }, "x-dropshot-pagination": true } - }, - "/users/{user_name}": { - "get": { - "tags": [ - "users" - ], - "summary": "Fetch a specific built-in system user", - "operationId": "users_get_user", - "parameters": [ - { - "in": "path", - "name": "user_name", - "description": "The built-in user's unique name.", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - }, - "style": "simple" - } - ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - } } }, "components": { @@ -5281,6 +6225,66 @@ "histogram_f64" ] }, + "DerEncodedKeyPair": { + "type": "object", + "properties": { + "private_key": { + "description": "request signing private key (base64 encoded der file)", + "type": "string" + }, + "public_cert": { + "description": "request signing public certificate (base64 encoded der file)", + "type": "string" + } + }, + "required": [ + "private_key", + "public_cert" + ] + }, + "DeviceAccessTokenRequest": { + "type": "object", + "properties": { + "client_id": { + "type": "string", + "format": "uuid" + }, + "device_code": { + "type": "string" + }, + "grant_type": { + "type": "string" + } + }, + "required": [ + "client_id", + "device_code", + "grant_type" + ] + }, + "DeviceAuthRequest": { + "type": "object", + "properties": { + "client_id": { + "type": "string", + "format": "uuid" + } + }, + "required": [ + "client_id" + ] + }, + "DeviceAuthVerify": { + "type": "object", + "properties": { + "user_code": { + "type": "string" + } + }, + "required": [ + "user_code" + ] + }, "Digest": { "oneOf": [ { @@ -5304,7 +6308,7 @@ ] }, "Disk": { - "description": "Client view of an [`Disk`]", + "description": "Client view of a [`Disk`]", "type": "object", "properties": { "block_size": { @@ -5655,6 +6659,28 @@ } ] }, + "Distribution": { + "description": "OS image distribution", + "type": "object", + "properties": { + "name": { + "description": "The name of the distribution (e.g. \"alpine\" or \"ubuntu\")", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "version": { + "description": "The version of the distribution (e.g. \"3.10\" or \"18.04\")", + "type": "string" + } + }, + "required": [ + "name", + "version" + ] + }, "Error": { "description": "Error information from a response.", "type": "object", @@ -5713,7 +6739,7 @@ "bool" ] }, - "FleetRoles": { + "FleetRole": { "type": "string", "enum": [ "admin", @@ -5721,7 +6747,7 @@ "viewer" ] }, - "FleetRolesPolicy": { + "FleetRolePolicy": { "description": "Client view of a [`Policy`], which describes how this resource may be accessed\n\nNote that the Policy only describes access granted explicitly for this resource. The policies of parent resources can also cause a user to have access to this resource.", "type": "object", "properties": { @@ -5729,7 +6755,7 @@ "description": "Roles directly assigned on this resource", "type": "array", "items": { - "$ref": "#/components/schemas/FleetRolesRoleAssignment" + "$ref": "#/components/schemas/FleetRoleRoleAssignment" } } }, @@ -5737,7 +6763,7 @@ "role_assignments" ] }, - "FleetRolesRoleAssignment": { + "FleetRoleRoleAssignment": { "description": "Describes the assignment of a particular role on a particular resource to a particular identity (user, group, etc.)\n\nThe resource is not part of this structure. Rather, [`RoleAssignment`]s are put into a [`Policy`] and that Policy is applied to a particular resource.", "type": "object", "properties": { @@ -5749,7 +6775,7 @@ "$ref": "#/components/schemas/IdentityType" }, "role_name": { - "$ref": "#/components/schemas/FleetRoles" + "$ref": "#/components/schemas/FleetRole" } }, "required": [ @@ -5783,6 +6809,10 @@ } ] }, + "distribution": { + "description": "Image distribution", + "type": "string" + }, "id": { "description": "unique, immutable, system-controlled identifier for each resource", "type": "string", @@ -5820,19 +6850,63 @@ "type": "string" }, "version": { - "nullable": true, - "description": "Version of this, if any", + "description": "Image version", "type": "string" } }, "required": [ "block_size", "description", + "distribution", "id", "name", "size", "time_created", - "time_modified" + "time_modified", + "version" + ] + }, + "GlobalImageCreate": { + "description": "Create-time parameters for an [`GlobalImage`](omicron_common::api::external::GlobalImage)", + "type": "object", + "properties": { + "block_size": { + "description": "block size in bytes", + "allOf": [ + { + "$ref": "#/components/schemas/BlockSize" + } + ] + }, + "description": { + "type": "string" + }, + "distribution": { + "description": "OS image distribution", + "allOf": [ + { + "$ref": "#/components/schemas/Distribution" + } + ] + }, + "name": { + "$ref": "#/components/schemas/Name" + }, + "source": { + "description": "The source of the image's contents.", + "allOf": [ + { + "$ref": "#/components/schemas/ImageSource" + } + ] + } + }, + "required": [ + "block_size", + "description", + "distribution", + "name", + "source" ] }, "GlobalImageResultsPage": { @@ -5856,6 +6930,82 @@ "items" ] }, + "IdentityProvider": { + "description": "Client view of an [`IdentityProvider`]", + "type": "object", + "properties": { + "description": { + "description": "human-readable free-form text about a resource", + "type": "string" + }, + "id": { + "description": "unique, immutable, system-controlled identifier for each resource", + "type": "string", + "format": "uuid" + }, + "name": { + "description": "unique, mutable, user-controlled identifier for each resource", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "provider_type": { + "description": "Identity provider type", + "allOf": [ + { + "$ref": "#/components/schemas/IdentityProviderType" + } + ] + }, + "time_created": { + "description": "timestamp when this resource was created", + "type": "string", + "format": "date-time" + }, + "time_modified": { + "description": "timestamp when this resource was last modified", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "description", + "id", + "name", + "provider_type", + "time_created", + "time_modified" + ] + }, + "IdentityProviderResultsPage": { + "description": "A single page of results", + "type": "object", + "properties": { + "items": { + "description": "list of items on this page of results", + "type": "array", + "items": { + "$ref": "#/components/schemas/IdentityProvider" + } + }, + "next_page": { + "nullable": true, + "description": "token used to fetch the next page of results (if any)", + "type": "string" + } + }, + "required": [ + "items" + ] + }, + "IdentityProviderType": { + "type": "string", + "enum": [ + "saml" + ] + }, "IdentityType": { "description": "Describes what kind of identity is described by an id", "type": "string", @@ -5863,6 +7013,46 @@ "silo_user" ] }, + "IdpMetadataSource": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "url" + ] + }, + "url": { + "type": "string" + } + }, + "required": [ + "type", + "url" + ] + }, + { + "type": "object", + "properties": { + "data": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "base64_encoded_xml" + ] + } + }, + "required": [ + "data", + "type" + ] + } + ] + }, "Image": { "description": "Client view of project Images", "type": "object", @@ -6007,25 +7197,25 @@ { "type": "object", "properties": { - "src": { - "type": "string" - }, "type": { "type": "string", "enum": [ "url" ] + }, + "url": { + "type": "string" } }, "required": [ - "src", - "type" + "type", + "url" ] }, { "type": "object", "properties": { - "src": { + "id": { "type": "string", "format": "uuid" }, @@ -6037,7 +7227,22 @@ } }, "required": [ - "src", + "id", + "type" + ] + }, + { + "description": "Boot the Alpine ISO that ships with the Propolis zone. Intended for development purposes only.", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "you_can_boot_anything_as_long_as_its_alpine" + ] + } + }, + "required": [ "type" ] } @@ -6253,20 +7458,20 @@ "description": "Migration parameters for an [`Instance`](omicron_common::api::external::Instance)", "type": "object", "properties": { - "dst_sled_uuid": { + "dst_sled_id": { "type": "string", "format": "uuid" } }, "required": [ - "dst_sled_uuid" + "dst_sled_id" ] }, "InstanceNetworkInterfaceAttachment": { "description": "Describes an attachment of a `NetworkInterface` to an `Instance`, at the time the instance is created.", "oneOf": [ { - "description": "Create one or more `NetworkInterface`s for the `Instance`", + "description": "Create one or more `NetworkInterface`s for the `Instance`.\n\nIf more than one interface is provided, then the first will be designated the primary interface for the instance.", "type": "object", "properties": { "params": { @@ -6288,7 +7493,7 @@ ] }, { - "description": "Default networking setup, which creates a single interface with an auto-assigned IP address from project's \"default\" VPC and \"default\" VPC Subnet.", + "description": "The default networking configuration for an instance is to create a single primary interface with an automatically-assigned IP address. The IP will be pulled from the Project's default VPC / VPC Subnet.", "type": "object", "properties": { "type": { @@ -6340,6 +7545,31 @@ "items" ] }, + "InstanceSerialConsoleData": { + "description": "Contents of an Instance's serial console buffer.", + "type": "object", + "properties": { + "data": { + "description": "The bytes starting from the requested offset up to either the end of the buffer or the request's `max_bytes`. Provided as a u8 array rather than a string, as it may not be UTF-8.", + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0 + } + }, + "last_byte_offset": { + "description": "The absolute offset since boot (suitable for use as `byte_offset` in a subsequent request) of the last byte returned in `data`.", + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "data", + "last_byte_offset" + ] + }, "InstanceState": { "description": "Running state of an Instance (primarily: booted or stopped)\n\nThis typically reflects whether it's starting, running, stopping, or stopped, but also includes states related to the Instance's lifecycle", "type": "string", @@ -6376,6 +7606,163 @@ } ] }, + "IpPool": { + "description": "Identity-related metadata that's included in nearly all public API objects", + "type": "object", + "properties": { + "description": { + "description": "human-readable free-form text about a resource", + "type": "string" + }, + "id": { + "description": "unique, immutable, system-controlled identifier for each resource", + "type": "string", + "format": "uuid" + }, + "name": { + "description": "unique, mutable, user-controlled identifier for each resource", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "time_created": { + "description": "timestamp when this resource was created", + "type": "string", + "format": "date-time" + }, + "time_modified": { + "description": "timestamp when this resource was last modified", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "description", + "id", + "name", + "time_created", + "time_modified" + ] + }, + "IpPoolCreate": { + "description": "Create-time parameters for an IP Pool.\n\nSee [`IpPool`](omicron_nexus::external_api::views::IpPool)", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "name": { + "$ref": "#/components/schemas/Name" + } + }, + "required": [ + "description", + "name" + ] + }, + "IpPoolRange": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "range": { + "$ref": "#/components/schemas/IpRange" + }, + "time_created": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "id", + "range", + "time_created" + ] + }, + "IpPoolRangeResultsPage": { + "description": "A single page of results", + "type": "object", + "properties": { + "items": { + "description": "list of items on this page of results", + "type": "array", + "items": { + "$ref": "#/components/schemas/IpPoolRange" + } + }, + "next_page": { + "nullable": true, + "description": "token used to fetch the next page of results (if any)", + "type": "string" + } + }, + "required": [ + "items" + ] + }, + "IpPoolResultsPage": { + "description": "A single page of results", + "type": "object", + "properties": { + "items": { + "description": "list of items on this page of results", + "type": "array", + "items": { + "$ref": "#/components/schemas/IpPool" + } + }, + "next_page": { + "nullable": true, + "description": "token used to fetch the next page of results (if any)", + "type": "string" + } + }, + "required": [ + "items" + ] + }, + "IpPoolUpdate": { + "description": "Parameters for updating an IP Pool", + "type": "object", + "properties": { + "description": { + "nullable": true, + "type": "string" + }, + "name": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + } + } + }, + "IpRange": { + "oneOf": [ + { + "title": "v4", + "allOf": [ + { + "$ref": "#/components/schemas/Ipv4Range" + } + ] + }, + { + "title": "v6", + "allOf": [ + { + "$ref": "#/components/schemas/Ipv6Range" + } + ] + } + ] + }, "Ipv4Net": { "example": "192.168.1.0/24", "title": "An IPv4 subnet", @@ -6384,6 +7771,24 @@ "pattern": "(^(10\\.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9]\\.){2}(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])/(1[0-9]|2[0-8]|[8-9]))$)|(^(172\\.16\\.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])\\.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])/(1[2-9]|2[0-8]))$)|(^(192\\.168\\.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])\\.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])/(1[6-9]|2[0-8]))$)", "maxLength": 18 }, + "Ipv4Range": { + "description": "A non-decreasing IPv4 address range, inclusive of both ends.\n\nThe first address must be less than or equal to the last address.", + "type": "object", + "properties": { + "first": { + "type": "string", + "format": "ipv4" + }, + "last": { + "type": "string", + "format": "ipv4" + } + }, + "required": [ + "first", + "last" + ] + }, "Ipv6Net": { "example": "fd12:3456::/64", "title": "An IPv6 subnet", @@ -6392,6 +7797,24 @@ "pattern": "^(fd|FD)[0-9a-fA-F]{2}:((([0-9a-fA-F]{1,4}\\:){6}[0-9a-fA-F]{1,4})|(([0-9a-fA-F]{1,4}:){1,6}:))/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$", "maxLength": 43 }, + "Ipv6Range": { + "description": "A non-decreasing IPv6 address range, inclusive of both ends.\n\nThe first address must be less than or equal to the last address.", + "type": "object", + "properties": { + "first": { + "type": "string", + "format": "ipv6" + }, + "last": { + "type": "string", + "format": "ipv6" + } + }, + "required": [ + "first", + "last" + ] + }, "L4PortRange": { "example": "22", "title": "A range of IP ports", @@ -6401,17 +7824,6 @@ "minLength": 1, "maxLength": 11 }, - "LoginParams": { - "type": "object", - "properties": { - "username": { - "type": "string" - } - }, - "required": [ - "username" - ] - }, "MacAddr": { "example": "ff:ff:ff:ff:ff:ff", "title": "A MAC address", @@ -6467,6 +7879,10 @@ } ] }, + "primary": { + "description": "True if this interface is the primary for the instance to which it's attached.", + "type": "boolean" + }, "subnet_id": { "description": "The subnet to which the interface belongs.", "type": "string", @@ -6495,6 +7911,7 @@ "ip", "mac", "name", + "primary", "subnet_id", "time_created", "time_modified", @@ -6562,6 +7979,29 @@ "items" ] }, + "NetworkInterfaceUpdate": { + "description": "Parameters for updating a [`NetworkInterface`](omicron_common::api::external::NetworkInterface).\n\nNote that modifying IP addresses for an interface is not yet supported, a new interface must be created instead.", + "type": "object", + "properties": { + "description": { + "nullable": true, + "type": "string" + }, + "make_primary": { + "description": "Make a secondary interface the instance's primary interface.\n\nIf applied to a secondary interface, that interface will become the primary on the next reboot of the instance. Note that this may have implications for routing between instances, as the new primary interface will be on a distinct subnet from the previous primary interface.\n\nNote that this can only be used to select a new primary interface for an instance. Requests to change the primary interface into a secondary will return an error.", + "default": false, + "type": "boolean" + }, + "name": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + } + } + }, "Organization": { "description": "Client view of an [`Organization`]", "type": "object", @@ -6639,14 +8079,15 @@ "items" ] }, - "OrganizationRoles": { + "OrganizationRole": { "type": "string", "enum": [ "admin", - "collaborator" + "collaborator", + "viewer" ] }, - "OrganizationRolesPolicy": { + "OrganizationRolePolicy": { "description": "Client view of a [`Policy`], which describes how this resource may be accessed\n\nNote that the Policy only describes access granted explicitly for this resource. The policies of parent resources can also cause a user to have access to this resource.", "type": "object", "properties": { @@ -6654,7 +8095,7 @@ "description": "Roles directly assigned on this resource", "type": "array", "items": { - "$ref": "#/components/schemas/OrganizationRolesRoleAssignment" + "$ref": "#/components/schemas/OrganizationRoleRoleAssignment" } } }, @@ -6662,7 +8103,7 @@ "role_assignments" ] }, - "OrganizationRolesRoleAssignment": { + "OrganizationRoleRoleAssignment": { "description": "Describes the assignment of a particular role on a particular resource to a particular identity (user, group, etc.)\n\nThe resource is not part of this structure. Rather, [`RoleAssignment`]s are put into a [`Policy`] and that Policy is applied to a particular resource.", "type": "object", "properties": { @@ -6674,7 +8115,7 @@ "$ref": "#/components/schemas/IdentityType" }, "role_name": { - "$ref": "#/components/schemas/OrganizationRoles" + "$ref": "#/components/schemas/OrganizationRole" } }, "required": [ @@ -6783,7 +8224,7 @@ "items" ] }, - "ProjectRoles": { + "ProjectRole": { "type": "string", "enum": [ "admin", @@ -6791,7 +8232,7 @@ "viewer" ] }, - "ProjectRolesPolicy": { + "ProjectRolePolicy": { "description": "Client view of a [`Policy`], which describes how this resource may be accessed\n\nNote that the Policy only describes access granted explicitly for this resource. The policies of parent resources can also cause a user to have access to this resource.", "type": "object", "properties": { @@ -6799,7 +8240,7 @@ "description": "Roles directly assigned on this resource", "type": "array", "items": { - "$ref": "#/components/schemas/ProjectRolesRoleAssignment" + "$ref": "#/components/schemas/ProjectRoleRoleAssignment" } } }, @@ -6807,7 +8248,7 @@ "role_assignments" ] }, - "ProjectRolesRoleAssignment": { + "ProjectRoleRoleAssignment": { "description": "Describes the assignment of a particular role on a particular resource to a particular identity (user, group, etc.)\n\nThe resource is not part of this structure. Rather, [`RoleAssignment`]s are put into a [`Policy`] and that Policy is applied to a particular resource.", "type": "object", "properties": { @@ -6819,7 +8260,7 @@ "$ref": "#/components/schemas/IdentityType" }, "role_name": { - "$ref": "#/components/schemas/ProjectRoles" + "$ref": "#/components/schemas/ProjectRole" } }, "required": [ @@ -6850,23 +8291,11 @@ "description": "Client view of an [`Rack`]", "type": "object", "properties": { - "description": { - "description": "human-readable free-form text about a resource", - "type": "string" - }, "id": { "description": "unique, immutable, system-controlled identifier for each resource", "type": "string", "format": "uuid" }, - "name": { - "description": "unique, mutable, user-controlled identifier for each resource", - "allOf": [ - { - "$ref": "#/components/schemas/Name" - } - ] - }, "time_created": { "description": "timestamp when this resource was created", "type": "string", @@ -6879,9 +8308,7 @@ } }, "required": [ - "description", "id", - "name", "time_created", "time_modified" ] @@ -7459,6 +8886,135 @@ } ] }, + "SamlIdentityProvider": { + "description": "Identity-related metadata that's included in nearly all public API objects", + "type": "object", + "properties": { + "acs_url": { + "description": "service provider endpoint where the response will be sent", + "type": "string" + }, + "description": { + "description": "human-readable free-form text about a resource", + "type": "string" + }, + "id": { + "description": "unique, immutable, system-controlled identifier for each resource", + "type": "string", + "format": "uuid" + }, + "idp_entity_id": { + "description": "idp's entity id", + "type": "string" + }, + "name": { + "description": "unique, mutable, user-controlled identifier for each resource", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "public_cert": { + "nullable": true, + "description": "optional request signing public certificate (base64 encoded der file)", + "type": "string" + }, + "slo_url": { + "description": "service provider endpoint where the idp should send log out requests", + "type": "string" + }, + "sp_client_id": { + "description": "sp's client id", + "type": "string" + }, + "technical_contact_email": { + "description": "customer's technical contact for saml configuration", + "type": "string" + }, + "time_created": { + "description": "timestamp when this resource was created", + "type": "string", + "format": "date-time" + }, + "time_modified": { + "description": "timestamp when this resource was last modified", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "acs_url", + "description", + "id", + "idp_entity_id", + "name", + "slo_url", + "sp_client_id", + "technical_contact_email", + "time_created", + "time_modified" + ] + }, + "SamlIdentityProviderCreate": { + "description": "Create-time identity-related parameters", + "type": "object", + "properties": { + "acs_url": { + "description": "service provider endpoint where the response will be sent", + "type": "string" + }, + "description": { + "type": "string" + }, + "idp_entity_id": { + "description": "idp's entity id", + "type": "string" + }, + "idp_metadata_source": { + "description": "the source of an identity provider metadata descriptor", + "allOf": [ + { + "$ref": "#/components/schemas/IdpMetadataSource" + } + ] + }, + "name": { + "$ref": "#/components/schemas/Name" + }, + "signing_keypair": { + "nullable": true, + "description": "optional request signing key pair", + "allOf": [ + { + "$ref": "#/components/schemas/DerEncodedKeyPair" + } + ] + }, + "slo_url": { + "description": "service provider endpoint where the idp should send log out requests", + "type": "string" + }, + "sp_client_id": { + "description": "sp's client id", + "type": "string" + }, + "technical_contact_email": { + "description": "customer's technical contact for saml configuration", + "type": "string" + } + }, + "required": [ + "acs_url", + "description", + "idp_entity_id", + "idp_metadata_source", + "name", + "slo_url", + "sp_client_id", + "technical_contact_email" + ] + }, "SessionUser": { "description": "Client view of currently authed user.", "type": "object", @@ -7506,6 +9062,14 @@ "description": "timestamp when this resource was last modified", "type": "string", "format": "date-time" + }, + "user_provision_type": { + "description": "User provision type", + "allOf": [ + { + "$ref": "#/components/schemas/UserProvisionType" + } + ] } }, "required": [ @@ -7514,7 +9078,8 @@ "id", "name", "time_created", - "time_modified" + "time_modified", + "user_provision_type" ] }, "SiloCreate": { @@ -7529,12 +9094,16 @@ }, "name": { "$ref": "#/components/schemas/Name" + }, + "user_provision_type": { + "$ref": "#/components/schemas/UserProvisionType" } }, "required": [ "description", "discoverable", - "name" + "name", + "user_provision_type" ] }, "SiloResultsPage": { @@ -7558,7 +9127,7 @@ "items" ] }, - "SiloRoles": { + "SiloRole": { "type": "string", "enum": [ "admin", @@ -7566,7 +9135,7 @@ "viewer" ] }, - "SiloRolesPolicy": { + "SiloRolePolicy": { "description": "Client view of a [`Policy`], which describes how this resource may be accessed\n\nNote that the Policy only describes access granted explicitly for this resource. The policies of parent resources can also cause a user to have access to this resource.", "type": "object", "properties": { @@ -7574,7 +9143,7 @@ "description": "Roles directly assigned on this resource", "type": "array", "items": { - "$ref": "#/components/schemas/SiloRolesRoleAssignment" + "$ref": "#/components/schemas/SiloRoleRoleAssignment" } } }, @@ -7582,7 +9151,7 @@ "role_assignments" ] }, - "SiloRolesRoleAssignment": { + "SiloRoleRoleAssignment": { "description": "Describes the assignment of a particular role on a particular resource to a particular identity (user, group, etc.)\n\nThe resource is not part of this structure. Rather, [`RoleAssignment`]s are put into a [`Policy`] and that Policy is applied to a particular resource.", "type": "object", "properties": { @@ -7594,7 +9163,7 @@ "$ref": "#/components/schemas/IdentityType" }, "role_name": { - "$ref": "#/components/schemas/SiloRoles" + "$ref": "#/components/schemas/SiloRole" } }, "required": [ @@ -7607,23 +9176,11 @@ "description": "Client view of an [`Sled`]", "type": "object", "properties": { - "description": { - "description": "human-readable free-form text about a resource", - "type": "string" - }, "id": { "description": "unique, immutable, system-controlled identifier for each resource", "type": "string", "format": "uuid" }, - "name": { - "description": "unique, mutable, user-controlled identifier for each resource", - "allOf": [ - { - "$ref": "#/components/schemas/Name" - } - ] - }, "service_address": { "type": "string" }, @@ -7639,9 +9196,7 @@ } }, "required": [ - "description", "id", - "name", "service_address", "time_created", "time_modified" @@ -7768,6 +9323,17 @@ "items" ] }, + "SpoofLoginBody": { + "type": "object", + "properties": { + "username": { + "type": "string" + } + }, + "required": [ + "username" + ] + }, "SshKey": { "description": "Client view of a [`SshKey`]", "type": "object", @@ -7919,6 +9485,24 @@ "User": { "description": "Client view of a [`User`]", "type": "object", + "properties": { + "display_name": { + "description": "Human-readable name that can identify the user", + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + } + }, + "required": [ + "display_name", + "id" + ] + }, + "UserBuiltin": { + "description": "Client view of a [`UserBuiltin`]", + "type": "object", "properties": { "description": { "description": "human-readable free-form text about a resource", @@ -7956,6 +9540,35 @@ "time_modified" ] }, + "UserBuiltinResultsPage": { + "description": "A single page of results", + "type": "object", + "properties": { + "items": { + "description": "list of items on this page of results", + "type": "array", + "items": { + "$ref": "#/components/schemas/UserBuiltin" + } + }, + "next_page": { + "nullable": true, + "description": "token used to fetch the next page of results (if any)", + "type": "string" + } + }, + "required": [ + "items" + ] + }, + "UserProvisionType": { + "description": "How users will be provisioned in a silo during authentication.", + "type": "string", + "enum": [ + "fixed", + "jit" + ] + }, "UserResultsPage": { "description": "A single page of results", "type": "object", @@ -8874,6 +10487,13 @@ "url": "http://oxide.computer/docs/#xxx" } }, + { + "name": "hardware", + "description": "These operations pertain to hardware inventory and management. Racks are the unit of expansion of an Oxide deployment. Racks are in turn composed of sleds, switches, power supplies, and a cabled backplane.", + "externalDocs": { + "url": "http://oxide.computer/docs/#xxx" + } + }, { "name": "hidden", "description": "TODO operations that will not ship to customers", @@ -8902,6 +10522,20 @@ "url": "http://oxide.computer/docs/#xxx" } }, + { + "name": "ip-pools", + "description": "IP Pools contain external IP addresses that can be assigned to virtual machine Instances.", + "externalDocs": { + "url": "http://oxide.computer/docs/#xxx" + } + }, + { + "name": "login", + "description": "Authentication endpoints", + "externalDocs": { + "url": "http://oxide.computer/docs/#xxx" + } + }, { "name": "metrics", "description": "Metrics provide insight into the operation of the Oxide deployment. These include telemetry on hardware and software components that can be used to understand the current state as well as to diagnose issues.", @@ -8930,13 +10564,6 @@ "url": "http://oxide.computer/docs/#xxx" } }, - { - "name": "racks", - "description": "These operations pertain to hardware inventory and management. Racks are the unit of expansion of an Oxide deployment. Racks are in turn composed of sleds, switches, power supplies, and a cabled backplane.", - "externalDocs": { - "url": "http://oxide.computer/docs/#xxx" - } - }, { "name": "roles", "description": "Roles are a component of Identity and Access Management (IAM) that allow a user or agent account access to additional permissions.", @@ -8966,15 +10593,15 @@ } }, { - "name": "silos", - "description": "Silos represent a logical partition of users and resources.", + "name": "session", + "description": "Information pertaining to the current session.", "externalDocs": { "url": "http://oxide.computer/docs/#xxx" } }, { - "name": "sleds", - "description": "This tag should be moved into hardware", + "name": "silos", + "description": "Silos represent a logical partition of users and resources.", "externalDocs": { "url": "http://oxide.computer/docs/#xxx" } @@ -8986,13 +10613,6 @@ "url": "http://oxide.computer/docs/#xxx" } }, - { - "name": "sshkeys", - "description": "Public SSH keys for an individual user", - "externalDocs": { - "url": "http://oxide.computer/docs/#xxx" - } - }, { "name": "subnets", "description": "This tag should be moved into a generic network tag", @@ -9001,15 +10621,15 @@ } }, { - "name": "updates", - "description": "This tag should be moved into a operations tag", + "name": "system", + "description": "Internal system information", "externalDocs": { "url": "http://oxide.computer/docs/#xxx" } }, { - "name": "users", - "description": "This tag should be moved into an IAM tag", + "name": "updates", + "description": "This tag should be moved into a operations tag", "externalDocs": { "url": "http://oxide.computer/docs/#xxx" }