From 9b6c9bbfbf9aad11da0d3f2635cb44d9182ab5a7 Mon Sep 17 00:00:00 2001 From: "oxide-reflector-bot[bot]" <130185838+oxide-reflector-bot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 21:43:59 -0800 Subject: [PATCH] Bump dependencies, progenitor to 90d3282f, oxide.json to omicron:4ab41a07 (#578) * Rebuilt with latest dependency updates * Rebuilt with latest dependency updates * Rebuilt with latest dependency updates * Rebuilt with latest dependency updates * Rebuilt with latest dependency updates * Rebuilt with latest dependency updates * sync --------- Co-authored-by: oxide-reflector-bot[bot] <130185838+oxide-reflector-bot[bot]@users.noreply.github.com> Co-authored-by: Adam H. Leventhal --- Cargo.lock | 88 +++++---- cli/docs/cli.json | 28 +++ cli/src/cli_builder.rs | 10 +- cli/src/generated_cli.rs | 99 +++++++++++ oxide.json | 72 ++++++++ sdk-httpmock/src/generated_httpmock.rs | 96 ++++++++++ sdk/src/generated_sdk.rs | 236 +++++++++++++++++++++++++ 7 files changed, 587 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a49f325..2f315bd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -349,7 +349,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -366,7 +366,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -586,7 +586,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -866,7 +866,7 @@ dependencies = [ "quote", "serde", "serde_tokenstream", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -1149,7 +1149,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -1959,7 +1959,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -1999,9 +1999,9 @@ dependencies = [ "clap", "dirs", "futures", - "progenitor-client 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "progenitor-client 0.5.0", "rand", - "regress", + "regress 0.8.0", "reqwest", "schemars", "serde", @@ -2163,7 +2163,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2300,10 +2300,10 @@ dependencies = [ [[package]] name = "progenitor" -version = "0.5.0" -source = "git+https://github.com/oxidecomputer/progenitor#08bbafc251d3d6828ca5921d1658c3d12d64fe7c" +version = "0.6.0" +source = "git+https://github.com/oxidecomputer/progenitor#90d3282f488a17f9c85e25c26845fef2d92af435" dependencies = [ - "progenitor-client 0.5.0 (git+https://github.com/oxidecomputer/progenitor)", + "progenitor-client 0.6.0", "progenitor-impl", "progenitor-macro", "serde_json", @@ -2326,8 +2326,8 @@ dependencies = [ [[package]] name = "progenitor-client" -version = "0.5.0" -source = "git+https://github.com/oxidecomputer/progenitor#08bbafc251d3d6828ca5921d1658c3d12d64fe7c" +version = "0.6.0" +source = "git+https://github.com/oxidecomputer/progenitor#90d3282f488a17f9c85e25c26845fef2d92af435" dependencies = [ "bytes", "futures-core", @@ -2340,8 +2340,8 @@ dependencies = [ [[package]] name = "progenitor-impl" -version = "0.5.0" -source = "git+https://github.com/oxidecomputer/progenitor#08bbafc251d3d6828ca5921d1658c3d12d64fe7c" +version = "0.6.0" +source = "git+https://github.com/oxidecomputer/progenitor#90d3282f488a17f9c85e25c26845fef2d92af435" dependencies = [ "getopts", "heck", @@ -2354,7 +2354,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "syn 2.0.51", + "syn 2.0.52", "thiserror", "typify", "unicode-ident", @@ -2362,8 +2362,8 @@ dependencies = [ [[package]] name = "progenitor-macro" -version = "0.5.0" -source = "git+https://github.com/oxidecomputer/progenitor#08bbafc251d3d6828ca5921d1658c3d12d64fe7c" +version = "0.6.0" +source = "git+https://github.com/oxidecomputer/progenitor#90d3282f488a17f9c85e25c26845fef2d92af435" dependencies = [ "openapiv3", "proc-macro2", @@ -2374,7 +2374,7 @@ dependencies = [ "serde_json", "serde_tokenstream", "serde_yaml", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2493,6 +2493,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "regress" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d06f9a1f7cd8473611ba1a480cf35f9c5cffc2954336ba90a982fdb7e7d7f51e" +dependencies = [ + "hashbrown", + "memchr", +] + [[package]] name = "reqwest" version = "0.11.24" @@ -2804,7 +2814,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2867,7 +2877,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3095,9 +3105,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.51" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -3213,7 +3223,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3324,7 +3334,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3457,7 +3467,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3512,8 +3522,8 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typify" -version = "0.0.15" -source = "git+https://github.com/oxidecomputer/typify#78dcbffb83d9faa88153b33503d64c23ec090b95" +version = "0.0.16" +source = "git+https://github.com/oxidecomputer/typify#c5ebe0a2bf08ad8a743be5b593b1a8526a3fff4a" dependencies = [ "typify-impl", "typify-macro", @@ -3521,25 +3531,25 @@ dependencies = [ [[package]] name = "typify-impl" -version = "0.0.15" -source = "git+https://github.com/oxidecomputer/typify#78dcbffb83d9faa88153b33503d64c23ec090b95" +version = "0.0.16" +source = "git+https://github.com/oxidecomputer/typify#c5ebe0a2bf08ad8a743be5b593b1a8526a3fff4a" dependencies = [ "heck", "log", "proc-macro2", "quote", - "regress", + "regress 0.9.0", "schemars", "serde_json", - "syn 2.0.51", + "syn 2.0.52", "thiserror", "unicode-ident", ] [[package]] name = "typify-macro" -version = "0.0.15" -source = "git+https://github.com/oxidecomputer/typify#78dcbffb83d9faa88153b33503d64c23ec090b95" +version = "0.0.16" +source = "git+https://github.com/oxidecomputer/typify#c5ebe0a2bf08ad8a743be5b593b1a8526a3fff4a" dependencies = [ "proc-macro2", "quote", @@ -3547,7 +3557,7 @@ dependencies = [ "serde", "serde_json", "serde_tokenstream", - "syn 2.0.51", + "syn 2.0.52", "typify-impl", ] @@ -3730,7 +3740,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", "wasm-bindgen-shared", ] @@ -3764,7 +3774,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4040,7 +4050,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] diff --git a/cli/docs/cli.json b/cli/docs/cli.json index 2e6909de..2eceb36d 100644 --- a/cli/docs/cli.json +++ b/cli/docs/cli.json @@ -714,6 +714,34 @@ } ] }, + { + "name": "update", + "about": "Update floating IP", + "args": [ + { + "long": "description" + }, + { + "long": "floating-ip", + "help": "Name or ID of the floating IP" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "name" + }, + { + "long": "project", + "help": "Name or ID of the project" + } + ] + }, { "name": "view", "about": "Fetch floating IP", diff --git a/cli/src/cli_builder.rs b/cli/src/cli_builder.rs index 00dd8aa1..adad0d4c 100644 --- a/cli/src/cli_builder.rs +++ b/cli/src/cli_builder.rs @@ -428,6 +428,8 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { CliCommand::DiskFinalizeImport => Some("disk import finalize"), CliCommand::GroupList => Some("group list"), + + // Subcommand: instance CliCommand::InstanceDiskList => Some("instance disk list"), CliCommand::InstanceDiskAttach => Some("instance disk attach"), CliCommand::InstanceDiskDetach => Some("instance disk detach"), @@ -436,6 +438,7 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { CliCommand::InstanceNetworkInterfaceView => Some("instance nic view"), CliCommand::InstanceNetworkInterfaceUpdate => Some("instance nic update"), CliCommand::InstanceNetworkInterfaceDelete => Some("instance nic delete"), + CliCommand::PolicyView => Some("policy view"), CliCommand::PolicyUpdate => Some("policy update"), CliCommand::SnapshotList => Some("snapshot list"), @@ -470,12 +473,13 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { CliCommand::CurrentUserSshKeyView => Some("current-user ssh-key view"), CliCommand::CurrentUserSshKeyDelete => Some("current-user ssh-key delete"), - CliCommand::FloatingIpView => Some("floating-ip view"), - CliCommand::FloatingIpList => Some("floating-ip list"), + CliCommand::FloatingIpAttach => Some("floating-ip attach"), CliCommand::FloatingIpCreate => Some("floating-ip create"), CliCommand::FloatingIpDelete => Some("floating-ip delete"), - CliCommand::FloatingIpAttach => Some("floating-ip attach"), CliCommand::FloatingIpDetach => Some("floating-ip detach"), + CliCommand::FloatingIpList => Some("floating-ip list"), + CliCommand::FloatingIpUpdate => Some("floating-ip update"), + CliCommand::FloatingIpView => Some("floating-ip view"), CliCommand::Ping => Some("ping"), diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index 421964c4..06676c5f 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -33,6 +33,7 @@ impl Cli { CliCommand::FloatingIpList => Self::cli_floating_ip_list(), CliCommand::FloatingIpCreate => Self::cli_floating_ip_create(), CliCommand::FloatingIpView => Self::cli_floating_ip_view(), + CliCommand::FloatingIpUpdate => Self::cli_floating_ip_update(), CliCommand::FloatingIpDelete => Self::cli_floating_ip_delete(), CliCommand::FloatingIpAttach => Self::cli_floating_ip_attach(), CliCommand::FloatingIpDetach => Self::cli_floating_ip_detach(), @@ -881,6 +882,51 @@ impl Cli { .about("Fetch floating IP") } + pub fn cli_floating_ip_update() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("description") + .long("description") + .value_parser(clap::value_parser!(String)) + .required(false), + ) + .arg( + clap::Arg::new("floating-ip") + .long("floating-ip") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("Name or ID of the floating IP"), + ) + .arg( + clap::Arg::new("name") + .long("name") + .value_parser(clap::value_parser!(types::Name)) + .required(false), + ) + .arg( + clap::Arg::new("project") + .long("project") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(false) + .help("Name or ID of the project"), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Update floating IP") + } + pub fn cli_floating_ip_delete() -> clap::Command { clap::Command::new("") .arg( @@ -5224,6 +5270,7 @@ impl Cli { CliCommand::FloatingIpList => self.execute_floating_ip_list(matches).await, CliCommand::FloatingIpCreate => self.execute_floating_ip_create(matches).await, CliCommand::FloatingIpView => self.execute_floating_ip_view(matches).await, + CliCommand::FloatingIpUpdate => self.execute_floating_ip_update(matches).await, CliCommand::FloatingIpDelete => self.execute_floating_ip_delete(matches).await, CliCommand::FloatingIpAttach => self.execute_floating_ip_attach(matches).await, CliCommand::FloatingIpDetach => self.execute_floating_ip_detach(matches).await, @@ -6151,6 +6198,48 @@ impl Cli { } } + pub async fn execute_floating_ip_update( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.floating_ip_update(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("floating-ip") { + request = request.floating_ip(value.clone()); + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_floating_ip_update(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.item_success(&r); + Ok(()) + } + Err(r) => { + self.config.item_error(&r); + Err(anyhow::Error::new(r)) + } + } + } + pub async fn execute_floating_ip_delete( &self, matches: &clap::ArgMatches, @@ -11165,6 +11254,14 @@ pub trait CliConfig { Ok(()) } + fn execute_floating_ip_update( + &self, + matches: &clap::ArgMatches, + request: &mut builder::FloatingIpUpdate, + ) -> anyhow::Result<()> { + Ok(()) + } + fn execute_floating_ip_delete( &self, matches: &clap::ArgMatches, @@ -12412,6 +12509,7 @@ pub enum CliCommand { FloatingIpList, FloatingIpCreate, FloatingIpView, + FloatingIpUpdate, FloatingIpDelete, FloatingIpAttach, FloatingIpDetach, @@ -12590,6 +12688,7 @@ impl CliCommand { CliCommand::FloatingIpList, CliCommand::FloatingIpCreate, CliCommand::FloatingIpView, + CliCommand::FloatingIpUpdate, CliCommand::FloatingIpDelete, CliCommand::FloatingIpAttach, CliCommand::FloatingIpDetach, diff --git a/oxide.json b/oxide.json index b0aa84d6..3d31331a 100644 --- a/oxide.json +++ b/oxide.json @@ -964,6 +964,60 @@ } } }, + "put": { + "tags": [ + "floating-ips" + ], + "summary": "Update floating IP", + "operationId": "floating_ip_update", + "parameters": [ + { + "in": "path", + "name": "floating_ip", + "description": "Name or ID of the floating IP", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "query", + "name": "project", + "description": "Name or ID of the project", + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FloatingIpUpdate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FloatingIp" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, "delete": { "tags": [ "floating-ips" @@ -11919,6 +11973,24 @@ "items" ] }, + "FloatingIpUpdate": { + "description": "Updateable identity-related parameters", + "type": "object", + "properties": { + "description": { + "nullable": true, + "type": "string" + }, + "name": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + } + } + }, "Group": { "description": "View of a Group", "type": "object", diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index dd060516..3780a755 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -1544,6 +1544,87 @@ pub mod operations { } } + pub struct FloatingIpUpdateWhen(httpmock::When); + impl FloatingIpUpdateWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner + .method(httpmock::Method::PUT) + .path_matches(regex::Regex::new("^/v1/floating-ips/[^/]*$").unwrap()), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn floating_ip(self, value: &types::NameOrId) -> Self { + let re = + regex::Regex::new(&format!("^/v1/floating-ips/{}$", value.to_string())).unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn project<'a, T>(self, value: T) -> Self + where + T: Into>, + { + if let Some(value) = value.into() { + Self(self.0.query_param("project", value.to_string())) + } else { + Self(self.0.matches(|req| { + req.query_params + .as_ref() + .and_then(|qs| qs.iter().find(|(key, _)| key == "project")) + .is_none() + })) + } + } + + pub fn body(self, value: &types::FloatingIpUpdate) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct FloatingIpUpdateThen(httpmock::Then); + impl FloatingIpUpdateThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &types::FloatingIp) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + pub struct FloatingIpDeleteWhen(httpmock::When); impl FloatingIpDeleteWhen { pub fn new(inner: httpmock::When) -> Self { @@ -13779,6 +13860,9 @@ pub trait MockServerExt { fn floating_ip_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::FloatingIpViewWhen, operations::FloatingIpViewThen); + fn floating_ip_update(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce(operations::FloatingIpUpdateWhen, operations::FloatingIpUpdateThen); fn floating_ip_delete(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::FloatingIpDeleteWhen, operations::FloatingIpDeleteThen); @@ -14586,6 +14670,18 @@ impl MockServerExt for httpmock::MockServer { }) } + fn floating_ip_update(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce(operations::FloatingIpUpdateWhen, operations::FloatingIpUpdateThen), + { + self.mock(|when, then| { + config_fn( + operations::FloatingIpUpdateWhen::new(when), + operations::FloatingIpUpdateThen::new(then), + ) + }) + } + fn floating_ip_delete(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::FloatingIpDeleteWhen, operations::FloatingIpDeleteThen), diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index c8ba9f9c..c69c34dd 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -7164,6 +7164,52 @@ pub mod types { } } + /// Updateable identity-related parameters + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "Updateable identity-related parameters", + /// "type": "object", + /// "properties": { + /// "description": { + /// "type": [ + /// "string", + /// "null" + /// ] + /// }, + /// "name": { + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// } + /// } + /// } + /// ``` + ///
+ #[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)] + pub struct FloatingIpUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + + impl From<&FloatingIpUpdate> for FloatingIpUpdate { + fn from(value: &FloatingIpUpdate) -> Self { + value.clone() + } + } + + impl FloatingIpUpdate { + pub fn builder() -> builder::FloatingIpUpdate { + Default::default() + } + } + /// View of a Group /// ///
JSON schema @@ -25125,6 +25171,63 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct FloatingIpUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for FloatingIpUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl FloatingIpUpdate { + pub fn description(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::FloatingIpUpdate { + type Error = super::error::ConversionError; + fn try_from(value: FloatingIpUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + impl From for FloatingIpUpdate { + fn from(value: super::FloatingIpUpdate) -> Self { + Self { + description: Ok(value.description), + name: Ok(value.name), + } + } + } + #[derive(Clone, Debug)] pub struct Group { display_name: Result, @@ -36398,6 +36501,23 @@ pub trait ClientFloatingIpsExt { /// .await; /// ``` fn floating_ip_view(&self) -> builder::FloatingIpView; + /// Update floating IP + /// + /// Sends a `PUT` request to `/v1/floating-ips/{floating_ip}` + /// + /// Arguments: + /// - `floating_ip`: Name or ID of the floating IP + /// - `project`: Name or ID of the project + /// - `body` + /// ```ignore + /// let response = client.floating_ip_update() + /// .floating_ip(floating_ip) + /// .project(project) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn floating_ip_update(&self) -> builder::FloatingIpUpdate; /// Delete floating IP /// /// Sends a `DELETE` request to `/v1/floating-ips/{floating_ip}` @@ -36462,6 +36582,10 @@ impl ClientFloatingIpsExt for Client { builder::FloatingIpView::new(self) } + fn floating_ip_update(&self) -> builder::FloatingIpUpdate { + builder::FloatingIpUpdate::new(self) + } + fn floating_ip_delete(&self) -> builder::FloatingIpDelete { builder::FloatingIpDelete::new(self) } @@ -41850,6 +41974,118 @@ pub mod builder { } } + /// Builder for [`ClientFloatingIpsExt::floating_ip_update`] + /// + /// [`ClientFloatingIpsExt::floating_ip_update`]: super::ClientFloatingIpsExt::floating_ip_update + #[derive(Debug, Clone)] + pub struct FloatingIpUpdate<'a> { + client: &'a super::Client, + floating_ip: Result, + project: Result, String>, + body: Result, + } + + impl<'a> FloatingIpUpdate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + floating_ip: Err("floating_ip was not initialized".to_string()), + project: Ok(None), + body: Ok(types::builder::FloatingIpUpdate::default()), + } + } + + pub fn floating_ip(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.floating_ip = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for floating_ip failed".to_string()); + self + } + + pub fn project(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.project = value + .try_into() + .map(Some) + .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `FloatingIpUpdate` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::FloatingIpUpdate, + ) -> types::builder::FloatingIpUpdate, + { + self.body = self.body.map(f); + self + } + + /// Sends a `PUT` request to `/v1/floating-ips/{floating_ip}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + floating_ip, + project, + body, + } = self; + let floating_ip = floating_ip.map_err(Error::InvalidRequest)?; + let project = project.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::FloatingIpUpdate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/floating-ips/{}", + client.baseurl, + encode_path(&floating_ip.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &project { + query.push(("project", v.to_string())); + } + #[allow(unused_mut)] + let mut request = client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .query(&query) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + /// Builder for [`ClientFloatingIpsExt::floating_ip_delete`] /// /// [`ClientFloatingIpsExt::floating_ip_delete`]: super::ClientFloatingIpsExt::floating_ip_delete