From e4221a135050ecbc48dc1b7daf3d5297d5405250 Mon Sep 17 00:00:00 2001 From: Adam Leventhal Date: Thu, 18 Aug 2022 11:58:55 -0700 Subject: [PATCH] Typify update for builder structs (#171) --- Cargo.lock | 6 +- Cargo.toml | 5 +- progenitor-impl/src/lib.rs | 53 +- .../tests/output/buildomat-builder-tagged.out | 1131 +++ .../tests/output/buildomat-builder.out | 1131 +++ .../tests/output/keeper-builder-tagged.out | 652 ++ .../tests/output/keeper-builder.out | 652 ++ .../tests/output/nexus-builder-tagged.out | 8116 ++++++++++++++++- .../tests/output/nexus-builder.out | 8116 ++++++++++++++++- .../tests/output/nexus-positional.out | 15 +- .../tests/output/test_default_params.out | 20 +- progenitor-impl/tests/test_output.rs | 4 +- progenitor/tests/build_nexus.rs | 7 + 13 files changed, 19854 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 40ec2c5..5a23439 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1751,7 +1751,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "typify" version = "0.0.10-dev" -source = "git+https://github.com/oxidecomputer/typify#f5da2758877a94eb5c8c4bd6091d07a468e22d3b" +source = "git+https://github.com/oxidecomputer/typify#ab2d3e18f624ce4a55278c0846ebb5f936134023" dependencies = [ "typify-impl", "typify-macro", @@ -1760,7 +1760,7 @@ dependencies = [ [[package]] name = "typify-impl" version = "0.0.10-dev" -source = "git+https://github.com/oxidecomputer/typify#f5da2758877a94eb5c8c4bd6091d07a468e22d3b" +source = "git+https://github.com/oxidecomputer/typify#ab2d3e18f624ce4a55278c0846ebb5f936134023" dependencies = [ "heck", "log", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "typify-macro" version = "0.0.10-dev" -source = "git+https://github.com/oxidecomputer/typify#f5da2758877a94eb5c8c4bd6091d07a468e22d3b" +source = "git+https://github.com/oxidecomputer/typify#ab2d3e18f624ce4a55278c0846ebb5f936134023" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 1a5f501..93bbf21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,9 @@ members = [ #[patch."https://github.com/oxidecomputer/dropshot"] #dropshot = { path = "../dropshot/dropshot" } +#[patch."https://github.com/oxidecomputer/typify"] +#typify = { path = "../typify/typify" } + #[patch.crates-io] #typify = { path = "../typify/typify" } -#rustfmt-wrapper = { path = "../rustfmt-wrapper" } \ No newline at end of file +#rustfmt-wrapper = { path = "../rustfmt-wrapper" } diff --git a/progenitor-impl/src/lib.rs b/progenitor-impl/src/lib.rs index 9ee80d8..4fa0cf8 100644 --- a/progenitor-impl/src/lib.rs +++ b/progenitor-impl/src/lib.rs @@ -5,7 +5,7 @@ use proc_macro2::TokenStream; use quote::quote; use serde::Deserialize; use thiserror::Error; -use typify::TypeSpace; +use typify::{TypeSpace, TypeSpaceSettings}; use crate::to_schema::ToSchema; @@ -30,7 +30,6 @@ pub enum Error { pub type Result = std::result::Result; -#[derive(Default)] pub struct Generator { type_space: TypeSpace, settings: GenerationSettings, @@ -44,10 +43,10 @@ pub struct GenerationSettings { inner_type: Option, pre_hook: Option, post_hook: Option, - extra_derives: Vec, + extra_derives: Vec, } -#[derive(Clone, Deserialize)] +#[derive(Clone, Deserialize, PartialEq, Eq)] pub enum InterfaceStyle { Positional, Builder, @@ -101,17 +100,35 @@ impl GenerationSettings { self } - // TODO maybe change to a typify::Settings or something - pub fn with_derive(&mut self, derive: TokenStream) -> &mut Self { - self.extra_derives.push(derive); + pub fn with_derive(&mut self, derive: impl ToString) -> &mut Self { + self.extra_derives.push(derive.to_string()); self } } +impl Default for Generator { + fn default() -> Self { + Self { + type_space: TypeSpace::new( + TypeSpaceSettings::default().with_type_mod("types"), + ), + settings: Default::default(), + uses_futures: Default::default(), + } + } +} + impl Generator { pub fn new(settings: &GenerationSettings) -> Self { + let mut type_settings = TypeSpaceSettings::default(); + type_settings + .with_type_mod("types") + .with_struct_builder(settings.interface == InterfaceStyle::Builder); + settings.extra_derives.iter().for_each(|derive| { + let _ = type_settings.with_derive(derive.clone()); + }); Self { - type_space: TypeSpace::default(), + type_space: TypeSpace::new(&type_settings), settings: settings.clone(), uses_futures: false, } @@ -129,12 +146,7 @@ impl Generator { }) .collect::>(); - self.type_space.set_type_mod("types"); self.type_space.add_ref_types(schemas)?; - self.settings - .extra_derives - .iter() - .for_each(|derive| self.type_space.add_derive(derive.clone())); let raw_methods = spec .paths @@ -176,14 +188,7 @@ impl Generator { } }?; - let mut types = self - .type_space - .iter_types() - .map(|t| (t.name(), t.definition())) - .collect::>(); - types.sort_by(|(a_name, _), (b_name, _)| a_name.cmp(b_name)); - let types = types.into_iter().map(|(_, def)| def); - let shared = self.type_space.common_code(); + let types = self.type_space.to_stream(); let inner_property = self.settings.inner_type.as_ref().map(|inner| { quote! { @@ -208,15 +213,14 @@ impl Generator { #[allow(unused_imports)] use progenitor_client::{encode_path, RequestBuilderExt}; - pub mod types { use serde::{Deserialize, Serialize}; // This may be used by some impl Deserialize, but not all. #[allow(unused_imports)] use std::convert::TryFrom; - #shared - #(#types)* + + #types } #[derive(Clone, Debug)] @@ -430,6 +434,7 @@ impl Generator { deps.iter().map(ToString::to_string).collect() } + // TODO deprecate? pub fn get_type_space(&self) -> &TypeSpace { &self.type_space } diff --git a/progenitor-impl/tests/output/buildomat-builder-tagged.out b/progenitor-impl/tests/output/buildomat-builder-tagged.out index 29388d3..6f71fd3 100644 --- a/progenitor-impl/tests/output/buildomat-builder-tagged.out +++ b/progenitor-impl/tests/output/buildomat-builder-tagged.out @@ -14,6 +14,12 @@ pub mod types { pub state: String, } + impl Task { + pub fn builder() -> builder::Task { + builder::Task::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaskEvent { pub payload: String, @@ -22,6 +28,12 @@ pub mod types { pub time: chrono::DateTime, } + impl TaskEvent { + pub fn builder() -> builder::TaskEvent { + builder::TaskEvent::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaskOutput { pub id: String, @@ -29,6 +41,12 @@ pub mod types { pub size: u64, } + impl TaskOutput { + pub fn builder() -> builder::TaskOutput { + builder::TaskOutput::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaskSubmit { pub name: String, @@ -37,21 +55,45 @@ pub mod types { pub script: String, } + impl TaskSubmit { + pub fn builder() -> builder::TaskSubmit { + builder::TaskSubmit::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TaskSubmitResult { pub id: String, } + impl TaskSubmitResult { + pub fn builder() -> builder::TaskSubmitResult { + builder::TaskSubmitResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UploadedChunk { pub id: String, } + impl UploadedChunk { + pub fn builder() -> builder::UploadedChunk { + builder::UploadedChunk::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserCreate { pub name: String, } + impl UserCreate { + pub fn builder() -> builder::UserCreate { + builder::UserCreate::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserCreateResult { pub id: String, @@ -59,12 +101,24 @@ pub mod types { pub token: String, } + impl UserCreateResult { + pub fn builder() -> builder::UserCreateResult { + builder::UserCreateResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WhoamiResult { pub id: String, pub name: String, } + impl WhoamiResult { + pub fn builder() -> builder::WhoamiResult { + builder::WhoamiResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Worker { pub deleted: bool, @@ -77,6 +131,12 @@ pub mod types { pub tasks: Vec, } + impl Worker { + pub fn builder() -> builder::Worker { + builder::Worker::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerAddOutput { pub chunks: Vec, @@ -84,6 +144,12 @@ pub mod types { pub size: i64, } + impl WorkerAddOutput { + pub fn builder() -> builder::WorkerAddOutput { + builder::WorkerAddOutput::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerAppendTask { pub payload: String, @@ -91,22 +157,46 @@ pub mod types { pub time: chrono::DateTime, } + impl WorkerAppendTask { + pub fn builder() -> builder::WorkerAppendTask { + builder::WorkerAppendTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerBootstrap { pub bootstrap: String, pub token: String, } + impl WorkerBootstrap { + pub fn builder() -> builder::WorkerBootstrap { + builder::WorkerBootstrap::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerBootstrapResult { pub id: String, } + impl WorkerBootstrapResult { + pub fn builder() -> builder::WorkerBootstrapResult { + builder::WorkerBootstrapResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerCompleteTask { pub failed: bool, } + impl WorkerCompleteTask { + pub fn builder() -> builder::WorkerCompleteTask { + builder::WorkerCompleteTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerPingResult { pub poweroff: bool, @@ -114,6 +204,12 @@ pub mod types { pub task: Option, } + impl WorkerPingResult { + pub fn builder() -> builder::WorkerPingResult { + builder::WorkerPingResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerPingTask { pub id: String, @@ -121,6 +217,12 @@ pub mod types { pub script: String, } + impl WorkerPingTask { + pub fn builder() -> builder::WorkerPingTask { + builder::WorkerPingTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkerTask { pub id: String, @@ -128,10 +230,1039 @@ pub mod types { pub owner: String, } + impl WorkerTask { + pub fn builder() -> builder::WorkerTask { + builder::WorkerTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WorkersResult { pub workers: Vec, } + + impl WorkersResult { + pub fn builder() -> builder::WorkersResult { + builder::WorkersResult::default() + } + } + + mod builder { + pub struct Task { + id: Result, + name: Result, + output_rules: Result, String>, + script: Result, + state: Result, + } + + impl Default for Task { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + output_rules: Err("no value supplied for output_rules".to_string()), + script: Err("no value supplied for script".to_string()), + state: Err("no value supplied for state".to_string()), + } + } + } + + impl Task { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn output_rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.output_rules = value.try_into().map_err(|e| { + format!("error converting supplied value for output_rules: {}", e) + }); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + pub fn state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.state = value + .try_into() + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Task { + type Error = String; + fn try_from(value: Task) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + output_rules: value.output_rules?, + script: value.script?, + state: value.state?, + }) + } + } + + pub struct TaskEvent { + payload: Result, + seq: Result, + stream: Result, + time: Result, String>, + } + + impl Default for TaskEvent { + fn default() -> Self { + Self { + payload: Err("no value supplied for payload".to_string()), + seq: Err("no value supplied for seq".to_string()), + stream: Err("no value supplied for stream".to_string()), + time: Err("no value supplied for time".to_string()), + } + } + } + + impl TaskEvent { + pub fn payload(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.payload = value + .try_into() + .map_err(|e| format!("error converting supplied value for payload: {}", e)); + self + } + pub fn seq(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.seq = value + .try_into() + .map_err(|e| format!("error converting supplied value for seq: {}", e)); + self + } + pub fn stream(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.stream = value + .try_into() + .map_err(|e| format!("error converting supplied value for stream: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskEvent { + type Error = String; + fn try_from(value: TaskEvent) -> Result { + Ok(Self { + payload: value.payload?, + seq: value.seq?, + stream: value.stream?, + time: value.time?, + }) + } + } + + pub struct TaskOutput { + id: Result, + path: Result, + size: Result, + } + + impl Default for TaskOutput { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + path: Err("no value supplied for path".to_string()), + size: Err("no value supplied for size".to_string()), + } + } + } + + impl TaskOutput { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn path(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.path = value + .try_into() + .map_err(|e| format!("error converting supplied value for path: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskOutput { + type Error = String; + fn try_from(value: TaskOutput) -> Result { + Ok(Self { + id: value.id?, + path: value.path?, + size: value.size?, + }) + } + } + + pub struct TaskSubmit { + name: Result, + output_rules: Result, String>, + script: Result, + } + + impl Default for TaskSubmit { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + output_rules: Ok(Default::default()), + script: Err("no value supplied for script".to_string()), + } + } + } + + impl TaskSubmit { + 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 + } + pub fn output_rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.output_rules = value.try_into().map_err(|e| { + format!("error converting supplied value for output_rules: {}", e) + }); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskSubmit { + type Error = String; + fn try_from(value: TaskSubmit) -> Result { + Ok(Self { + name: value.name?, + output_rules: value.output_rules?, + script: value.script?, + }) + } + } + + pub struct TaskSubmitResult { + id: Result, + } + + impl Default for TaskSubmitResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + } + } + } + + impl TaskSubmitResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskSubmitResult { + type Error = String; + fn try_from(value: TaskSubmitResult) -> Result { + Ok(Self { id: value.id? }) + } + } + + pub struct UploadedChunk { + id: Result, + } + + impl Default for UploadedChunk { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + } + } + } + + impl UploadedChunk { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UploadedChunk { + type Error = String; + fn try_from(value: UploadedChunk) -> Result { + Ok(Self { id: value.id? }) + } + } + + pub struct UserCreate { + name: Result, + } + + impl Default for UserCreate { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + } + } + } + + impl UserCreate { + 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::UserCreate { + type Error = String; + fn try_from(value: UserCreate) -> Result { + Ok(Self { name: value.name? }) + } + } + + pub struct UserCreateResult { + id: Result, + name: Result, + token: Result, + } + + impl Default for UserCreateResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + token: Err("no value supplied for token".to_string()), + } + } + } + + impl UserCreateResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn token(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.token = value + .try_into() + .map_err(|e| format!("error converting supplied value for token: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UserCreateResult { + type Error = String; + fn try_from(value: UserCreateResult) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + token: value.token?, + }) + } + } + + pub struct WhoamiResult { + id: Result, + name: Result, + } + + impl Default for WhoamiResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl WhoamiResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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::WhoamiResult { + type Error = String; + fn try_from(value: WhoamiResult) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + }) + } + } + + pub struct Worker { + deleted: Result, + id: Result, + instance_id: Result, String>, + lastping: Result>, String>, + recycle: Result, + tasks: Result, String>, + } + + impl Default for Worker { + fn default() -> Self { + Self { + deleted: Err("no value supplied for deleted".to_string()), + id: Err("no value supplied for id".to_string()), + instance_id: Ok(Default::default()), + lastping: Ok(Default::default()), + recycle: Err("no value supplied for recycle".to_string()), + tasks: Err("no value supplied for tasks".to_string()), + } + } + } + + impl Worker { + pub fn deleted(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.deleted = value + .try_into() + .map_err(|e| format!("error converting supplied value for deleted: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn instance_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.instance_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for instance_id: {}", e)); + self + } + pub fn lastping(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.lastping = value + .try_into() + .map_err(|e| format!("error converting supplied value for lastping: {}", e)); + self + } + pub fn recycle(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.recycle = value + .try_into() + .map_err(|e| format!("error converting supplied value for recycle: {}", e)); + self + } + pub fn tasks(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.tasks = value + .try_into() + .map_err(|e| format!("error converting supplied value for tasks: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Worker { + type Error = String; + fn try_from(value: Worker) -> Result { + Ok(Self { + deleted: value.deleted?, + id: value.id?, + instance_id: value.instance_id?, + lastping: value.lastping?, + recycle: value.recycle?, + tasks: value.tasks?, + }) + } + } + + pub struct WorkerAddOutput { + chunks: Result, String>, + path: Result, + size: Result, + } + + impl Default for WorkerAddOutput { + fn default() -> Self { + Self { + chunks: Err("no value supplied for chunks".to_string()), + path: Err("no value supplied for path".to_string()), + size: Err("no value supplied for size".to_string()), + } + } + } + + impl WorkerAddOutput { + pub fn chunks(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.chunks = value + .try_into() + .map_err(|e| format!("error converting supplied value for chunks: {}", e)); + self + } + pub fn path(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.path = value + .try_into() + .map_err(|e| format!("error converting supplied value for path: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerAddOutput { + type Error = String; + fn try_from(value: WorkerAddOutput) -> Result { + Ok(Self { + chunks: value.chunks?, + path: value.path?, + size: value.size?, + }) + } + } + + pub struct WorkerAppendTask { + payload: Result, + stream: Result, + time: Result, String>, + } + + impl Default for WorkerAppendTask { + fn default() -> Self { + Self { + payload: Err("no value supplied for payload".to_string()), + stream: Err("no value supplied for stream".to_string()), + time: Err("no value supplied for time".to_string()), + } + } + } + + impl WorkerAppendTask { + pub fn payload(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.payload = value + .try_into() + .map_err(|e| format!("error converting supplied value for payload: {}", e)); + self + } + pub fn stream(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.stream = value + .try_into() + .map_err(|e| format!("error converting supplied value for stream: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerAppendTask { + type Error = String; + fn try_from(value: WorkerAppendTask) -> Result { + Ok(Self { + payload: value.payload?, + stream: value.stream?, + time: value.time?, + }) + } + } + + pub struct WorkerBootstrap { + bootstrap: Result, + token: Result, + } + + impl Default for WorkerBootstrap { + fn default() -> Self { + Self { + bootstrap: Err("no value supplied for bootstrap".to_string()), + token: Err("no value supplied for token".to_string()), + } + } + } + + impl WorkerBootstrap { + pub fn bootstrap(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.bootstrap = value + .try_into() + .map_err(|e| format!("error converting supplied value for bootstrap: {}", e)); + self + } + pub fn token(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.token = value + .try_into() + .map_err(|e| format!("error converting supplied value for token: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerBootstrap { + type Error = String; + fn try_from(value: WorkerBootstrap) -> Result { + Ok(Self { + bootstrap: value.bootstrap?, + token: value.token?, + }) + } + } + + pub struct WorkerBootstrapResult { + id: Result, + } + + impl Default for WorkerBootstrapResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + } + } + } + + impl WorkerBootstrapResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerBootstrapResult { + type Error = String; + fn try_from(value: WorkerBootstrapResult) -> Result { + Ok(Self { id: value.id? }) + } + } + + pub struct WorkerCompleteTask { + failed: Result, + } + + impl Default for WorkerCompleteTask { + fn default() -> Self { + Self { + failed: Err("no value supplied for failed".to_string()), + } + } + } + + impl WorkerCompleteTask { + pub fn failed(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.failed = value + .try_into() + .map_err(|e| format!("error converting supplied value for failed: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerCompleteTask { + type Error = String; + fn try_from(value: WorkerCompleteTask) -> Result { + Ok(Self { + failed: value.failed?, + }) + } + } + + pub struct WorkerPingResult { + poweroff: Result, + task: Result, String>, + } + + impl Default for WorkerPingResult { + fn default() -> Self { + Self { + poweroff: Err("no value supplied for poweroff".to_string()), + task: Ok(Default::default()), + } + } + } + + impl WorkerPingResult { + pub fn poweroff(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.poweroff = value + .try_into() + .map_err(|e| format!("error converting supplied value for poweroff: {}", e)); + self + } + pub fn task(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.task = value + .try_into() + .map_err(|e| format!("error converting supplied value for task: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerPingResult { + type Error = String; + fn try_from(value: WorkerPingResult) -> Result { + Ok(Self { + poweroff: value.poweroff?, + task: value.task?, + }) + } + } + + pub struct WorkerPingTask { + id: Result, + output_rules: Result, String>, + script: Result, + } + + impl Default for WorkerPingTask { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + output_rules: Err("no value supplied for output_rules".to_string()), + script: Err("no value supplied for script".to_string()), + } + } + } + + impl WorkerPingTask { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn output_rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.output_rules = value.try_into().map_err(|e| { + format!("error converting supplied value for output_rules: {}", e) + }); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerPingTask { + type Error = String; + fn try_from(value: WorkerPingTask) -> Result { + Ok(Self { + id: value.id?, + output_rules: value.output_rules?, + script: value.script?, + }) + } + } + + pub struct WorkerTask { + id: Result, + name: Result, + owner: Result, + } + + impl Default for WorkerTask { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + owner: Err("no value supplied for owner".to_string()), + } + } + } + + impl WorkerTask { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn owner(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.owner = value + .try_into() + .map_err(|e| format!("error converting supplied value for owner: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerTask { + type Error = String; + fn try_from(value: WorkerTask) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + owner: value.owner?, + }) + } + } + + pub struct WorkersResult { + workers: Result, String>, + } + + impl Default for WorkersResult { + fn default() -> Self { + Self { + workers: Err("no value supplied for workers".to_string()), + } + } + } + + impl WorkersResult { + pub fn workers(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.workers = value + .try_into() + .map_err(|e| format!("error converting supplied value for workers: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkersResult { + type Error = String; + fn try_from(value: WorkersResult) -> Result { + Ok(Self { + workers: value.workers?, + }) + } + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/buildomat-builder.out b/progenitor-impl/tests/output/buildomat-builder.out index bf0954f..c049ccb 100644 --- a/progenitor-impl/tests/output/buildomat-builder.out +++ b/progenitor-impl/tests/output/buildomat-builder.out @@ -14,6 +14,12 @@ pub mod types { pub state: String, } + impl Task { + pub fn builder() -> builder::Task { + builder::Task::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct TaskEvent { pub payload: String, @@ -22,6 +28,12 @@ pub mod types { pub time: chrono::DateTime, } + impl TaskEvent { + pub fn builder() -> builder::TaskEvent { + builder::TaskEvent::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct TaskOutput { pub id: String, @@ -29,6 +41,12 @@ pub mod types { pub size: u64, } + impl TaskOutput { + pub fn builder() -> builder::TaskOutput { + builder::TaskOutput::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct TaskSubmit { pub name: String, @@ -37,21 +55,45 @@ pub mod types { pub script: String, } + impl TaskSubmit { + pub fn builder() -> builder::TaskSubmit { + builder::TaskSubmit::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct TaskSubmitResult { pub id: String, } + impl TaskSubmitResult { + pub fn builder() -> builder::TaskSubmitResult { + builder::TaskSubmitResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct UploadedChunk { pub id: String, } + impl UploadedChunk { + pub fn builder() -> builder::UploadedChunk { + builder::UploadedChunk::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct UserCreate { pub name: String, } + impl UserCreate { + pub fn builder() -> builder::UserCreate { + builder::UserCreate::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct UserCreateResult { pub id: String, @@ -59,12 +101,24 @@ pub mod types { pub token: String, } + impl UserCreateResult { + pub fn builder() -> builder::UserCreateResult { + builder::UserCreateResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WhoamiResult { pub id: String, pub name: String, } + impl WhoamiResult { + pub fn builder() -> builder::WhoamiResult { + builder::WhoamiResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Worker { pub deleted: bool, @@ -77,6 +131,12 @@ pub mod types { pub tasks: Vec, } + impl Worker { + pub fn builder() -> builder::Worker { + builder::Worker::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerAddOutput { pub chunks: Vec, @@ -84,6 +144,12 @@ pub mod types { pub size: i64, } + impl WorkerAddOutput { + pub fn builder() -> builder::WorkerAddOutput { + builder::WorkerAddOutput::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerAppendTask { pub payload: String, @@ -91,22 +157,46 @@ pub mod types { pub time: chrono::DateTime, } + impl WorkerAppendTask { + pub fn builder() -> builder::WorkerAppendTask { + builder::WorkerAppendTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerBootstrap { pub bootstrap: String, pub token: String, } + impl WorkerBootstrap { + pub fn builder() -> builder::WorkerBootstrap { + builder::WorkerBootstrap::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerBootstrapResult { pub id: String, } + impl WorkerBootstrapResult { + pub fn builder() -> builder::WorkerBootstrapResult { + builder::WorkerBootstrapResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerCompleteTask { pub failed: bool, } + impl WorkerCompleteTask { + pub fn builder() -> builder::WorkerCompleteTask { + builder::WorkerCompleteTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerPingResult { pub poweroff: bool, @@ -114,6 +204,12 @@ pub mod types { pub task: Option, } + impl WorkerPingResult { + pub fn builder() -> builder::WorkerPingResult { + builder::WorkerPingResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerPingTask { pub id: String, @@ -121,6 +217,12 @@ pub mod types { pub script: String, } + impl WorkerPingTask { + pub fn builder() -> builder::WorkerPingTask { + builder::WorkerPingTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkerTask { pub id: String, @@ -128,10 +230,1039 @@ pub mod types { pub owner: String, } + impl WorkerTask { + pub fn builder() -> builder::WorkerTask { + builder::WorkerTask::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct WorkersResult { pub workers: Vec, } + + impl WorkersResult { + pub fn builder() -> builder::WorkersResult { + builder::WorkersResult::default() + } + } + + mod builder { + pub struct Task { + id: Result, + name: Result, + output_rules: Result, String>, + script: Result, + state: Result, + } + + impl Default for Task { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + output_rules: Err("no value supplied for output_rules".to_string()), + script: Err("no value supplied for script".to_string()), + state: Err("no value supplied for state".to_string()), + } + } + } + + impl Task { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn output_rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.output_rules = value.try_into().map_err(|e| { + format!("error converting supplied value for output_rules: {}", e) + }); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + pub fn state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.state = value + .try_into() + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Task { + type Error = String; + fn try_from(value: Task) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + output_rules: value.output_rules?, + script: value.script?, + state: value.state?, + }) + } + } + + pub struct TaskEvent { + payload: Result, + seq: Result, + stream: Result, + time: Result, String>, + } + + impl Default for TaskEvent { + fn default() -> Self { + Self { + payload: Err("no value supplied for payload".to_string()), + seq: Err("no value supplied for seq".to_string()), + stream: Err("no value supplied for stream".to_string()), + time: Err("no value supplied for time".to_string()), + } + } + } + + impl TaskEvent { + pub fn payload(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.payload = value + .try_into() + .map_err(|e| format!("error converting supplied value for payload: {}", e)); + self + } + pub fn seq(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.seq = value + .try_into() + .map_err(|e| format!("error converting supplied value for seq: {}", e)); + self + } + pub fn stream(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.stream = value + .try_into() + .map_err(|e| format!("error converting supplied value for stream: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskEvent { + type Error = String; + fn try_from(value: TaskEvent) -> Result { + Ok(Self { + payload: value.payload?, + seq: value.seq?, + stream: value.stream?, + time: value.time?, + }) + } + } + + pub struct TaskOutput { + id: Result, + path: Result, + size: Result, + } + + impl Default for TaskOutput { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + path: Err("no value supplied for path".to_string()), + size: Err("no value supplied for size".to_string()), + } + } + } + + impl TaskOutput { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn path(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.path = value + .try_into() + .map_err(|e| format!("error converting supplied value for path: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskOutput { + type Error = String; + fn try_from(value: TaskOutput) -> Result { + Ok(Self { + id: value.id?, + path: value.path?, + size: value.size?, + }) + } + } + + pub struct TaskSubmit { + name: Result, + output_rules: Result, String>, + script: Result, + } + + impl Default for TaskSubmit { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + output_rules: Ok(Default::default()), + script: Err("no value supplied for script".to_string()), + } + } + } + + impl TaskSubmit { + 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 + } + pub fn output_rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.output_rules = value.try_into().map_err(|e| { + format!("error converting supplied value for output_rules: {}", e) + }); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskSubmit { + type Error = String; + fn try_from(value: TaskSubmit) -> Result { + Ok(Self { + name: value.name?, + output_rules: value.output_rules?, + script: value.script?, + }) + } + } + + pub struct TaskSubmitResult { + id: Result, + } + + impl Default for TaskSubmitResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + } + } + } + + impl TaskSubmitResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TaskSubmitResult { + type Error = String; + fn try_from(value: TaskSubmitResult) -> Result { + Ok(Self { id: value.id? }) + } + } + + pub struct UploadedChunk { + id: Result, + } + + impl Default for UploadedChunk { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + } + } + } + + impl UploadedChunk { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UploadedChunk { + type Error = String; + fn try_from(value: UploadedChunk) -> Result { + Ok(Self { id: value.id? }) + } + } + + pub struct UserCreate { + name: Result, + } + + impl Default for UserCreate { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + } + } + } + + impl UserCreate { + 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::UserCreate { + type Error = String; + fn try_from(value: UserCreate) -> Result { + Ok(Self { name: value.name? }) + } + } + + pub struct UserCreateResult { + id: Result, + name: Result, + token: Result, + } + + impl Default for UserCreateResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + token: Err("no value supplied for token".to_string()), + } + } + } + + impl UserCreateResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn token(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.token = value + .try_into() + .map_err(|e| format!("error converting supplied value for token: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UserCreateResult { + type Error = String; + fn try_from(value: UserCreateResult) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + token: value.token?, + }) + } + } + + pub struct WhoamiResult { + id: Result, + name: Result, + } + + impl Default for WhoamiResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl WhoamiResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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::WhoamiResult { + type Error = String; + fn try_from(value: WhoamiResult) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + }) + } + } + + pub struct Worker { + deleted: Result, + id: Result, + instance_id: Result, String>, + lastping: Result>, String>, + recycle: Result, + tasks: Result, String>, + } + + impl Default for Worker { + fn default() -> Self { + Self { + deleted: Err("no value supplied for deleted".to_string()), + id: Err("no value supplied for id".to_string()), + instance_id: Ok(Default::default()), + lastping: Ok(Default::default()), + recycle: Err("no value supplied for recycle".to_string()), + tasks: Err("no value supplied for tasks".to_string()), + } + } + } + + impl Worker { + pub fn deleted(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.deleted = value + .try_into() + .map_err(|e| format!("error converting supplied value for deleted: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn instance_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.instance_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for instance_id: {}", e)); + self + } + pub fn lastping(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.lastping = value + .try_into() + .map_err(|e| format!("error converting supplied value for lastping: {}", e)); + self + } + pub fn recycle(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.recycle = value + .try_into() + .map_err(|e| format!("error converting supplied value for recycle: {}", e)); + self + } + pub fn tasks(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.tasks = value + .try_into() + .map_err(|e| format!("error converting supplied value for tasks: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Worker { + type Error = String; + fn try_from(value: Worker) -> Result { + Ok(Self { + deleted: value.deleted?, + id: value.id?, + instance_id: value.instance_id?, + lastping: value.lastping?, + recycle: value.recycle?, + tasks: value.tasks?, + }) + } + } + + pub struct WorkerAddOutput { + chunks: Result, String>, + path: Result, + size: Result, + } + + impl Default for WorkerAddOutput { + fn default() -> Self { + Self { + chunks: Err("no value supplied for chunks".to_string()), + path: Err("no value supplied for path".to_string()), + size: Err("no value supplied for size".to_string()), + } + } + } + + impl WorkerAddOutput { + pub fn chunks(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.chunks = value + .try_into() + .map_err(|e| format!("error converting supplied value for chunks: {}", e)); + self + } + pub fn path(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.path = value + .try_into() + .map_err(|e| format!("error converting supplied value for path: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerAddOutput { + type Error = String; + fn try_from(value: WorkerAddOutput) -> Result { + Ok(Self { + chunks: value.chunks?, + path: value.path?, + size: value.size?, + }) + } + } + + pub struct WorkerAppendTask { + payload: Result, + stream: Result, + time: Result, String>, + } + + impl Default for WorkerAppendTask { + fn default() -> Self { + Self { + payload: Err("no value supplied for payload".to_string()), + stream: Err("no value supplied for stream".to_string()), + time: Err("no value supplied for time".to_string()), + } + } + } + + impl WorkerAppendTask { + pub fn payload(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.payload = value + .try_into() + .map_err(|e| format!("error converting supplied value for payload: {}", e)); + self + } + pub fn stream(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.stream = value + .try_into() + .map_err(|e| format!("error converting supplied value for stream: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerAppendTask { + type Error = String; + fn try_from(value: WorkerAppendTask) -> Result { + Ok(Self { + payload: value.payload?, + stream: value.stream?, + time: value.time?, + }) + } + } + + pub struct WorkerBootstrap { + bootstrap: Result, + token: Result, + } + + impl Default for WorkerBootstrap { + fn default() -> Self { + Self { + bootstrap: Err("no value supplied for bootstrap".to_string()), + token: Err("no value supplied for token".to_string()), + } + } + } + + impl WorkerBootstrap { + pub fn bootstrap(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.bootstrap = value + .try_into() + .map_err(|e| format!("error converting supplied value for bootstrap: {}", e)); + self + } + pub fn token(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.token = value + .try_into() + .map_err(|e| format!("error converting supplied value for token: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerBootstrap { + type Error = String; + fn try_from(value: WorkerBootstrap) -> Result { + Ok(Self { + bootstrap: value.bootstrap?, + token: value.token?, + }) + } + } + + pub struct WorkerBootstrapResult { + id: Result, + } + + impl Default for WorkerBootstrapResult { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + } + } + } + + impl WorkerBootstrapResult { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerBootstrapResult { + type Error = String; + fn try_from(value: WorkerBootstrapResult) -> Result { + Ok(Self { id: value.id? }) + } + } + + pub struct WorkerCompleteTask { + failed: Result, + } + + impl Default for WorkerCompleteTask { + fn default() -> Self { + Self { + failed: Err("no value supplied for failed".to_string()), + } + } + } + + impl WorkerCompleteTask { + pub fn failed(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.failed = value + .try_into() + .map_err(|e| format!("error converting supplied value for failed: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerCompleteTask { + type Error = String; + fn try_from(value: WorkerCompleteTask) -> Result { + Ok(Self { + failed: value.failed?, + }) + } + } + + pub struct WorkerPingResult { + poweroff: Result, + task: Result, String>, + } + + impl Default for WorkerPingResult { + fn default() -> Self { + Self { + poweroff: Err("no value supplied for poweroff".to_string()), + task: Ok(Default::default()), + } + } + } + + impl WorkerPingResult { + pub fn poweroff(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.poweroff = value + .try_into() + .map_err(|e| format!("error converting supplied value for poweroff: {}", e)); + self + } + pub fn task(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.task = value + .try_into() + .map_err(|e| format!("error converting supplied value for task: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerPingResult { + type Error = String; + fn try_from(value: WorkerPingResult) -> Result { + Ok(Self { + poweroff: value.poweroff?, + task: value.task?, + }) + } + } + + pub struct WorkerPingTask { + id: Result, + output_rules: Result, String>, + script: Result, + } + + impl Default for WorkerPingTask { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + output_rules: Err("no value supplied for output_rules".to_string()), + script: Err("no value supplied for script".to_string()), + } + } + } + + impl WorkerPingTask { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn output_rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.output_rules = value.try_into().map_err(|e| { + format!("error converting supplied value for output_rules: {}", e) + }); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerPingTask { + type Error = String; + fn try_from(value: WorkerPingTask) -> Result { + Ok(Self { + id: value.id?, + output_rules: value.output_rules?, + script: value.script?, + }) + } + } + + pub struct WorkerTask { + id: Result, + name: Result, + owner: Result, + } + + impl Default for WorkerTask { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + owner: Err("no value supplied for owner".to_string()), + } + } + } + + impl WorkerTask { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn owner(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.owner = value + .try_into() + .map_err(|e| format!("error converting supplied value for owner: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkerTask { + type Error = String; + fn try_from(value: WorkerTask) -> Result { + Ok(Self { + id: value.id?, + name: value.name?, + owner: value.owner?, + }) + } + } + + pub struct WorkersResult { + workers: Result, String>, + } + + impl Default for WorkersResult { + fn default() -> Self { + Self { + workers: Err("no value supplied for workers".to_string()), + } + } + } + + impl WorkersResult { + pub fn workers(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.workers = value + .try_into() + .map_err(|e| format!("error converting supplied value for workers: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::WorkersResult { + type Error = String; + fn try_from(value: WorkersResult) -> Result { + Ok(Self { + workers: value.workers?, + }) + } + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/keeper-builder-tagged.out b/progenitor-impl/tests/output/keeper-builder-tagged.out index fe50cb6..6bb6b4b 100644 --- a/progenitor-impl/tests/output/keeper-builder-tagged.out +++ b/progenitor-impl/tests/output/keeper-builder-tagged.out @@ -11,11 +11,23 @@ pub mod types { pub key: String, } + impl EnrolBody { + pub fn builder() -> builder::EnrolBody { + builder::EnrolBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GlobalJobsResult { pub summary: Vec, } + impl GlobalJobsResult { + pub fn builder() -> builder::GlobalJobsResult { + builder::GlobalJobsResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct OutputRecord { pub msg: String, @@ -23,12 +35,24 @@ pub mod types { pub time: chrono::DateTime, } + impl OutputRecord { + pub fn builder() -> builder::OutputRecord { + builder::OutputRecord::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PingResult { pub host: String, pub ok: bool, } + impl PingResult { + pub fn builder() -> builder::PingResult { + builder::PingResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ReportFinishBody { pub duration_millis: i32, @@ -37,6 +61,12 @@ pub mod types { pub id: ReportId, } + impl ReportFinishBody { + pub fn builder() -> builder::ReportFinishBody { + builder::ReportFinishBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ReportId { pub host: String, @@ -46,17 +76,35 @@ pub mod types { pub uuid: String, } + impl ReportId { + pub fn builder() -> builder::ReportId { + builder::ReportId::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ReportOutputBody { pub id: ReportId, pub record: OutputRecord, } + impl ReportOutputBody { + pub fn builder() -> builder::ReportOutputBody { + builder::ReportOutputBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ReportResult { pub existed_already: bool, } + impl ReportResult { + pub fn builder() -> builder::ReportResult { + builder::ReportResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ReportStartBody { pub id: ReportId, @@ -64,6 +112,12 @@ pub mod types { pub start_time: chrono::DateTime, } + impl ReportStartBody { + pub fn builder() -> builder::ReportStartBody { + builder::ReportStartBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ReportSummary { pub age_seconds: i32, @@ -73,6 +127,604 @@ pub mod types { pub status: i32, pub when: chrono::DateTime, } + + impl ReportSummary { + pub fn builder() -> builder::ReportSummary { + builder::ReportSummary::default() + } + } + + mod builder { + pub struct EnrolBody { + host: Result, + key: Result, + } + + impl Default for EnrolBody { + fn default() -> Self { + Self { + host: Err("no value supplied for host".to_string()), + key: Err("no value supplied for key".to_string()), + } + } + } + + impl EnrolBody { + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.key = value + .try_into() + .map_err(|e| format!("error converting supplied value for key: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::EnrolBody { + type Error = String; + fn try_from(value: EnrolBody) -> Result { + Ok(Self { + host: value.host?, + key: value.key?, + }) + } + } + + pub struct GlobalJobsResult { + summary: Result, String>, + } + + impl Default for GlobalJobsResult { + fn default() -> Self { + Self { + summary: Err("no value supplied for summary".to_string()), + } + } + } + + impl GlobalJobsResult { + pub fn summary(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.summary = value + .try_into() + .map_err(|e| format!("error converting supplied value for summary: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalJobsResult { + type Error = String; + fn try_from(value: GlobalJobsResult) -> Result { + Ok(Self { + summary: value.summary?, + }) + } + } + + pub struct OutputRecord { + msg: Result, + stream: Result, + time: Result, String>, + } + + impl Default for OutputRecord { + fn default() -> Self { + Self { + msg: Err("no value supplied for msg".to_string()), + stream: Err("no value supplied for stream".to_string()), + time: Err("no value supplied for time".to_string()), + } + } + } + + impl OutputRecord { + pub fn msg(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.msg = value + .try_into() + .map_err(|e| format!("error converting supplied value for msg: {}", e)); + self + } + pub fn stream(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.stream = value + .try_into() + .map_err(|e| format!("error converting supplied value for stream: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::OutputRecord { + type Error = String; + fn try_from(value: OutputRecord) -> Result { + Ok(Self { + msg: value.msg?, + stream: value.stream?, + time: value.time?, + }) + } + } + + pub struct PingResult { + host: Result, + ok: Result, + } + + impl Default for PingResult { + fn default() -> Self { + Self { + host: Err("no value supplied for host".to_string()), + ok: Err("no value supplied for ok".to_string()), + } + } + } + + impl PingResult { + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn ok(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ok = value + .try_into() + .map_err(|e| format!("error converting supplied value for ok: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::PingResult { + type Error = String; + fn try_from(value: PingResult) -> Result { + Ok(Self { + host: value.host?, + ok: value.ok?, + }) + } + } + + pub struct ReportFinishBody { + duration_millis: Result, + end_time: Result, String>, + exit_status: Result, + id: Result, + } + + impl Default for ReportFinishBody { + fn default() -> Self { + Self { + duration_millis: Err("no value supplied for duration_millis".to_string()), + end_time: Err("no value supplied for end_time".to_string()), + exit_status: Err("no value supplied for exit_status".to_string()), + id: Err("no value supplied for id".to_string()), + } + } + } + + impl ReportFinishBody { + pub fn duration_millis(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.duration_millis = value.try_into().map_err(|e| { + format!("error converting supplied value for duration_millis: {}", e) + }); + self + } + pub fn end_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.end_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for end_time: {}", e)); + self + } + pub fn exit_status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.exit_status = value + .try_into() + .map_err(|e| format!("error converting supplied value for exit_status: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportFinishBody { + type Error = String; + fn try_from(value: ReportFinishBody) -> Result { + Ok(Self { + duration_millis: value.duration_millis?, + end_time: value.end_time?, + exit_status: value.exit_status?, + id: value.id?, + }) + } + } + + pub struct ReportId { + host: Result, + job: Result, + pid: Result, + time: Result, String>, + uuid: Result, + } + + impl Default for ReportId { + fn default() -> Self { + Self { + host: Err("no value supplied for host".to_string()), + job: Err("no value supplied for job".to_string()), + pid: Err("no value supplied for pid".to_string()), + time: Err("no value supplied for time".to_string()), + uuid: Err("no value supplied for uuid".to_string()), + } + } + } + + impl ReportId { + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn job(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.job = value + .try_into() + .map_err(|e| format!("error converting supplied value for job: {}", e)); + self + } + pub fn pid(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.pid = value + .try_into() + .map_err(|e| format!("error converting supplied value for pid: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + pub fn uuid(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.uuid = value + .try_into() + .map_err(|e| format!("error converting supplied value for uuid: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportId { + type Error = String; + fn try_from(value: ReportId) -> Result { + Ok(Self { + host: value.host?, + job: value.job?, + pid: value.pid?, + time: value.time?, + uuid: value.uuid?, + }) + } + } + + pub struct ReportOutputBody { + id: Result, + record: Result, + } + + impl Default for ReportOutputBody { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + record: Err("no value supplied for record".to_string()), + } + } + } + + impl ReportOutputBody { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn record(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.record = value + .try_into() + .map_err(|e| format!("error converting supplied value for record: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportOutputBody { + type Error = String; + fn try_from(value: ReportOutputBody) -> Result { + Ok(Self { + id: value.id?, + record: value.record?, + }) + } + } + + pub struct ReportResult { + existed_already: Result, + } + + impl Default for ReportResult { + fn default() -> Self { + Self { + existed_already: Err("no value supplied for existed_already".to_string()), + } + } + } + + impl ReportResult { + pub fn existed_already(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.existed_already = value.try_into().map_err(|e| { + format!("error converting supplied value for existed_already: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::ReportResult { + type Error = String; + fn try_from(value: ReportResult) -> Result { + Ok(Self { + existed_already: value.existed_already?, + }) + } + } + + pub struct ReportStartBody { + id: Result, + script: Result, + start_time: Result, String>, + } + + impl Default for ReportStartBody { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + script: Err("no value supplied for script".to_string()), + start_time: Err("no value supplied for start_time".to_string()), + } + } + } + + impl ReportStartBody { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportStartBody { + type Error = String; + fn try_from(value: ReportStartBody) -> Result { + Ok(Self { + id: value.id?, + script: value.script?, + start_time: value.start_time?, + }) + } + } + + pub struct ReportSummary { + age_seconds: Result, + duration_seconds: Result, + host: Result, + job: Result, + status: Result, + when: Result, String>, + } + + impl Default for ReportSummary { + fn default() -> Self { + Self { + age_seconds: Err("no value supplied for age_seconds".to_string()), + duration_seconds: Err("no value supplied for duration_seconds".to_string()), + host: Err("no value supplied for host".to_string()), + job: Err("no value supplied for job".to_string()), + status: Err("no value supplied for status".to_string()), + when: Err("no value supplied for when".to_string()), + } + } + } + + impl ReportSummary { + pub fn age_seconds(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.age_seconds = value + .try_into() + .map_err(|e| format!("error converting supplied value for age_seconds: {}", e)); + self + } + pub fn duration_seconds(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.duration_seconds = value.try_into().map_err(|e| { + format!( + "error converting supplied value for duration_seconds: {}", + e + ) + }); + self + } + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn job(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.job = value + .try_into() + .map_err(|e| format!("error converting supplied value for job: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn when(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.when = value + .try_into() + .map_err(|e| format!("error converting supplied value for when: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportSummary { + type Error = String; + fn try_from(value: ReportSummary) -> Result { + Ok(Self { + age_seconds: value.age_seconds?, + duration_seconds: value.duration_seconds?, + host: value.host?, + job: value.job?, + status: value.status?, + when: value.when?, + }) + } + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/keeper-builder.out b/progenitor-impl/tests/output/keeper-builder.out index c9befa2..1b5e554 100644 --- a/progenitor-impl/tests/output/keeper-builder.out +++ b/progenitor-impl/tests/output/keeper-builder.out @@ -11,11 +11,23 @@ pub mod types { pub key: String, } + impl EnrolBody { + pub fn builder() -> builder::EnrolBody { + builder::EnrolBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct GlobalJobsResult { pub summary: Vec, } + impl GlobalJobsResult { + pub fn builder() -> builder::GlobalJobsResult { + builder::GlobalJobsResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct OutputRecord { pub msg: String, @@ -23,12 +35,24 @@ pub mod types { pub time: chrono::DateTime, } + impl OutputRecord { + pub fn builder() -> builder::OutputRecord { + builder::OutputRecord::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct PingResult { pub host: String, pub ok: bool, } + impl PingResult { + pub fn builder() -> builder::PingResult { + builder::PingResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ReportFinishBody { pub duration_millis: i32, @@ -37,6 +61,12 @@ pub mod types { pub id: ReportId, } + impl ReportFinishBody { + pub fn builder() -> builder::ReportFinishBody { + builder::ReportFinishBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ReportId { pub host: String, @@ -46,17 +76,35 @@ pub mod types { pub uuid: String, } + impl ReportId { + pub fn builder() -> builder::ReportId { + builder::ReportId::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ReportOutputBody { pub id: ReportId, pub record: OutputRecord, } + impl ReportOutputBody { + pub fn builder() -> builder::ReportOutputBody { + builder::ReportOutputBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ReportResult { pub existed_already: bool, } + impl ReportResult { + pub fn builder() -> builder::ReportResult { + builder::ReportResult::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ReportStartBody { pub id: ReportId, @@ -64,6 +112,12 @@ pub mod types { pub start_time: chrono::DateTime, } + impl ReportStartBody { + pub fn builder() -> builder::ReportStartBody { + builder::ReportStartBody::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ReportSummary { pub age_seconds: i32, @@ -73,6 +127,604 @@ pub mod types { pub status: i32, pub when: chrono::DateTime, } + + impl ReportSummary { + pub fn builder() -> builder::ReportSummary { + builder::ReportSummary::default() + } + } + + mod builder { + pub struct EnrolBody { + host: Result, + key: Result, + } + + impl Default for EnrolBody { + fn default() -> Self { + Self { + host: Err("no value supplied for host".to_string()), + key: Err("no value supplied for key".to_string()), + } + } + } + + impl EnrolBody { + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.key = value + .try_into() + .map_err(|e| format!("error converting supplied value for key: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::EnrolBody { + type Error = String; + fn try_from(value: EnrolBody) -> Result { + Ok(Self { + host: value.host?, + key: value.key?, + }) + } + } + + pub struct GlobalJobsResult { + summary: Result, String>, + } + + impl Default for GlobalJobsResult { + fn default() -> Self { + Self { + summary: Err("no value supplied for summary".to_string()), + } + } + } + + impl GlobalJobsResult { + pub fn summary(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.summary = value + .try_into() + .map_err(|e| format!("error converting supplied value for summary: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalJobsResult { + type Error = String; + fn try_from(value: GlobalJobsResult) -> Result { + Ok(Self { + summary: value.summary?, + }) + } + } + + pub struct OutputRecord { + msg: Result, + stream: Result, + time: Result, String>, + } + + impl Default for OutputRecord { + fn default() -> Self { + Self { + msg: Err("no value supplied for msg".to_string()), + stream: Err("no value supplied for stream".to_string()), + time: Err("no value supplied for time".to_string()), + } + } + } + + impl OutputRecord { + pub fn msg(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.msg = value + .try_into() + .map_err(|e| format!("error converting supplied value for msg: {}", e)); + self + } + pub fn stream(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.stream = value + .try_into() + .map_err(|e| format!("error converting supplied value for stream: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::OutputRecord { + type Error = String; + fn try_from(value: OutputRecord) -> Result { + Ok(Self { + msg: value.msg?, + stream: value.stream?, + time: value.time?, + }) + } + } + + pub struct PingResult { + host: Result, + ok: Result, + } + + impl Default for PingResult { + fn default() -> Self { + Self { + host: Err("no value supplied for host".to_string()), + ok: Err("no value supplied for ok".to_string()), + } + } + } + + impl PingResult { + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn ok(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ok = value + .try_into() + .map_err(|e| format!("error converting supplied value for ok: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::PingResult { + type Error = String; + fn try_from(value: PingResult) -> Result { + Ok(Self { + host: value.host?, + ok: value.ok?, + }) + } + } + + pub struct ReportFinishBody { + duration_millis: Result, + end_time: Result, String>, + exit_status: Result, + id: Result, + } + + impl Default for ReportFinishBody { + fn default() -> Self { + Self { + duration_millis: Err("no value supplied for duration_millis".to_string()), + end_time: Err("no value supplied for end_time".to_string()), + exit_status: Err("no value supplied for exit_status".to_string()), + id: Err("no value supplied for id".to_string()), + } + } + } + + impl ReportFinishBody { + pub fn duration_millis(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.duration_millis = value.try_into().map_err(|e| { + format!("error converting supplied value for duration_millis: {}", e) + }); + self + } + pub fn end_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.end_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for end_time: {}", e)); + self + } + pub fn exit_status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.exit_status = value + .try_into() + .map_err(|e| format!("error converting supplied value for exit_status: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportFinishBody { + type Error = String; + fn try_from(value: ReportFinishBody) -> Result { + Ok(Self { + duration_millis: value.duration_millis?, + end_time: value.end_time?, + exit_status: value.exit_status?, + id: value.id?, + }) + } + } + + pub struct ReportId { + host: Result, + job: Result, + pid: Result, + time: Result, String>, + uuid: Result, + } + + impl Default for ReportId { + fn default() -> Self { + Self { + host: Err("no value supplied for host".to_string()), + job: Err("no value supplied for job".to_string()), + pid: Err("no value supplied for pid".to_string()), + time: Err("no value supplied for time".to_string()), + uuid: Err("no value supplied for uuid".to_string()), + } + } + } + + impl ReportId { + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn job(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.job = value + .try_into() + .map_err(|e| format!("error converting supplied value for job: {}", e)); + self + } + pub fn pid(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.pid = value + .try_into() + .map_err(|e| format!("error converting supplied value for pid: {}", e)); + self + } + pub fn time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time = value + .try_into() + .map_err(|e| format!("error converting supplied value for time: {}", e)); + self + } + pub fn uuid(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.uuid = value + .try_into() + .map_err(|e| format!("error converting supplied value for uuid: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportId { + type Error = String; + fn try_from(value: ReportId) -> Result { + Ok(Self { + host: value.host?, + job: value.job?, + pid: value.pid?, + time: value.time?, + uuid: value.uuid?, + }) + } + } + + pub struct ReportOutputBody { + id: Result, + record: Result, + } + + impl Default for ReportOutputBody { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + record: Err("no value supplied for record".to_string()), + } + } + } + + impl ReportOutputBody { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn record(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.record = value + .try_into() + .map_err(|e| format!("error converting supplied value for record: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportOutputBody { + type Error = String; + fn try_from(value: ReportOutputBody) -> Result { + Ok(Self { + id: value.id?, + record: value.record?, + }) + } + } + + pub struct ReportResult { + existed_already: Result, + } + + impl Default for ReportResult { + fn default() -> Self { + Self { + existed_already: Err("no value supplied for existed_already".to_string()), + } + } + } + + impl ReportResult { + pub fn existed_already(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.existed_already = value.try_into().map_err(|e| { + format!("error converting supplied value for existed_already: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::ReportResult { + type Error = String; + fn try_from(value: ReportResult) -> Result { + Ok(Self { + existed_already: value.existed_already?, + }) + } + } + + pub struct ReportStartBody { + id: Result, + script: Result, + start_time: Result, String>, + } + + impl Default for ReportStartBody { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + script: Err("no value supplied for script".to_string()), + start_time: Err("no value supplied for start_time".to_string()), + } + } + } + + impl ReportStartBody { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn script(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.script = value + .try_into() + .map_err(|e| format!("error converting supplied value for script: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportStartBody { + type Error = String; + fn try_from(value: ReportStartBody) -> Result { + Ok(Self { + id: value.id?, + script: value.script?, + start_time: value.start_time?, + }) + } + } + + pub struct ReportSummary { + age_seconds: Result, + duration_seconds: Result, + host: Result, + job: Result, + status: Result, + when: Result, String>, + } + + impl Default for ReportSummary { + fn default() -> Self { + Self { + age_seconds: Err("no value supplied for age_seconds".to_string()), + duration_seconds: Err("no value supplied for duration_seconds".to_string()), + host: Err("no value supplied for host".to_string()), + job: Err("no value supplied for job".to_string()), + status: Err("no value supplied for status".to_string()), + when: Err("no value supplied for when".to_string()), + } + } + } + + impl ReportSummary { + pub fn age_seconds(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.age_seconds = value + .try_into() + .map_err(|e| format!("error converting supplied value for age_seconds: {}", e)); + self + } + pub fn duration_seconds(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.duration_seconds = value.try_into().map_err(|e| { + format!( + "error converting supplied value for duration_seconds: {}", + e + ) + }); + self + } + pub fn host(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.host = value + .try_into() + .map_err(|e| format!("error converting supplied value for host: {}", e)); + self + } + pub fn job(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.job = value + .try_into() + .map_err(|e| format!("error converting supplied value for job: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn when(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.when = value + .try_into() + .map_err(|e| format!("error converting supplied value for when: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ReportSummary { + type Error = String; + fn try_from(value: ReportSummary) -> Result { + Ok(Self { + age_seconds: value.age_seconds?, + duration_seconds: value.duration_seconds?, + host: value.host?, + job: value.job?, + status: value.status?, + when: value.when?, + }) + } + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/nexus-builder-tagged.out b/progenitor-impl/tests/output/nexus-builder-tagged.out index e0065cf..9f2a018 100644 --- a/progenitor-impl/tests/output/nexus-builder-tagged.out +++ b/progenitor-impl/tests/output/nexus-builder-tagged.out @@ -54,6 +54,12 @@ pub mod types { pub range: BinRangedouble, } + impl Bindouble { + pub fn builder() -> builder::Bindouble { + builder::Bindouble::default() + } + } + ///Type storing bin edges and a count of samples within it. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Binint64 { @@ -63,6 +69,12 @@ pub mod types { pub range: BinRangeint64, } + impl Binint64 { + pub fn builder() -> builder::Binint64 { + builder::Binint64::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct BlockSize(i64); impl std::ops::Deref for BlockSize { @@ -106,6 +118,12 @@ pub mod types { pub value: f64, } + impl Cumulativedouble { + pub fn builder() -> builder::Cumulativedouble { + builder::Cumulativedouble::default() + } + } + ///A cumulative or counter data type. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Cumulativeint64 { @@ -113,6 +131,12 @@ pub mod types { pub value: i64, } + impl Cumulativeint64 { + pub fn builder() -> builder::Cumulativeint64 { + builder::Cumulativeint64::default() + } + } + ///A `Datum` is a single sampled data point from a metric. #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type", content = "datum")] @@ -202,6 +226,12 @@ pub mod types { pub public_cert: String, } + impl DerEncodedKeyPair { + pub fn builder() -> builder::DerEncodedKeyPair { + builder::DerEncodedKeyPair::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DeviceAccessTokenRequest { pub client_id: uuid::Uuid, @@ -209,16 +239,34 @@ pub mod types { pub grant_type: String, } + impl DeviceAccessTokenRequest { + pub fn builder() -> builder::DeviceAccessTokenRequest { + builder::DeviceAccessTokenRequest::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DeviceAuthRequest { pub client_id: uuid::Uuid, } + impl DeviceAuthRequest { + pub fn builder() -> builder::DeviceAuthRequest { + builder::DeviceAuthRequest::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DeviceAuthVerify { pub user_code: String, } + impl DeviceAuthVerify { + pub fn builder() -> builder::DeviceAuthVerify { + builder::DeviceAuthVerify::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type", content = "value")] pub enum Digest { @@ -250,6 +298,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Disk { + pub fn builder() -> builder::Disk { + builder::Disk::default() + } + } + ///Create-time parameters for a /// [`Disk`](omicron_common::api::external::Disk) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -262,6 +316,12 @@ pub mod types { pub size: ByteCount, } + impl DiskCreate { + pub fn builder() -> builder::DiskCreate { + builder::DiskCreate::default() + } + } + ///Parameters for the [`Disk`](omicron_common::api::external::Disk) to be /// attached or detached to an instance #[derive(Clone, Debug, Deserialize, Serialize)] @@ -269,6 +329,12 @@ pub mod types { pub name: Name, } + impl DiskIdentifier { + pub fn builder() -> builder::DiskIdentifier { + builder::DiskIdentifier::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum DiskMetricName { #[serde(rename = "activated")] @@ -323,6 +389,12 @@ pub mod types { pub next_page: Option, } + impl DiskResultsPage { + pub fn builder() -> builder::DiskResultsPage { + builder::DiskResultsPage::default() + } + } + ///Different sources for a disk #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] @@ -377,6 +449,12 @@ pub mod types { pub version: String, } + impl Distribution { + pub fn builder() -> builder::Distribution { + builder::Distribution::default() + } + } + ///Error information from a response. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Error { @@ -386,12 +464,24 @@ pub mod types { pub request_id: String, } + impl Error { + pub fn builder() -> builder::Error { + builder::Error::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ExternalIp { pub ip: std::net::IpAddr, pub kind: IpKind, } + impl ExternalIp { + pub fn builder() -> builder::ExternalIp { + builder::ExternalIp::default() + } + } + ///Parameters for creating an external IP address for instances. #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] @@ -416,6 +506,12 @@ pub mod types { pub next_page: Option, } + impl ExternalIpResultsPage { + pub fn builder() -> builder::ExternalIpResultsPage { + builder::ExternalIpResultsPage::default() + } + } + ///The name and type information for a field of a timeseries schema. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FieldSchema { @@ -424,6 +520,12 @@ pub mod types { pub ty: FieldType, } + impl FieldSchema { + pub fn builder() -> builder::FieldSchema { + builder::FieldSchema::default() + } + } + ///The source from which a field is derived, the target or metric. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum FieldSource { @@ -538,6 +640,12 @@ pub mod types { pub role_assignments: Vec, } + impl FleetRolePolicy { + pub fn builder() -> builder::FleetRolePolicy { + builder::FleetRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -551,6 +659,12 @@ pub mod types { pub role_name: FleetRole, } + impl FleetRoleRoleAssignment { + pub fn builder() -> builder::FleetRoleRoleAssignment { + builder::FleetRoleRoleAssignment::default() + } + } + ///Client view of global Images #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GlobalImage { @@ -580,6 +694,12 @@ pub mod types { pub version: String, } + impl GlobalImage { + pub fn builder() -> builder::GlobalImage { + builder::GlobalImage::default() + } + } + ///Create-time parameters for an /// [`GlobalImage`](omicron_common::api::external::GlobalImage) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -594,6 +714,12 @@ pub mod types { pub source: ImageSource, } + impl GlobalImageCreate { + pub fn builder() -> builder::GlobalImageCreate { + builder::GlobalImageCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GlobalImageResultsPage { @@ -604,6 +730,12 @@ pub mod types { pub next_page: Option, } + impl GlobalImageResultsPage { + pub fn builder() -> builder::GlobalImageResultsPage { + builder::GlobalImageResultsPage::default() + } + } + ///A simple type for managing a histogram metric. /// ///A histogram maintains the count of any number of samples, over a set of @@ -653,6 +785,12 @@ pub mod types { pub start_time: chrono::DateTime, } + impl Histogramdouble { + pub fn builder() -> builder::Histogramdouble { + builder::Histogramdouble::default() + } + } + ///A simple type for managing a histogram metric. /// ///A histogram maintains the count of any number of samples, over a set of @@ -702,6 +840,12 @@ pub mod types { pub start_time: chrono::DateTime, } + impl Histogramint64 { + pub fn builder() -> builder::Histogramint64 { + builder::Histogramint64::default() + } + } + ///Supported set of sort modes for scanning by id only. /// ///Currently, we only support scanning in ascending order. @@ -746,6 +890,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl IdentityProvider { + pub fn builder() -> builder::IdentityProvider { + builder::IdentityProvider::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IdentityProviderResultsPage { @@ -756,6 +906,12 @@ pub mod types { pub next_page: Option, } + impl IdentityProviderResultsPage { + pub fn builder() -> builder::IdentityProviderResultsPage { + builder::IdentityProviderResultsPage::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum IdentityProviderType { #[serde(rename = "saml")] @@ -844,6 +1000,12 @@ pub mod types { pub version: Option, } + impl Image { + pub fn builder() -> builder::Image { + builder::Image::default() + } + } + ///Create-time parameters for an /// [`Image`](omicron_common::api::external::Image) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -856,6 +1018,12 @@ pub mod types { pub source: ImageSource, } + impl ImageCreate { + pub fn builder() -> builder::ImageCreate { + builder::ImageCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ImageResultsPage { @@ -866,6 +1034,12 @@ pub mod types { pub next_page: Option, } + impl ImageResultsPage { + pub fn builder() -> builder::ImageResultsPage { + builder::ImageResultsPage::default() + } + } + ///The source of the underlying image. #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] @@ -903,6 +1077,12 @@ pub mod types { pub time_run_state_updated: chrono::DateTime, } + impl Instance { + pub fn builder() -> builder::Instance { + builder::Instance::default() + } + } + ///The number of CPUs in an Instance #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InstanceCpuCount(pub u16); @@ -934,7 +1114,7 @@ pub mod types { pub name: Name, pub ncpus: InstanceCpuCount, ///The network interfaces to be created for this instance. - #[serde(default = "instance_create_network_interfaces")] + #[serde(default = "defaults::instance_create_network_interfaces")] pub network_interfaces: InstanceNetworkInterfaceAttachment, ///User data for instance initialization systems (such as cloud-init). /// Must be a Base64-encoded string, as specified in RFC 4648 ยง 4 (+ and @@ -943,8 +1123,10 @@ pub mod types { pub user_data: String, } - fn instance_create_network_interfaces() -> InstanceNetworkInterfaceAttachment { - InstanceNetworkInterfaceAttachment::Default + impl InstanceCreate { + pub fn builder() -> builder::InstanceCreate { + builder::InstanceCreate::default() + } } ///Describe the instance's disks at creation time @@ -976,6 +1158,12 @@ pub mod types { pub dst_sled_id: uuid::Uuid, } + impl InstanceMigrate { + pub fn builder() -> builder::InstanceMigrate { + builder::InstanceMigrate::default() + } + } + ///Describes an attachment of a `NetworkInterface` to an `Instance`, at the /// time the instance is created. #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1003,6 +1191,12 @@ pub mod types { pub next_page: Option, } + impl InstanceResultsPage { + pub fn builder() -> builder::InstanceResultsPage { + builder::InstanceResultsPage::default() + } + } + ///Contents of an Instance's serial console buffer. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InstanceSerialConsoleData { @@ -1015,6 +1209,12 @@ pub mod types { pub last_byte_offset: u64, } + impl InstanceSerialConsoleData { + pub fn builder() -> builder::InstanceSerialConsoleData { + builder::InstanceSerialConsoleData::default() + } + } + ///Running state of an Instance (primarily: booted or stopped) /// ///This typically reflects whether it's starting, running, stopping, or @@ -1121,7 +1321,7 @@ pub mod types { Err("") .or_else(|_: Self::Error| Ok(Self::V4(Ipv4Net::try_from(value)?))) .or_else(|_: Self::Error| Ok(Self::V6(Ipv6Net::try_from(value)?))) - .or_else(|_: Self::Error| Err("string conversion failed for all variants")) + .map_err(|_: Self::Error| "string conversion failed for all variants") } } @@ -1150,6 +1350,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl IpPool { + pub fn builder() -> builder::IpPool { + builder::IpPool::default() + } + } + ///Create-time parameters for an IP Pool. /// ///See [`IpPool`](omicron_nexus::external_api::views::IpPool) @@ -1163,6 +1369,12 @@ pub mod types { pub project: Option, } + impl IpPoolCreate { + pub fn builder() -> builder::IpPoolCreate { + builder::IpPoolCreate::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IpPoolRange { pub id: uuid::Uuid, @@ -1170,6 +1382,12 @@ pub mod types { pub time_created: chrono::DateTime, } + impl IpPoolRange { + pub fn builder() -> builder::IpPoolRange { + builder::IpPoolRange::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IpPoolRangeResultsPage { @@ -1180,6 +1398,12 @@ pub mod types { pub next_page: Option, } + impl IpPoolRangeResultsPage { + pub fn builder() -> builder::IpPoolRangeResultsPage { + builder::IpPoolRangeResultsPage::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IpPoolResultsPage { @@ -1190,6 +1414,12 @@ pub mod types { pub next_page: Option, } + impl IpPoolResultsPage { + pub fn builder() -> builder::IpPoolResultsPage { + builder::IpPoolResultsPage::default() + } + } + ///Parameters for updating an IP Pool #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IpPoolUpdate { @@ -1199,6 +1429,12 @@ pub mod types { pub name: Option, } + impl IpPoolUpdate { + pub fn builder() -> builder::IpPoolUpdate { + builder::IpPoolUpdate::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum IpRange { @@ -1250,6 +1486,12 @@ pub mod types { pub last: std::net::Ipv4Addr, } + impl Ipv4Range { + pub fn builder() -> builder::Ipv4Range { + builder::Ipv4Range::default() + } + } + ///An IPv6 subnet, including prefix and subnet mask #[derive(Clone, Debug, Serialize)] pub struct Ipv6Net(String); @@ -1294,6 +1536,12 @@ pub mod types { pub last: std::net::Ipv6Addr, } + impl Ipv6Range { + pub fn builder() -> builder::Ipv6Range { + builder::Ipv6Range::default() + } + } + ///An inclusive-inclusive range of IP ports. The second port may be omitted /// to represent a single port #[derive(Clone, Debug, Serialize)] @@ -1396,6 +1644,12 @@ pub mod types { pub timestamp: chrono::DateTime, } + impl Measurement { + pub fn builder() -> builder::Measurement { + builder::Measurement::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct MeasurementResultsPage { @@ -1406,6 +1660,12 @@ pub mod types { pub next_page: Option, } + impl MeasurementResultsPage { + pub fn builder() -> builder::MeasurementResultsPage { + builder::MeasurementResultsPage::default() + } + } + ///Names must begin with a lower case ASCII letter, be composed exclusively /// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end /// with a '-'. Names cannot be a UUID though they may contain a UUID. @@ -1534,6 +1794,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl NetworkInterface { + pub fn builder() -> builder::NetworkInterface { + builder::NetworkInterface::default() + } + } + ///Create-time parameters for a /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1550,6 +1816,12 @@ pub mod types { pub vpc_name: Name, } + impl NetworkInterfaceCreate { + pub fn builder() -> builder::NetworkInterfaceCreate { + builder::NetworkInterfaceCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NetworkInterfaceResultsPage { @@ -1560,6 +1832,12 @@ pub mod types { pub next_page: Option, } + impl NetworkInterfaceResultsPage { + pub fn builder() -> builder::NetworkInterfaceResultsPage { + builder::NetworkInterfaceResultsPage::default() + } + } + ///Parameters for updating a /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface). /// @@ -1586,6 +1864,12 @@ pub mod types { pub name: Option, } + impl NetworkInterfaceUpdate { + pub fn builder() -> builder::NetworkInterfaceUpdate { + builder::NetworkInterfaceUpdate::default() + } + } + ///Client view of an [`Organization`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Organization { @@ -1601,6 +1885,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Organization { + pub fn builder() -> builder::Organization { + builder::Organization::default() + } + } + ///Create-time parameters for an /// [`Organization`](crate::external_api::views::Organization) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1609,6 +1899,12 @@ pub mod types { pub name: Name, } + impl OrganizationCreate { + pub fn builder() -> builder::OrganizationCreate { + builder::OrganizationCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct OrganizationResultsPage { @@ -1619,6 +1915,12 @@ pub mod types { pub next_page: Option, } + impl OrganizationResultsPage { + pub fn builder() -> builder::OrganizationResultsPage { + builder::OrganizationResultsPage::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum OrganizationRole { #[serde(rename = "admin")] @@ -1663,6 +1965,12 @@ pub mod types { pub role_assignments: Vec, } + impl OrganizationRolePolicy { + pub fn builder() -> builder::OrganizationRolePolicy { + builder::OrganizationRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -1676,6 +1984,12 @@ pub mod types { pub role_name: OrganizationRole, } + impl OrganizationRoleRoleAssignment { + pub fn builder() -> builder::OrganizationRoleRoleAssignment { + builder::OrganizationRoleRoleAssignment::default() + } + } + ///Updateable properties of an /// [`Organization`](crate::external_api::views::Organization) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1686,6 +2000,12 @@ pub mod types { pub name: Option, } + impl OrganizationUpdate { + pub fn builder() -> builder::OrganizationUpdate { + builder::OrganizationUpdate::default() + } + } + ///Client view of a [`Project`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Project { @@ -1702,6 +2022,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Project { + pub fn builder() -> builder::Project { + builder::Project::default() + } + } + ///Create-time parameters for a /// [`Project`](crate::external_api::views::Project) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1710,6 +2036,12 @@ pub mod types { pub name: Name, } + impl ProjectCreate { + pub fn builder() -> builder::ProjectCreate { + builder::ProjectCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ProjectResultsPage { @@ -1720,6 +2052,12 @@ pub mod types { pub next_page: Option, } + impl ProjectResultsPage { + pub fn builder() -> builder::ProjectResultsPage { + builder::ProjectResultsPage::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum ProjectRole { #[serde(rename = "admin")] @@ -1764,6 +2102,12 @@ pub mod types { pub role_assignments: Vec, } + impl ProjectRolePolicy { + pub fn builder() -> builder::ProjectRolePolicy { + builder::ProjectRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -1777,6 +2121,12 @@ pub mod types { pub role_name: ProjectRole, } + impl ProjectRoleRoleAssignment { + pub fn builder() -> builder::ProjectRoleRoleAssignment { + builder::ProjectRoleRoleAssignment::default() + } + } + ///Updateable properties of a /// [`Project`](crate::external_api::views::Project) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1787,6 +2137,12 @@ pub mod types { pub name: Option, } + impl ProjectUpdate { + pub fn builder() -> builder::ProjectUpdate { + builder::ProjectUpdate::default() + } + } + ///Client view of an [`Rack`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Rack { @@ -1798,6 +2154,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Rack { + pub fn builder() -> builder::Rack { + builder::Rack::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct RackResultsPage { @@ -1808,6 +2170,12 @@ pub mod types { pub next_page: Option, } + impl RackResultsPage { + pub fn builder() -> builder::RackResultsPage { + builder::RackResultsPage::default() + } + } + ///Client view of a [`Role`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Role { @@ -1815,6 +2183,12 @@ pub mod types { pub name: RoleName, } + impl Role { + pub fn builder() -> builder::Role { + builder::Role::default() + } + } + ///Role names consist of two string components separated by dot ("."). #[derive(Clone, Debug, Serialize)] pub struct RoleName(String); @@ -1869,6 +2243,12 @@ pub mod types { pub next_page: Option, } + impl RoleResultsPage { + pub fn builder() -> builder::RoleResultsPage { + builder::RoleResultsPage::default() + } + } + ///A `RouteDestination` is used to match traffic with a routing rule, on /// the destination of that traffic. /// @@ -1936,6 +2316,12 @@ pub mod types { pub vpc_router_id: uuid::Uuid, } + impl RouterRoute { + pub fn builder() -> builder::RouterRoute { + builder::RouterRoute::default() + } + } + ///Create-time parameters for a [`RouterRoute`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct RouterRouteCreateParams { @@ -1945,6 +2331,12 @@ pub mod types { pub target: RouteTarget, } + impl RouterRouteCreateParams { + pub fn builder() -> builder::RouterRouteCreateParams { + builder::RouterRouteCreateParams::default() + } + } + ///The classification of a [`RouterRoute`] as defined by the system. The /// kind determines certain attributes such as if the route is modifiable /// and describes how or where the route was created. @@ -1996,6 +2388,12 @@ pub mod types { pub next_page: Option, } + impl RouterRouteResultsPage { + pub fn builder() -> builder::RouterRouteResultsPage { + builder::RouterRouteResultsPage::default() + } + } + ///Updateable properties of a [`RouterRoute`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct RouterRouteUpdateParams { @@ -2007,12 +2405,24 @@ pub mod types { pub target: RouteTarget, } + impl RouterRouteUpdateParams { + pub fn builder() -> builder::RouterRouteUpdateParams { + builder::RouterRouteUpdateParams::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Saga { pub id: uuid::Uuid, pub state: SagaState, } + impl Saga { + pub fn builder() -> builder::Saga { + builder::Saga::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "error")] pub enum SagaErrorInfo { @@ -2038,6 +2448,12 @@ pub mod types { pub next_page: Option, } + impl SagaResultsPage { + pub fn builder() -> builder::SagaResultsPage { + builder::SagaResultsPage::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "state")] pub enum SagaState { @@ -2082,6 +2498,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl SamlIdentityProvider { + pub fn builder() -> builder::SamlIdentityProvider { + builder::SamlIdentityProvider::default() + } + } + ///Create-time identity-related parameters #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SamlIdentityProviderCreate { @@ -2104,6 +2526,12 @@ pub mod types { pub technical_contact_email: String, } + impl SamlIdentityProviderCreate { + pub fn builder() -> builder::SamlIdentityProviderCreate { + builder::SamlIdentityProviderCreate::default() + } + } + ///Client view of a ['Silo'] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Silo { @@ -2124,6 +2552,12 @@ pub mod types { pub user_provision_type: UserProvisionType, } + impl Silo { + pub fn builder() -> builder::Silo { + builder::Silo::default() + } + } + ///Create-time parameters for a [`Silo`](crate::external_api::views::Silo) #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SiloCreate { @@ -2133,6 +2567,12 @@ pub mod types { pub user_provision_type: UserProvisionType, } + impl SiloCreate { + pub fn builder() -> builder::SiloCreate { + builder::SiloCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SiloResultsPage { @@ -2143,6 +2583,12 @@ pub mod types { pub next_page: Option, } + impl SiloResultsPage { + pub fn builder() -> builder::SiloResultsPage { + builder::SiloResultsPage::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum SiloRole { #[serde(rename = "admin")] @@ -2187,6 +2633,12 @@ pub mod types { pub role_assignments: Vec, } + impl SiloRolePolicy { + pub fn builder() -> builder::SiloRolePolicy { + builder::SiloRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -2200,6 +2652,12 @@ pub mod types { pub role_name: SiloRole, } + impl SiloRoleRoleAssignment { + pub fn builder() -> builder::SiloRoleRoleAssignment { + builder::SiloRoleRoleAssignment::default() + } + } + ///Client view of an [`Sled`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Sled { @@ -2212,6 +2670,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Sled { + pub fn builder() -> builder::Sled { + builder::Sled::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SledResultsPage { @@ -2222,6 +2686,12 @@ pub mod types { pub next_page: Option, } + impl SledResultsPage { + pub fn builder() -> builder::SledResultsPage { + builder::SledResultsPage::default() + } + } + ///Client view of a Snapshot #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Snapshot { @@ -2240,6 +2710,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Snapshot { + pub fn builder() -> builder::Snapshot { + builder::Snapshot::default() + } + } + ///Create-time parameters for a /// [`Snapshot`](omicron_common::api::external::Snapshot) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2250,6 +2726,12 @@ pub mod types { pub name: Name, } + impl SnapshotCreate { + pub fn builder() -> builder::SnapshotCreate { + builder::SnapshotCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SnapshotResultsPage { @@ -2260,11 +2742,23 @@ pub mod types { pub next_page: Option, } + impl SnapshotResultsPage { + pub fn builder() -> builder::SnapshotResultsPage { + builder::SnapshotResultsPage::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SpoofLoginBody { pub username: String, } + impl SpoofLoginBody { + pub fn builder() -> builder::SpoofLoginBody { + builder::SpoofLoginBody::default() + } + } + ///Client view of a [`SshKey`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SshKey { @@ -2284,6 +2778,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl SshKey { + pub fn builder() -> builder::SshKey { + builder::SshKey::default() + } + } + ///Create-time parameters for an /// [`SshKey`](crate::external_api::views::SshKey) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2294,6 +2794,12 @@ pub mod types { pub public_key: String, } + impl SshKeyCreate { + pub fn builder() -> builder::SshKeyCreate { + builder::SshKeyCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SshKeyResultsPage { @@ -2304,6 +2810,12 @@ pub mod types { pub next_page: Option, } + impl SshKeyResultsPage { + pub fn builder() -> builder::SshKeyResultsPage { + builder::SshKeyResultsPage::default() + } + } + ///Names are constructed by concatenating the target and metric names with /// ':'. Target and metric names must be lowercase alphanumeric characters /// with '_' separating words. @@ -2361,6 +2873,12 @@ pub mod types { pub timeseries_name: TimeseriesName, } + impl TimeseriesSchema { + pub fn builder() -> builder::TimeseriesSchema { + builder::TimeseriesSchema::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TimeseriesSchemaResultsPage { @@ -2371,6 +2889,12 @@ pub mod types { pub next_page: Option, } + impl TimeseriesSchemaResultsPage { + pub fn builder() -> builder::TimeseriesSchemaResultsPage { + builder::TimeseriesSchemaResultsPage::default() + } + } + ///Client view of a [`User`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct User { @@ -2379,6 +2903,12 @@ pub mod types { pub id: uuid::Uuid, } + impl User { + pub fn builder() -> builder::User { + builder::User::default() + } + } + ///Client view of a [`UserBuiltin`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserBuiltin { @@ -2394,6 +2924,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl UserBuiltin { + pub fn builder() -> builder::UserBuiltin { + builder::UserBuiltin::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserBuiltinResultsPage { @@ -2404,6 +2940,12 @@ pub mod types { pub next_page: Option, } + impl UserBuiltinResultsPage { + pub fn builder() -> builder::UserBuiltinResultsPage { + builder::UserBuiltinResultsPage::default() + } + } + ///How users will be provisioned in a silo during authentication. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum UserProvisionType { @@ -2443,6 +2985,12 @@ pub mod types { pub next_page: Option, } + impl UserResultsPage { + pub fn builder() -> builder::UserResultsPage { + builder::UserResultsPage::default() + } + } + ///Client view of a [`Vpc`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Vpc { @@ -2466,6 +3014,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Vpc { + pub fn builder() -> builder::Vpc { + builder::Vpc::default() + } + } + ///Create-time parameters for a [`Vpc`](crate::external_api::views::Vpc) #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcCreate { @@ -2482,6 +3036,12 @@ pub mod types { pub name: Name, } + impl VpcCreate { + pub fn builder() -> builder::VpcCreate { + builder::VpcCreate::default() + } + } + ///A single rule in a VPC firewall #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcFirewallRule { @@ -2511,6 +3071,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl VpcFirewallRule { + pub fn builder() -> builder::VpcFirewallRule { + builder::VpcFirewallRule::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum VpcFirewallRuleAction { #[serde(rename = "allow")] @@ -2584,6 +3150,12 @@ pub mod types { pub protocols: Option>, } + impl VpcFirewallRuleFilter { + pub fn builder() -> builder::VpcFirewallRuleFilter { + builder::VpcFirewallRuleFilter::default() + } + } + ///The `VpcFirewallRuleHostFilter` is used to filter traffic on the basis /// of its source or destination host. #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2710,6 +3282,12 @@ pub mod types { pub targets: Vec, } + impl VpcFirewallRuleUpdate { + pub fn builder() -> builder::VpcFirewallRuleUpdate { + builder::VpcFirewallRuleUpdate::default() + } + } + ///Updateable properties of a `Vpc`'s firewall Note that VpcFirewallRules /// are implicitly created along with a Vpc, so there is no explicit /// creation. @@ -2718,12 +3296,24 @@ pub mod types { pub rules: Vec, } + impl VpcFirewallRuleUpdateParams { + pub fn builder() -> builder::VpcFirewallRuleUpdateParams { + builder::VpcFirewallRuleUpdateParams::default() + } + } + ///Collection of a [`Vpc`]'s firewall rules #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcFirewallRules { pub rules: Vec, } + impl VpcFirewallRules { + pub fn builder() -> builder::VpcFirewallRules { + builder::VpcFirewallRules::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcResultsPage { @@ -2734,6 +3324,12 @@ pub mod types { pub next_page: Option, } + impl VpcResultsPage { + pub fn builder() -> builder::VpcResultsPage { + builder::VpcResultsPage::default() + } + } + ///A VPC router defines a series of rules that indicate where traffic /// should be sent depending on its destination. #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2753,6 +3349,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl VpcRouter { + pub fn builder() -> builder::VpcRouter { + builder::VpcRouter::default() + } + } + ///Create-time parameters for a /// [`VpcRouter`](crate::external_api::views::VpcRouter) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2761,6 +3363,12 @@ pub mod types { pub name: Name, } + impl VpcRouterCreate { + pub fn builder() -> builder::VpcRouterCreate { + builder::VpcRouterCreate::default() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum VpcRouterKind { #[serde(rename = "system")] @@ -2799,6 +3407,12 @@ pub mod types { pub next_page: Option, } + impl VpcRouterResultsPage { + pub fn builder() -> builder::VpcRouterResultsPage { + builder::VpcRouterResultsPage::default() + } + } + ///Updateable properties of a /// [`VpcRouter`](crate::external_api::views::VpcRouter) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2809,6 +3423,12 @@ pub mod types { pub name: Option, } + impl VpcRouterUpdate { + pub fn builder() -> builder::VpcRouterUpdate { + builder::VpcRouterUpdate::default() + } + } + ///A VPC subnet represents a logical grouping for instances that allows /// network traffic between them, within a IPv4 subnetwork or optionall an /// IPv6 subnetwork. @@ -2832,6 +3452,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl VpcSubnet { + pub fn builder() -> builder::VpcSubnet { + builder::VpcSubnet::default() + } + } + ///Create-time parameters for a /// [`VpcSubnet`](crate::external_api::views::VpcSubnet) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2853,6 +3479,12 @@ pub mod types { pub name: Name, } + impl VpcSubnetCreate { + pub fn builder() -> builder::VpcSubnetCreate { + builder::VpcSubnetCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcSubnetResultsPage { @@ -2863,6 +3495,12 @@ pub mod types { pub next_page: Option, } + impl VpcSubnetResultsPage { + pub fn builder() -> builder::VpcSubnetResultsPage { + builder::VpcSubnetResultsPage::default() + } + } + ///Updateable properties of a /// [`VpcSubnet`](crate::external_api::views::VpcSubnet) #[derive(Clone, Debug, Deserialize, Serialize)] @@ -2873,6 +3511,12 @@ pub mod types { pub name: Option, } + impl VpcSubnetUpdate { + pub fn builder() -> builder::VpcSubnetUpdate { + builder::VpcSubnetUpdate::default() + } + } + ///Updateable properties of a [`Vpc`](crate::external_api::views::Vpc) #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcUpdate { @@ -2883,6 +3527,7470 @@ pub mod types { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } + + impl VpcUpdate { + pub fn builder() -> builder::VpcUpdate { + builder::VpcUpdate::default() + } + } + + mod builder { + pub struct Bindouble { + count: Result, + range: Result, + } + + impl Default for Bindouble { + fn default() -> Self { + Self { + count: Err("no value supplied for count".to_string()), + range: Err("no value supplied for range".to_string()), + } + } + } + + impl Bindouble { + pub fn count(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.count = value + .try_into() + .map_err(|e| format!("error converting supplied value for count: {}", e)); + self + } + pub fn range(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.range = value + .try_into() + .map_err(|e| format!("error converting supplied value for range: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Bindouble { + type Error = String; + fn try_from(value: Bindouble) -> Result { + Ok(Self { + count: value.count?, + range: value.range?, + }) + } + } + + pub struct Binint64 { + count: Result, + range: Result, + } + + impl Default for Binint64 { + fn default() -> Self { + Self { + count: Err("no value supplied for count".to_string()), + range: Err("no value supplied for range".to_string()), + } + } + } + + impl Binint64 { + pub fn count(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.count = value + .try_into() + .map_err(|e| format!("error converting supplied value for count: {}", e)); + self + } + pub fn range(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.range = value + .try_into() + .map_err(|e| format!("error converting supplied value for range: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Binint64 { + type Error = String; + fn try_from(value: Binint64) -> Result { + Ok(Self { + count: value.count?, + range: value.range?, + }) + } + } + + pub struct Cumulativedouble { + start_time: Result, String>, + value: Result, + } + + impl Default for Cumulativedouble { + fn default() -> Self { + Self { + start_time: Err("no value supplied for start_time".to_string()), + value: Err("no value supplied for value".to_string()), + } + } + } + + impl Cumulativedouble { + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + pub fn value(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.value = value + .try_into() + .map_err(|e| format!("error converting supplied value for value: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Cumulativedouble { + type Error = String; + fn try_from(value: Cumulativedouble) -> Result { + Ok(Self { + start_time: value.start_time?, + value: value.value?, + }) + } + } + + pub struct Cumulativeint64 { + start_time: Result, String>, + value: Result, + } + + impl Default for Cumulativeint64 { + fn default() -> Self { + Self { + start_time: Err("no value supplied for start_time".to_string()), + value: Err("no value supplied for value".to_string()), + } + } + } + + impl Cumulativeint64 { + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + pub fn value(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.value = value + .try_into() + .map_err(|e| format!("error converting supplied value for value: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Cumulativeint64 { + type Error = String; + fn try_from(value: Cumulativeint64) -> Result { + Ok(Self { + start_time: value.start_time?, + value: value.value?, + }) + } + } + + pub struct DerEncodedKeyPair { + private_key: Result, + public_cert: Result, + } + + impl Default for DerEncodedKeyPair { + fn default() -> Self { + Self { + private_key: Err("no value supplied for private_key".to_string()), + public_cert: Err("no value supplied for public_cert".to_string()), + } + } + } + + impl DerEncodedKeyPair { + pub fn private_key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.private_key = value + .try_into() + .map_err(|e| format!("error converting supplied value for private_key: {}", e)); + self + } + pub fn public_cert(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.public_cert = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_cert: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DerEncodedKeyPair { + type Error = String; + fn try_from(value: DerEncodedKeyPair) -> Result { + Ok(Self { + private_key: value.private_key?, + public_cert: value.public_cert?, + }) + } + } + + pub struct DeviceAccessTokenRequest { + client_id: Result, + device_code: Result, + grant_type: Result, + } + + impl Default for DeviceAccessTokenRequest { + fn default() -> Self { + Self { + client_id: Err("no value supplied for client_id".to_string()), + device_code: Err("no value supplied for device_code".to_string()), + grant_type: Err("no value supplied for grant_type".to_string()), + } + } + } + + impl DeviceAccessTokenRequest { + pub fn client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.client_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for client_id: {}", e)); + self + } + pub fn device_code(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.device_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for device_code: {}", e)); + self + } + pub fn grant_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.grant_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for grant_type: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DeviceAccessTokenRequest { + type Error = String; + fn try_from(value: DeviceAccessTokenRequest) -> Result { + Ok(Self { + client_id: value.client_id?, + device_code: value.device_code?, + grant_type: value.grant_type?, + }) + } + } + + pub struct DeviceAuthRequest { + client_id: Result, + } + + impl Default for DeviceAuthRequest { + fn default() -> Self { + Self { + client_id: Err("no value supplied for client_id".to_string()), + } + } + } + + impl DeviceAuthRequest { + pub fn client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.client_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for client_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DeviceAuthRequest { + type Error = String; + fn try_from(value: DeviceAuthRequest) -> Result { + Ok(Self { + client_id: value.client_id?, + }) + } + } + + pub struct DeviceAuthVerify { + user_code: Result, + } + + impl Default for DeviceAuthVerify { + fn default() -> Self { + Self { + user_code: Err("no value supplied for user_code".to_string()), + } + } + } + + impl DeviceAuthVerify { + pub fn user_code(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for user_code: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DeviceAuthVerify { + type Error = String; + fn try_from(value: DeviceAuthVerify) -> Result { + Ok(Self { + user_code: value.user_code?, + }) + } + } + + pub struct Disk { + block_size: Result, + description: Result, + device_path: Result, + id: Result, + image_id: Result, String>, + name: Result, + project_id: Result, + size: Result, + snapshot_id: Result, String>, + state: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Disk { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + device_path: Err("no value supplied for device_path".to_string()), + id: Err("no value supplied for id".to_string()), + image_id: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + size: Err("no value supplied for size".to_string()), + snapshot_id: Ok(Default::default()), + state: Err("no value supplied for state".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Disk { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 device_path(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.device_path = value + .try_into() + .map_err(|e| format!("error converting supplied value for device_path: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn image_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.image_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for image_id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn snapshot_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.snapshot_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for snapshot_id: {}", e)); + self + } + pub fn state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.state = value + .try_into() + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Disk { + type Error = String; + fn try_from(value: Disk) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + device_path: value.device_path?, + id: value.id?, + image_id: value.image_id?, + name: value.name?, + project_id: value.project_id?, + size: value.size?, + snapshot_id: value.snapshot_id?, + state: value.state?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct DiskCreate { + description: Result, + disk_source: Result, + name: Result, + size: Result, + } + + impl Default for DiskCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disk_source: Err("no value supplied for disk_source".to_string()), + name: Err("no value supplied for name".to_string()), + size: Err("no value supplied for size".to_string()), + } + } + } + + impl DiskCreate { + 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 disk_source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.disk_source = value + .try_into() + .map_err(|e| format!("error converting supplied value for disk_source: {}", 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 + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DiskCreate { + type Error = String; + fn try_from(value: DiskCreate) -> Result { + Ok(Self { + description: value.description?, + disk_source: value.disk_source?, + name: value.name?, + size: value.size?, + }) + } + } + + pub struct DiskIdentifier { + name: Result, + } + + impl Default for DiskIdentifier { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + } + } + } + + impl DiskIdentifier { + 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::DiskIdentifier { + type Error = String; + fn try_from(value: DiskIdentifier) -> Result { + Ok(Self { name: value.name? }) + } + } + + pub struct DiskResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for DiskResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl DiskResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DiskResultsPage { + type Error = String; + fn try_from(value: DiskResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Distribution { + name: Result, + version: Result, + } + + impl Default for Distribution { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + version: Err("no value supplied for version".to_string()), + } + } + } + + impl Distribution { + 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 + } + pub fn version(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Distribution { + type Error = String; + fn try_from(value: Distribution) -> Result { + Ok(Self { + name: value.name?, + version: value.version?, + }) + } + } + + pub struct Error { + error_code: Result, String>, + message: Result, + request_id: Result, + } + + impl Default for Error { + fn default() -> Self { + Self { + error_code: Ok(Default::default()), + message: Err("no value supplied for message".to_string()), + request_id: Err("no value supplied for request_id".to_string()), + } + } + } + + impl Error { + pub fn error_code(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.error_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for error_code: {}", e)); + self + } + pub fn message(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.message = value + .try_into() + .map_err(|e| format!("error converting supplied value for message: {}", e)); + self + } + pub fn request_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.request_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for request_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Error { + type Error = String; + fn try_from(value: Error) -> Result { + Ok(Self { + error_code: value.error_code?, + message: value.message?, + request_id: value.request_id?, + }) + } + } + + pub struct ExternalIp { + ip: Result, + kind: Result, + } + + impl Default for ExternalIp { + fn default() -> Self { + Self { + ip: Err("no value supplied for ip".to_string()), + kind: Err("no value supplied for kind".to_string()), + } + } + } + + impl ExternalIp { + pub fn ip(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ip = value + .try_into() + .map_err(|e| format!("error converting supplied value for ip: {}", e)); + self + } + pub fn kind(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.kind = value + .try_into() + .map_err(|e| format!("error converting supplied value for kind: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ExternalIp { + type Error = String; + fn try_from(value: ExternalIp) -> Result { + Ok(Self { + ip: value.ip?, + kind: value.kind?, + }) + } + } + + pub struct ExternalIpResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for ExternalIpResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl ExternalIpResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ExternalIpResultsPage { + type Error = String; + fn try_from(value: ExternalIpResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct FieldSchema { + name: Result, + source: Result, + ty: Result, + } + + impl Default for FieldSchema { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + source: Err("no value supplied for source".to_string()), + ty: Err("no value supplied for ty".to_string()), + } + } + } + + impl FieldSchema { + 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 + } + pub fn source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + pub fn ty(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ty = value + .try_into() + .map_err(|e| format!("error converting supplied value for ty: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::FieldSchema { + type Error = String; + fn try_from(value: FieldSchema) -> Result { + Ok(Self { + name: value.name?, + source: value.source?, + ty: value.ty?, + }) + } + } + + pub struct FleetRolePolicy { + role_assignments: Result, String>, + } + + impl Default for FleetRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl FleetRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::FleetRolePolicy { + type Error = String; + fn try_from(value: FleetRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct FleetRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for FleetRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl FleetRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::FleetRoleRoleAssignment { + type Error = String; + fn try_from(value: FleetRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct GlobalImage { + block_size: Result, + description: Result, + digest: Result, String>, + distribution: Result, + id: Result, + name: Result, + size: Result, + time_created: Result, String>, + time_modified: Result, String>, + url: Result, String>, + version: Result, + } + + impl Default for GlobalImage { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + digest: Ok(Default::default()), + distribution: Err("no value supplied for distribution".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + size: Err("no value supplied for size".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + url: Ok(Default::default()), + version: Err("no value supplied for version".to_string()), + } + } + } + + impl GlobalImage { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 digest(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.digest = value + .try_into() + .map_err(|e| format!("error converting supplied value for digest: {}", e)); + self + } + pub fn distribution(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.distribution = value.try_into().map_err(|e| { + format!("error converting supplied value for distribution: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn url(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.url = value + .try_into() + .map_err(|e| format!("error converting supplied value for url: {}", e)); + self + } + pub fn version(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalImage { + type Error = String; + fn try_from(value: GlobalImage) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + digest: value.digest?, + distribution: value.distribution?, + id: value.id?, + name: value.name?, + size: value.size?, + time_created: value.time_created?, + time_modified: value.time_modified?, + url: value.url?, + version: value.version?, + }) + } + } + + pub struct GlobalImageCreate { + block_size: Result, + description: Result, + distribution: Result, + name: Result, + source: Result, + } + + impl Default for GlobalImageCreate { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + distribution: Err("no value supplied for distribution".to_string()), + name: Err("no value supplied for name".to_string()), + source: Err("no value supplied for source".to_string()), + } + } + } + + impl GlobalImageCreate { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 distribution(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.distribution = value.try_into().map_err(|e| { + format!("error converting supplied value for distribution: {}", 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 + } + pub fn source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalImageCreate { + type Error = String; + fn try_from(value: GlobalImageCreate) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + distribution: value.distribution?, + name: value.name?, + source: value.source?, + }) + } + } + + pub struct GlobalImageResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for GlobalImageResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl GlobalImageResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalImageResultsPage { + type Error = String; + fn try_from(value: GlobalImageResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Histogramdouble { + bins: Result, String>, + n_samples: Result, + start_time: Result, String>, + } + + impl Default for Histogramdouble { + fn default() -> Self { + Self { + bins: Err("no value supplied for bins".to_string()), + n_samples: Err("no value supplied for n_samples".to_string()), + start_time: Err("no value supplied for start_time".to_string()), + } + } + } + + impl Histogramdouble { + pub fn bins(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.bins = value + .try_into() + .map_err(|e| format!("error converting supplied value for bins: {}", e)); + self + } + pub fn n_samples(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.n_samples = value + .try_into() + .map_err(|e| format!("error converting supplied value for n_samples: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Histogramdouble { + type Error = String; + fn try_from(value: Histogramdouble) -> Result { + Ok(Self { + bins: value.bins?, + n_samples: value.n_samples?, + start_time: value.start_time?, + }) + } + } + + pub struct Histogramint64 { + bins: Result, String>, + n_samples: Result, + start_time: Result, String>, + } + + impl Default for Histogramint64 { + fn default() -> Self { + Self { + bins: Err("no value supplied for bins".to_string()), + n_samples: Err("no value supplied for n_samples".to_string()), + start_time: Err("no value supplied for start_time".to_string()), + } + } + } + + impl Histogramint64 { + pub fn bins(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.bins = value + .try_into() + .map_err(|e| format!("error converting supplied value for bins: {}", e)); + self + } + pub fn n_samples(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.n_samples = value + .try_into() + .map_err(|e| format!("error converting supplied value for n_samples: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Histogramint64 { + type Error = String; + fn try_from(value: Histogramint64) -> Result { + Ok(Self { + bins: value.bins?, + n_samples: value.n_samples?, + start_time: value.start_time?, + }) + } + } + + pub struct IdentityProvider { + description: Result, + id: Result, + name: Result, + provider_type: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for IdentityProvider { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + provider_type: Err("no value supplied for provider_type".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl IdentityProvider { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn provider_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.provider_type = value.try_into().map_err(|e| { + format!("error converting supplied value for provider_type: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::IdentityProvider { + type Error = String; + fn try_from(value: IdentityProvider) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + provider_type: value.provider_type?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct IdentityProviderResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for IdentityProviderResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl IdentityProviderResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IdentityProviderResultsPage { + type Error = String; + fn try_from(value: IdentityProviderResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Image { + block_size: Result, + description: Result, + digest: Result, String>, + id: Result, + name: Result, + project_id: Result, + size: Result, + time_created: Result, String>, + time_modified: Result, String>, + url: Result, String>, + version: Result, String>, + } + + impl Default for Image { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + digest: Ok(Default::default()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + size: Err("no value supplied for size".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + url: Ok(Default::default()), + version: Ok(Default::default()), + } + } + } + + impl Image { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 digest(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.digest = value + .try_into() + .map_err(|e| format!("error converting supplied value for digest: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn url(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.url = value + .try_into() + .map_err(|e| format!("error converting supplied value for url: {}", e)); + self + } + pub fn version(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Image { + type Error = String; + fn try_from(value: Image) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + digest: value.digest?, + id: value.id?, + name: value.name?, + project_id: value.project_id?, + size: value.size?, + time_created: value.time_created?, + time_modified: value.time_modified?, + url: value.url?, + version: value.version?, + }) + } + } + + pub struct ImageCreate { + block_size: Result, + description: Result, + name: Result, + source: Result, + } + + impl Default for ImageCreate { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + source: Err("no value supplied for source".to_string()), + } + } + } + + impl ImageCreate { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 + } + pub fn source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ImageCreate { + type Error = String; + fn try_from(value: ImageCreate) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + name: value.name?, + source: value.source?, + }) + } + } + + pub struct ImageResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for ImageResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl ImageResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ImageResultsPage { + type Error = String; + fn try_from(value: ImageResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Instance { + description: Result, + hostname: Result, + id: Result, + memory: Result, + name: Result, + ncpus: Result, + project_id: Result, + run_state: Result, + time_created: Result, String>, + time_modified: Result, String>, + time_run_state_updated: Result, String>, + } + + impl Default for Instance { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + hostname: Err("no value supplied for hostname".to_string()), + id: Err("no value supplied for id".to_string()), + memory: Err("no value supplied for memory".to_string()), + name: Err("no value supplied for name".to_string()), + ncpus: Err("no value supplied for ncpus".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + run_state: Err("no value supplied for run_state".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + time_run_state_updated: Err( + "no value supplied for time_run_state_updated".to_string() + ), + } + } + } + + impl Instance { + 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 hostname(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.hostname = value + .try_into() + .map_err(|e| format!("error converting supplied value for hostname: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn memory(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.memory = value + .try_into() + .map_err(|e| format!("error converting supplied value for memory: {}", 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 + } + pub fn ncpus(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ncpus = value + .try_into() + .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); + self + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn run_state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.run_state = value + .try_into() + .map_err(|e| format!("error converting supplied value for run_state: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn time_run_state_updated(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_run_state_updated = value.try_into().map_err(|e| { + format!( + "error converting supplied value for time_run_state_updated: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::Instance { + type Error = String; + fn try_from(value: Instance) -> Result { + Ok(Self { + description: value.description?, + hostname: value.hostname?, + id: value.id?, + memory: value.memory?, + name: value.name?, + ncpus: value.ncpus?, + project_id: value.project_id?, + run_state: value.run_state?, + time_created: value.time_created?, + time_modified: value.time_modified?, + time_run_state_updated: value.time_run_state_updated?, + }) + } + } + + pub struct InstanceCreate { + description: Result, + disks: Result, String>, + external_ips: Result, String>, + hostname: Result, + memory: Result, + name: Result, + ncpus: Result, + network_interfaces: Result, + user_data: Result, + } + + impl Default for InstanceCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disks: Ok(Default::default()), + external_ips: Ok(Default::default()), + hostname: Err("no value supplied for hostname".to_string()), + memory: Err("no value supplied for memory".to_string()), + name: Err("no value supplied for name".to_string()), + ncpus: Err("no value supplied for ncpus".to_string()), + network_interfaces: Ok(super::defaults::instance_create_network_interfaces()), + user_data: Ok(Default::default()), + } + } + } + + impl InstanceCreate { + 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 disks(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.disks = value + .try_into() + .map_err(|e| format!("error converting supplied value for disks: {}", e)); + self + } + pub fn external_ips(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.external_ips = value.try_into().map_err(|e| { + format!("error converting supplied value for external_ips: {}", e) + }); + self + } + pub fn hostname(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.hostname = value + .try_into() + .map_err(|e| format!("error converting supplied value for hostname: {}", e)); + self + } + pub fn memory(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.memory = value + .try_into() + .map_err(|e| format!("error converting supplied value for memory: {}", 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 + } + pub fn ncpus(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ncpus = value + .try_into() + .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); + self + } + pub fn network_interfaces(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.network_interfaces = value.try_into().map_err(|e| { + format!( + "error converting supplied value for network_interfaces: {}", + e + ) + }); + self + } + pub fn user_data(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_data = value + .try_into() + .map_err(|e| format!("error converting supplied value for user_data: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::InstanceCreate { + type Error = String; + fn try_from(value: InstanceCreate) -> Result { + Ok(Self { + description: value.description?, + disks: value.disks?, + external_ips: value.external_ips?, + hostname: value.hostname?, + memory: value.memory?, + name: value.name?, + ncpus: value.ncpus?, + network_interfaces: value.network_interfaces?, + user_data: value.user_data?, + }) + } + } + + pub struct InstanceMigrate { + dst_sled_id: Result, + } + + impl Default for InstanceMigrate { + fn default() -> Self { + Self { + dst_sled_id: Err("no value supplied for dst_sled_id".to_string()), + } + } + } + + impl InstanceMigrate { + pub fn dst_sled_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dst_sled_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for dst_sled_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::InstanceMigrate { + type Error = String; + fn try_from(value: InstanceMigrate) -> Result { + Ok(Self { + dst_sled_id: value.dst_sled_id?, + }) + } + } + + pub struct InstanceResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for InstanceResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl InstanceResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::InstanceResultsPage { + type Error = String; + fn try_from(value: InstanceResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct InstanceSerialConsoleData { + data: Result, String>, + last_byte_offset: Result, + } + + impl Default for InstanceSerialConsoleData { + fn default() -> Self { + Self { + data: Err("no value supplied for data".to_string()), + last_byte_offset: Err("no value supplied for last_byte_offset".to_string()), + } + } + } + + impl InstanceSerialConsoleData { + pub fn data(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.data = value + .try_into() + .map_err(|e| format!("error converting supplied value for data: {}", e)); + self + } + pub fn last_byte_offset(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.last_byte_offset = value.try_into().map_err(|e| { + format!( + "error converting supplied value for last_byte_offset: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::InstanceSerialConsoleData { + type Error = String; + fn try_from(value: InstanceSerialConsoleData) -> Result { + Ok(Self { + data: value.data?, + last_byte_offset: value.last_byte_offset?, + }) + } + } + + pub struct IpPool { + description: Result, + id: Result, + name: Result, + project_id: Result, String>, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for IpPool { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Ok(Default::default()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl IpPool { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::IpPool { + type Error = String; + fn try_from(value: IpPool) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + project_id: value.project_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct IpPoolCreate { + description: Result, + name: Result, + organization: Result, String>, + project: Result, String>, + } + + impl Default for IpPoolCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + organization: Ok(Default::default()), + project: Ok(Default::default()), + } + } + } + + impl IpPoolCreate { + 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 + } + pub fn organization(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.organization = value.try_into().map_err(|e| { + format!("error converting supplied value for organization: {}", e) + }); + self + } + pub fn project(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.project = value + .try_into() + .map_err(|e| format!("error converting supplied value for project: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IpPoolCreate { + type Error = String; + fn try_from(value: IpPoolCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + organization: value.organization?, + project: value.project?, + }) + } + } + + pub struct IpPoolRange { + id: Result, + range: Result, + time_created: Result, String>, + } + + impl Default for IpPoolRange { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + range: Err("no value supplied for range".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + } + } + } + + impl IpPoolRange { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn range(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.range = value + .try_into() + .map_err(|e| format!("error converting supplied value for range: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::IpPoolRange { + type Error = String; + fn try_from(value: IpPoolRange) -> Result { + Ok(Self { + id: value.id?, + range: value.range?, + time_created: value.time_created?, + }) + } + } + + pub struct IpPoolRangeResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for IpPoolRangeResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl IpPoolRangeResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IpPoolRangeResultsPage { + type Error = String; + fn try_from(value: IpPoolRangeResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct IpPoolResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for IpPoolResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl IpPoolResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IpPoolResultsPage { + type Error = String; + fn try_from(value: IpPoolResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct IpPoolUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for IpPoolUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl IpPoolUpdate { + 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::IpPoolUpdate { + type Error = String; + fn try_from(value: IpPoolUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct Ipv4Range { + first: Result, + last: Result, + } + + impl Default for Ipv4Range { + fn default() -> Self { + Self { + first: Err("no value supplied for first".to_string()), + last: Err("no value supplied for last".to_string()), + } + } + } + + impl Ipv4Range { + pub fn first(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.first = value + .try_into() + .map_err(|e| format!("error converting supplied value for first: {}", e)); + self + } + pub fn last(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.last = value + .try_into() + .map_err(|e| format!("error converting supplied value for last: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Ipv4Range { + type Error = String; + fn try_from(value: Ipv4Range) -> Result { + Ok(Self { + first: value.first?, + last: value.last?, + }) + } + } + + pub struct Ipv6Range { + first: Result, + last: Result, + } + + impl Default for Ipv6Range { + fn default() -> Self { + Self { + first: Err("no value supplied for first".to_string()), + last: Err("no value supplied for last".to_string()), + } + } + } + + impl Ipv6Range { + pub fn first(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.first = value + .try_into() + .map_err(|e| format!("error converting supplied value for first: {}", e)); + self + } + pub fn last(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.last = value + .try_into() + .map_err(|e| format!("error converting supplied value for last: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Ipv6Range { + type Error = String; + fn try_from(value: Ipv6Range) -> Result { + Ok(Self { + first: value.first?, + last: value.last?, + }) + } + } + + pub struct Measurement { + datum: Result, + timestamp: Result, String>, + } + + impl Default for Measurement { + fn default() -> Self { + Self { + datum: Err("no value supplied for datum".to_string()), + timestamp: Err("no value supplied for timestamp".to_string()), + } + } + } + + impl Measurement { + pub fn datum(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.datum = value + .try_into() + .map_err(|e| format!("error converting supplied value for datum: {}", e)); + self + } + pub fn timestamp(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.timestamp = value + .try_into() + .map_err(|e| format!("error converting supplied value for timestamp: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Measurement { + type Error = String; + fn try_from(value: Measurement) -> Result { + Ok(Self { + datum: value.datum?, + timestamp: value.timestamp?, + }) + } + } + + pub struct MeasurementResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for MeasurementResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl MeasurementResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::MeasurementResultsPage { + type Error = String; + fn try_from(value: MeasurementResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct NetworkInterface { + description: Result, + id: Result, + instance_id: Result, + ip: Result, + mac: Result, + name: Result, + primary: Result, + subnet_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for NetworkInterface { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + instance_id: Err("no value supplied for instance_id".to_string()), + ip: Err("no value supplied for ip".to_string()), + mac: Err("no value supplied for mac".to_string()), + name: Err("no value supplied for name".to_string()), + primary: Err("no value supplied for primary".to_string()), + subnet_id: Err("no value supplied for subnet_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl NetworkInterface { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn instance_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.instance_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for instance_id: {}", e)); + self + } + pub fn ip(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ip = value + .try_into() + .map_err(|e| format!("error converting supplied value for ip: {}", e)); + self + } + pub fn mac(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.mac = value + .try_into() + .map_err(|e| format!("error converting supplied value for mac: {}", 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 + } + pub fn primary(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.primary = value + .try_into() + .map_err(|e| format!("error converting supplied value for primary: {}", e)); + self + } + pub fn subnet_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.subnet_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for subnet_id: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NetworkInterface { + type Error = String; + fn try_from(value: NetworkInterface) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + instance_id: value.instance_id?, + ip: value.ip?, + mac: value.mac?, + name: value.name?, + primary: value.primary?, + subnet_id: value.subnet_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct NetworkInterfaceCreate { + description: Result, + ip: Result, String>, + name: Result, + subnet_name: Result, + vpc_name: Result, + } + + impl Default for NetworkInterfaceCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + ip: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + subnet_name: Err("no value supplied for subnet_name".to_string()), + vpc_name: Err("no value supplied for vpc_name".to_string()), + } + } + } + + impl NetworkInterfaceCreate { + 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 ip(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.ip = value + .try_into() + .map_err(|e| format!("error converting supplied value for ip: {}", 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 + } + pub fn subnet_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.subnet_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for subnet_name: {}", e)); + self + } + pub fn vpc_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NetworkInterfaceCreate { + type Error = String; + fn try_from(value: NetworkInterfaceCreate) -> Result { + Ok(Self { + description: value.description?, + ip: value.ip?, + name: value.name?, + subnet_name: value.subnet_name?, + vpc_name: value.vpc_name?, + }) + } + } + + pub struct NetworkInterfaceResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for NetworkInterfaceResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl NetworkInterfaceResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NetworkInterfaceResultsPage { + type Error = String; + fn try_from(value: NetworkInterfaceResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct NetworkInterfaceUpdate { + description: Result, String>, + make_primary: Result, + name: Result, String>, + } + + impl Default for NetworkInterfaceUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + make_primary: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl NetworkInterfaceUpdate { + 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 make_primary(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.make_primary = value.try_into().map_err(|e| { + format!("error converting supplied value for make_primary: {}", 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::NetworkInterfaceUpdate { + type Error = String; + fn try_from(value: NetworkInterfaceUpdate) -> Result { + Ok(Self { + description: value.description?, + make_primary: value.make_primary?, + name: value.name?, + }) + } + } + + pub struct Organization { + description: Result, + id: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Organization { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Organization { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Organization { + type Error = String; + fn try_from(value: Organization) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct OrganizationCreate { + description: Result, + name: Result, + } + + impl Default for OrganizationCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl OrganizationCreate { + 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::OrganizationCreate { + type Error = String; + fn try_from(value: OrganizationCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct OrganizationResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for OrganizationResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl OrganizationResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::OrganizationResultsPage { + type Error = String; + fn try_from(value: OrganizationResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct OrganizationRolePolicy { + role_assignments: Result, String>, + } + + impl Default for OrganizationRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl OrganizationRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::OrganizationRolePolicy { + type Error = String; + fn try_from(value: OrganizationRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct OrganizationRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for OrganizationRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl OrganizationRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom + for super::OrganizationRoleRoleAssignment + { + type Error = String; + fn try_from(value: OrganizationRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct OrganizationUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for OrganizationUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl OrganizationUpdate { + 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::OrganizationUpdate { + type Error = String; + fn try_from(value: OrganizationUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct Project { + description: Result, + id: Result, + name: Result, + organization_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Project { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + organization_id: Err("no value supplied for organization_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Project { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn organization_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.organization_id = value.try_into().map_err(|e| { + format!("error converting supplied value for organization_id: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Project { + type Error = String; + fn try_from(value: Project) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + organization_id: value.organization_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct ProjectCreate { + description: Result, + name: Result, + } + + impl Default for ProjectCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl ProjectCreate { + 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::ProjectCreate { + type Error = String; + fn try_from(value: ProjectCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct ProjectResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for ProjectResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl ProjectResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ProjectResultsPage { + type Error = String; + fn try_from(value: ProjectResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct ProjectRolePolicy { + role_assignments: Result, String>, + } + + impl Default for ProjectRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl ProjectRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::ProjectRolePolicy { + type Error = String; + fn try_from(value: ProjectRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct ProjectRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for ProjectRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl ProjectRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ProjectRoleRoleAssignment { + type Error = String; + fn try_from(value: ProjectRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct ProjectUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for ProjectUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl ProjectUpdate { + 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::ProjectUpdate { + type Error = String; + fn try_from(value: ProjectUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct Rack { + id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Rack { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Rack { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Rack { + type Error = String; + fn try_from(value: Rack) -> Result { + Ok(Self { + id: value.id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct RackResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for RackResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl RackResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RackResultsPage { + type Error = String; + fn try_from(value: RackResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Role { + description: Result, + name: Result, + } + + impl Default for Role { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl Role { + 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::Role { + type Error = String; + fn try_from(value: Role) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct RoleResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for RoleResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl RoleResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RoleResultsPage { + type Error = String; + fn try_from(value: RoleResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct RouterRoute { + description: Result, + destination: Result, + id: Result, + kind: Result, + name: Result, + target: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_router_id: Result, + } + + impl Default for RouterRoute { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + destination: Err("no value supplied for destination".to_string()), + id: Err("no value supplied for id".to_string()), + kind: Err("no value supplied for kind".to_string()), + name: Err("no value supplied for name".to_string()), + target: Err("no value supplied for target".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_router_id: Err("no value supplied for vpc_router_id".to_string()), + } + } + } + + impl RouterRoute { + 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 destination(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.destination = value + .try_into() + .map_err(|e| format!("error converting supplied value for destination: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn kind(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.kind = value + .try_into() + .map_err(|e| format!("error converting supplied value for kind: {}", 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 + } + pub fn target(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.target = value + .try_into() + .map_err(|e| format!("error converting supplied value for target: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_router_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_router_id = value.try_into().map_err(|e| { + format!("error converting supplied value for vpc_router_id: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::RouterRoute { + type Error = String; + fn try_from(value: RouterRoute) -> Result { + Ok(Self { + description: value.description?, + destination: value.destination?, + id: value.id?, + kind: value.kind?, + name: value.name?, + target: value.target?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_router_id: value.vpc_router_id?, + }) + } + } + + pub struct RouterRouteCreateParams { + description: Result, + destination: Result, + name: Result, + target: Result, + } + + impl Default for RouterRouteCreateParams { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + destination: Err("no value supplied for destination".to_string()), + name: Err("no value supplied for name".to_string()), + target: Err("no value supplied for target".to_string()), + } + } + } + + impl RouterRouteCreateParams { + 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 destination(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.destination = value + .try_into() + .map_err(|e| format!("error converting supplied value for destination: {}", 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 + } + pub fn target(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.target = value + .try_into() + .map_err(|e| format!("error converting supplied value for target: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouterRouteCreateParams { + type Error = String; + fn try_from(value: RouterRouteCreateParams) -> Result { + Ok(Self { + description: value.description?, + destination: value.destination?, + name: value.name?, + target: value.target?, + }) + } + } + + pub struct RouterRouteResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for RouterRouteResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl RouterRouteResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouterRouteResultsPage { + type Error = String; + fn try_from(value: RouterRouteResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct RouterRouteUpdateParams { + description: Result, String>, + destination: Result, + name: Result, String>, + target: Result, + } + + impl Default for RouterRouteUpdateParams { + fn default() -> Self { + Self { + description: Ok(Default::default()), + destination: Err("no value supplied for destination".to_string()), + name: Ok(Default::default()), + target: Err("no value supplied for target".to_string()), + } + } + } + + impl RouterRouteUpdateParams { + 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 destination(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.destination = value + .try_into() + .map_err(|e| format!("error converting supplied value for destination: {}", 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 + } + pub fn target(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.target = value + .try_into() + .map_err(|e| format!("error converting supplied value for target: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouterRouteUpdateParams { + type Error = String; + fn try_from(value: RouterRouteUpdateParams) -> Result { + Ok(Self { + description: value.description?, + destination: value.destination?, + name: value.name?, + target: value.target?, + }) + } + } + + pub struct Saga { + id: Result, + state: Result, + } + + impl Default for Saga { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + state: Err("no value supplied for state".to_string()), + } + } + } + + impl Saga { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.state = value + .try_into() + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Saga { + type Error = String; + fn try_from(value: Saga) -> Result { + Ok(Self { + id: value.id?, + state: value.state?, + }) + } + } + + pub struct SagaResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SagaResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SagaResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SagaResultsPage { + type Error = String; + fn try_from(value: SagaResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct SamlIdentityProvider { + acs_url: Result, + description: Result, + id: Result, + idp_entity_id: Result, + name: Result, + public_cert: Result, String>, + slo_url: Result, + sp_client_id: Result, + technical_contact_email: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for SamlIdentityProvider { + fn default() -> Self { + Self { + acs_url: Err("no value supplied for acs_url".to_string()), + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + idp_entity_id: Err("no value supplied for idp_entity_id".to_string()), + name: Err("no value supplied for name".to_string()), + public_cert: Ok(Default::default()), + slo_url: Err("no value supplied for slo_url".to_string()), + sp_client_id: Err("no value supplied for sp_client_id".to_string()), + technical_contact_email: Err( + "no value supplied for technical_contact_email".to_string() + ), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl SamlIdentityProvider { + pub fn acs_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.acs_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for acs_url: {}", e)); + self + } + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn idp_entity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idp_entity_id = value.try_into().map_err(|e| { + format!("error converting supplied value for idp_entity_id: {}", 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 + } + pub fn public_cert(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.public_cert = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_cert: {}", e)); + self + } + pub fn slo_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.slo_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for slo_url: {}", e)); + self + } + pub fn sp_client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.sp_client_id = value.try_into().map_err(|e| { + format!("error converting supplied value for sp_client_id: {}", e) + }); + self + } + pub fn technical_contact_email(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.technical_contact_email = value.try_into().map_err(|e| { + format!( + "error converting supplied value for technical_contact_email: {}", + e + ) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::SamlIdentityProvider { + type Error = String; + fn try_from(value: SamlIdentityProvider) -> Result { + Ok(Self { + acs_url: value.acs_url?, + description: value.description?, + id: value.id?, + idp_entity_id: value.idp_entity_id?, + name: value.name?, + public_cert: value.public_cert?, + slo_url: value.slo_url?, + sp_client_id: value.sp_client_id?, + technical_contact_email: value.technical_contact_email?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SamlIdentityProviderCreate { + acs_url: Result, + description: Result, + idp_entity_id: Result, + idp_metadata_source: Result, + name: Result, + signing_keypair: Result, String>, + slo_url: Result, + sp_client_id: Result, + technical_contact_email: Result, + } + + impl Default for SamlIdentityProviderCreate { + fn default() -> Self { + Self { + acs_url: Err("no value supplied for acs_url".to_string()), + description: Err("no value supplied for description".to_string()), + idp_entity_id: Err("no value supplied for idp_entity_id".to_string()), + idp_metadata_source: Err( + "no value supplied for idp_metadata_source".to_string() + ), + name: Err("no value supplied for name".to_string()), + signing_keypair: Ok(Default::default()), + slo_url: Err("no value supplied for slo_url".to_string()), + sp_client_id: Err("no value supplied for sp_client_id".to_string()), + technical_contact_email: Err( + "no value supplied for technical_contact_email".to_string() + ), + } + } + } + + impl SamlIdentityProviderCreate { + pub fn acs_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.acs_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for acs_url: {}", e)); + self + } + 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 idp_entity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idp_entity_id = value.try_into().map_err(|e| { + format!("error converting supplied value for idp_entity_id: {}", e) + }); + self + } + pub fn idp_metadata_source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idp_metadata_source = value.try_into().map_err(|e| { + format!( + "error converting supplied value for idp_metadata_source: {}", + 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 + } + pub fn signing_keypair(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.signing_keypair = value.try_into().map_err(|e| { + format!("error converting supplied value for signing_keypair: {}", e) + }); + self + } + pub fn slo_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.slo_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for slo_url: {}", e)); + self + } + pub fn sp_client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.sp_client_id = value.try_into().map_err(|e| { + format!("error converting supplied value for sp_client_id: {}", e) + }); + self + } + pub fn technical_contact_email(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.technical_contact_email = value.try_into().map_err(|e| { + format!( + "error converting supplied value for technical_contact_email: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::SamlIdentityProviderCreate { + type Error = String; + fn try_from(value: SamlIdentityProviderCreate) -> Result { + Ok(Self { + acs_url: value.acs_url?, + description: value.description?, + idp_entity_id: value.idp_entity_id?, + idp_metadata_source: value.idp_metadata_source?, + name: value.name?, + signing_keypair: value.signing_keypair?, + slo_url: value.slo_url?, + sp_client_id: value.sp_client_id?, + technical_contact_email: value.technical_contact_email?, + }) + } + } + + pub struct Silo { + description: Result, + discoverable: Result, + id: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + user_provision_type: Result, + } + + impl Default for Silo { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + discoverable: Err("no value supplied for discoverable".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + user_provision_type: Err( + "no value supplied for user_provision_type".to_string() + ), + } + } + } + + impl Silo { + 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 discoverable(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.discoverable = value.try_into().map_err(|e| { + format!("error converting supplied value for discoverable: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn user_provision_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_provision_type = value.try_into().map_err(|e| { + format!( + "error converting supplied value for user_provision_type: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::Silo { + type Error = String; + fn try_from(value: Silo) -> Result { + Ok(Self { + description: value.description?, + discoverable: value.discoverable?, + id: value.id?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + user_provision_type: value.user_provision_type?, + }) + } + } + + pub struct SiloCreate { + description: Result, + discoverable: Result, + name: Result, + user_provision_type: Result, + } + + impl Default for SiloCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + discoverable: Err("no value supplied for discoverable".to_string()), + name: Err("no value supplied for name".to_string()), + user_provision_type: Err( + "no value supplied for user_provision_type".to_string() + ), + } + } + } + + impl SiloCreate { + 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 discoverable(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.discoverable = value.try_into().map_err(|e| { + format!("error converting supplied value for discoverable: {}", 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 + } + pub fn user_provision_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_provision_type = value.try_into().map_err(|e| { + format!( + "error converting supplied value for user_provision_type: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::SiloCreate { + type Error = String; + fn try_from(value: SiloCreate) -> Result { + Ok(Self { + description: value.description?, + discoverable: value.discoverable?, + name: value.name?, + user_provision_type: value.user_provision_type?, + }) + } + } + + pub struct SiloResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SiloResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SiloResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SiloResultsPage { + type Error = String; + fn try_from(value: SiloResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct SiloRolePolicy { + role_assignments: Result, String>, + } + + impl Default for SiloRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl SiloRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::SiloRolePolicy { + type Error = String; + fn try_from(value: SiloRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct SiloRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for SiloRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl SiloRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SiloRoleRoleAssignment { + type Error = String; + fn try_from(value: SiloRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct Sled { + id: Result, + service_address: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Sled { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + service_address: Err("no value supplied for service_address".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Sled { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn service_address(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.service_address = value.try_into().map_err(|e| { + format!("error converting supplied value for service_address: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Sled { + type Error = String; + fn try_from(value: Sled) -> Result { + Ok(Self { + id: value.id?, + service_address: value.service_address?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SledResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SledResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SledResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SledResultsPage { + type Error = String; + fn try_from(value: SledResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Snapshot { + description: Result, + disk_id: Result, + id: Result, + name: Result, + project_id: Result, + size: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Snapshot { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disk_id: Err("no value supplied for disk_id".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + size: Err("no value supplied for size".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Snapshot { + 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 disk_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.disk_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for disk_id: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Snapshot { + type Error = String; + fn try_from(value: Snapshot) -> Result { + Ok(Self { + description: value.description?, + disk_id: value.disk_id?, + id: value.id?, + name: value.name?, + project_id: value.project_id?, + size: value.size?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SnapshotCreate { + description: Result, + disk: Result, + name: Result, + } + + impl Default for SnapshotCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disk: Err("no value supplied for disk".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl SnapshotCreate { + 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 disk(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.disk = value + .try_into() + .map_err(|e| format!("error converting supplied value for disk: {}", 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::SnapshotCreate { + type Error = String; + fn try_from(value: SnapshotCreate) -> Result { + Ok(Self { + description: value.description?, + disk: value.disk?, + name: value.name?, + }) + } + } + + pub struct SnapshotResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SnapshotResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SnapshotResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SnapshotResultsPage { + type Error = String; + fn try_from(value: SnapshotResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct SpoofLoginBody { + username: Result, + } + + impl Default for SpoofLoginBody { + fn default() -> Self { + Self { + username: Err("no value supplied for username".to_string()), + } + } + } + + impl SpoofLoginBody { + pub fn username(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.username = value + .try_into() + .map_err(|e| format!("error converting supplied value for username: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SpoofLoginBody { + type Error = String; + fn try_from(value: SpoofLoginBody) -> Result { + Ok(Self { + username: value.username?, + }) + } + } + + pub struct SshKey { + description: Result, + id: Result, + name: Result, + public_key: Result, + silo_user_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for SshKey { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + public_key: Err("no value supplied for public_key".to_string()), + silo_user_id: Err("no value supplied for silo_user_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl SshKey { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn public_key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.public_key = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_key: {}", e)); + self + } + pub fn silo_user_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.silo_user_id = value.try_into().map_err(|e| { + format!("error converting supplied value for silo_user_id: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::SshKey { + type Error = String; + fn try_from(value: SshKey) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + public_key: value.public_key?, + silo_user_id: value.silo_user_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SshKeyCreate { + description: Result, + name: Result, + public_key: Result, + } + + impl Default for SshKeyCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + public_key: Err("no value supplied for public_key".to_string()), + } + } + } + + impl SshKeyCreate { + 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 + } + pub fn public_key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.public_key = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_key: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SshKeyCreate { + type Error = String; + fn try_from(value: SshKeyCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + public_key: value.public_key?, + }) + } + } + + pub struct SshKeyResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SshKeyResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SshKeyResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SshKeyResultsPage { + type Error = String; + fn try_from(value: SshKeyResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct TimeseriesSchema { + created: Result, String>, + datum_type: Result, + field_schema: Result, String>, + timeseries_name: Result, + } + + impl Default for TimeseriesSchema { + fn default() -> Self { + Self { + created: Err("no value supplied for created".to_string()), + datum_type: Err("no value supplied for datum_type".to_string()), + field_schema: Err("no value supplied for field_schema".to_string()), + timeseries_name: Err("no value supplied for timeseries_name".to_string()), + } + } + } + + impl TimeseriesSchema { + pub fn created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.created = value + .try_into() + .map_err(|e| format!("error converting supplied value for created: {}", e)); + self + } + pub fn datum_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.datum_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for datum_type: {}", e)); + self + } + pub fn field_schema(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.field_schema = value.try_into().map_err(|e| { + format!("error converting supplied value for field_schema: {}", e) + }); + self + } + pub fn timeseries_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.timeseries_name = value.try_into().map_err(|e| { + format!("error converting supplied value for timeseries_name: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::TimeseriesSchema { + type Error = String; + fn try_from(value: TimeseriesSchema) -> Result { + Ok(Self { + created: value.created?, + datum_type: value.datum_type?, + field_schema: value.field_schema?, + timeseries_name: value.timeseries_name?, + }) + } + } + + pub struct TimeseriesSchemaResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for TimeseriesSchemaResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl TimeseriesSchemaResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TimeseriesSchemaResultsPage { + type Error = String; + fn try_from(value: TimeseriesSchemaResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct User { + display_name: Result, + id: Result, + } + + impl Default for User { + fn default() -> Self { + Self { + display_name: Err("no value supplied for display_name".to_string()), + id: Err("no value supplied for id".to_string()), + } + } + } + + impl User { + pub fn display_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.display_name = value.try_into().map_err(|e| { + format!("error converting supplied value for display_name: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::User { + type Error = String; + fn try_from(value: User) -> Result { + Ok(Self { + display_name: value.display_name?, + id: value.id?, + }) + } + } + + pub struct UserBuiltin { + description: Result, + id: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for UserBuiltin { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl UserBuiltin { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::UserBuiltin { + type Error = String; + fn try_from(value: UserBuiltin) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct UserBuiltinResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for UserBuiltinResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl UserBuiltinResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UserBuiltinResultsPage { + type Error = String; + fn try_from(value: UserBuiltinResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct UserResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for UserResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl UserResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UserResultsPage { + type Error = String; + fn try_from(value: UserResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Vpc { + description: Result, + dns_name: Result, + id: Result, + ipv6_prefix: Result, + name: Result, + project_id: Result, + system_router_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Vpc { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + dns_name: Err("no value supplied for dns_name".to_string()), + id: Err("no value supplied for id".to_string()), + ipv6_prefix: Err("no value supplied for ipv6_prefix".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + system_router_id: Err("no value supplied for system_router_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Vpc { + 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 dns_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dns_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn ipv6_prefix(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv6_prefix = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_prefix: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn system_router_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.system_router_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for system_router_id: {}", + e + ) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Vpc { + type Error = String; + fn try_from(value: Vpc) -> Result { + Ok(Self { + description: value.description?, + dns_name: value.dns_name?, + id: value.id?, + ipv6_prefix: value.ipv6_prefix?, + name: value.name?, + project_id: value.project_id?, + system_router_id: value.system_router_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct VpcCreate { + description: Result, + dns_name: Result, + ipv6_prefix: Result, String>, + name: Result, + } + + impl Default for VpcCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + dns_name: Err("no value supplied for dns_name".to_string()), + ipv6_prefix: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl VpcCreate { + 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 dns_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dns_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); + self + } + pub fn ipv6_prefix(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.ipv6_prefix = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_prefix: {}", 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::VpcCreate { + type Error = String; + fn try_from(value: VpcCreate) -> Result { + Ok(Self { + description: value.description?, + dns_name: value.dns_name?, + ipv6_prefix: value.ipv6_prefix?, + name: value.name?, + }) + } + } + + pub struct VpcFirewallRule { + action: Result, + description: Result, + direction: Result, + filters: Result, + id: Result, + name: Result, + priority: Result, + status: Result, + targets: Result, String>, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for VpcFirewallRule { + fn default() -> Self { + Self { + action: Err("no value supplied for action".to_string()), + description: Err("no value supplied for description".to_string()), + direction: Err("no value supplied for direction".to_string()), + filters: Err("no value supplied for filters".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + priority: Err("no value supplied for priority".to_string()), + status: Err("no value supplied for status".to_string()), + targets: Err("no value supplied for targets".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl VpcFirewallRule { + pub fn action(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.action = value + .try_into() + .map_err(|e| format!("error converting supplied value for action: {}", e)); + self + } + 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 direction(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.direction = value + .try_into() + .map_err(|e| format!("error converting supplied value for direction: {}", e)); + self + } + pub fn filters(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.filters = value + .try_into() + .map_err(|e| format!("error converting supplied value for filters: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn priority(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn targets(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.targets = value + .try_into() + .map_err(|e| format!("error converting supplied value for targets: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRule { + type Error = String; + fn try_from(value: VpcFirewallRule) -> Result { + Ok(Self { + action: value.action?, + description: value.description?, + direction: value.direction?, + filters: value.filters?, + id: value.id?, + name: value.name?, + priority: value.priority?, + status: value.status?, + targets: value.targets?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct VpcFirewallRuleFilter { + hosts: Result>, String>, + ports: Result>, String>, + protocols: Result>, String>, + } + + impl Default for VpcFirewallRuleFilter { + fn default() -> Self { + Self { + hosts: Ok(Default::default()), + ports: Ok(Default::default()), + protocols: Ok(Default::default()), + } + } + } + + impl VpcFirewallRuleFilter { + pub fn hosts(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.hosts = value + .try_into() + .map_err(|e| format!("error converting supplied value for hosts: {}", e)); + self + } + pub fn ports(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.ports = value + .try_into() + .map_err(|e| format!("error converting supplied value for ports: {}", e)); + self + } + pub fn protocols(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.protocols = value + .try_into() + .map_err(|e| format!("error converting supplied value for protocols: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRuleFilter { + type Error = String; + fn try_from(value: VpcFirewallRuleFilter) -> Result { + Ok(Self { + hosts: value.hosts?, + ports: value.ports?, + protocols: value.protocols?, + }) + } + } + + pub struct VpcFirewallRuleUpdate { + action: Result, + description: Result, + direction: Result, + filters: Result, + name: Result, + priority: Result, + status: Result, + targets: Result, String>, + } + + impl Default for VpcFirewallRuleUpdate { + fn default() -> Self { + Self { + action: Err("no value supplied for action".to_string()), + description: Err("no value supplied for description".to_string()), + direction: Err("no value supplied for direction".to_string()), + filters: Err("no value supplied for filters".to_string()), + name: Err("no value supplied for name".to_string()), + priority: Err("no value supplied for priority".to_string()), + status: Err("no value supplied for status".to_string()), + targets: Err("no value supplied for targets".to_string()), + } + } + } + + impl VpcFirewallRuleUpdate { + pub fn action(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.action = value + .try_into() + .map_err(|e| format!("error converting supplied value for action: {}", e)); + self + } + 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 direction(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.direction = value + .try_into() + .map_err(|e| format!("error converting supplied value for direction: {}", e)); + self + } + pub fn filters(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.filters = value + .try_into() + .map_err(|e| format!("error converting supplied value for filters: {}", 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 + } + pub fn priority(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn targets(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.targets = value + .try_into() + .map_err(|e| format!("error converting supplied value for targets: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRuleUpdate { + type Error = String; + fn try_from(value: VpcFirewallRuleUpdate) -> Result { + Ok(Self { + action: value.action?, + description: value.description?, + direction: value.direction?, + filters: value.filters?, + name: value.name?, + priority: value.priority?, + status: value.status?, + targets: value.targets?, + }) + } + } + + pub struct VpcFirewallRuleUpdateParams { + rules: Result, String>, + } + + impl Default for VpcFirewallRuleUpdateParams { + fn default() -> Self { + Self { + rules: Err("no value supplied for rules".to_string()), + } + } + } + + impl VpcFirewallRuleUpdateParams { + pub fn rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.rules = value + .try_into() + .map_err(|e| format!("error converting supplied value for rules: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRuleUpdateParams { + type Error = String; + fn try_from(value: VpcFirewallRuleUpdateParams) -> Result { + Ok(Self { + rules: value.rules?, + }) + } + } + + pub struct VpcFirewallRules { + rules: Result, String>, + } + + impl Default for VpcFirewallRules { + fn default() -> Self { + Self { + rules: Err("no value supplied for rules".to_string()), + } + } + } + + impl VpcFirewallRules { + pub fn rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.rules = value + .try_into() + .map_err(|e| format!("error converting supplied value for rules: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRules { + type Error = String; + fn try_from(value: VpcFirewallRules) -> Result { + Ok(Self { + rules: value.rules?, + }) + } + } + + pub struct VpcResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for VpcResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl VpcResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcResultsPage { + type Error = String; + fn try_from(value: VpcResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct VpcRouter { + description: Result, + id: Result, + kind: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for VpcRouter { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + kind: Err("no value supplied for kind".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl VpcRouter { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn kind(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.kind = value + .try_into() + .map_err(|e| format!("error converting supplied value for kind: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcRouter { + type Error = String; + fn try_from(value: VpcRouter) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + kind: value.kind?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct VpcRouterCreate { + description: Result, + name: Result, + } + + impl Default for VpcRouterCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl VpcRouterCreate { + 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::VpcRouterCreate { + type Error = String; + fn try_from(value: VpcRouterCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct VpcRouterResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for VpcRouterResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl VpcRouterResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcRouterResultsPage { + type Error = String; + fn try_from(value: VpcRouterResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct VpcRouterUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for VpcRouterUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl VpcRouterUpdate { + 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::VpcRouterUpdate { + type Error = String; + fn try_from(value: VpcRouterUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct VpcSubnet { + description: Result, + id: Result, + ipv4_block: Result, + ipv6_block: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for VpcSubnet { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + ipv4_block: Err("no value supplied for ipv4_block".to_string()), + ipv6_block: Err("no value supplied for ipv6_block".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl VpcSubnet { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn ipv4_block(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv4_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv4_block: {}", e)); + self + } + pub fn ipv6_block(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv6_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_block: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcSubnet { + type Error = String; + fn try_from(value: VpcSubnet) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + ipv4_block: value.ipv4_block?, + ipv6_block: value.ipv6_block?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct VpcSubnetCreate { + description: Result, + ipv4_block: Result, + ipv6_block: Result, String>, + name: Result, + } + + impl Default for VpcSubnetCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + ipv4_block: Err("no value supplied for ipv4_block".to_string()), + ipv6_block: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl VpcSubnetCreate { + 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 ipv4_block(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv4_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv4_block: {}", e)); + self + } + pub fn ipv6_block(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.ipv6_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_block: {}", 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::VpcSubnetCreate { + type Error = String; + fn try_from(value: VpcSubnetCreate) -> Result { + Ok(Self { + description: value.description?, + ipv4_block: value.ipv4_block?, + ipv6_block: value.ipv6_block?, + name: value.name?, + }) + } + } + + pub struct VpcSubnetResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for VpcSubnetResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl VpcSubnetResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcSubnetResultsPage { + type Error = String; + fn try_from(value: VpcSubnetResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct VpcSubnetUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for VpcSubnetUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl VpcSubnetUpdate { + 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::VpcSubnetUpdate { + type Error = String; + fn try_from(value: VpcSubnetUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct VpcUpdate { + description: Result, String>, + dns_name: Result, String>, + name: Result, String>, + } + + impl Default for VpcUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + dns_name: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl VpcUpdate { + 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 dns_name(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.dns_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for dns_name: {}", 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::VpcUpdate { + type Error = String; + fn try_from(value: VpcUpdate) -> Result { + Ok(Self { + description: value.description?, + dns_name: value.dns_name?, + name: value.name?, + }) + } + } + } + + mod defaults { + pub(super) fn instance_create_network_interfaces( + ) -> super::InstanceNetworkInterfaceAttachment { + super::InstanceNetworkInterfaceAttachment::Default + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/nexus-builder.out b/progenitor-impl/tests/output/nexus-builder.out index 4f28b59..637c71a 100644 --- a/progenitor-impl/tests/output/nexus-builder.out +++ b/progenitor-impl/tests/output/nexus-builder.out @@ -54,6 +54,12 @@ pub mod types { pub range: BinRangedouble, } + impl Bindouble { + pub fn builder() -> builder::Bindouble { + builder::Bindouble::default() + } + } + ///Type storing bin edges and a count of samples within it. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Binint64 { @@ -63,6 +69,12 @@ pub mod types { pub range: BinRangeint64, } + impl Binint64 { + pub fn builder() -> builder::Binint64 { + builder::Binint64::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct BlockSize(i64); impl std::ops::Deref for BlockSize { @@ -106,6 +118,12 @@ pub mod types { pub value: f64, } + impl Cumulativedouble { + pub fn builder() -> builder::Cumulativedouble { + builder::Cumulativedouble::default() + } + } + ///A cumulative or counter data type. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Cumulativeint64 { @@ -113,6 +131,12 @@ pub mod types { pub value: i64, } + impl Cumulativeint64 { + pub fn builder() -> builder::Cumulativeint64 { + builder::Cumulativeint64::default() + } + } + ///A `Datum` is a single sampled data point from a metric. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type", content = "datum")] @@ -204,6 +228,12 @@ pub mod types { pub public_cert: String, } + impl DerEncodedKeyPair { + pub fn builder() -> builder::DerEncodedKeyPair { + builder::DerEncodedKeyPair::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct DeviceAccessTokenRequest { pub client_id: uuid::Uuid, @@ -211,16 +241,34 @@ pub mod types { pub grant_type: String, } + impl DeviceAccessTokenRequest { + pub fn builder() -> builder::DeviceAccessTokenRequest { + builder::DeviceAccessTokenRequest::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct DeviceAuthRequest { pub client_id: uuid::Uuid, } + impl DeviceAuthRequest { + pub fn builder() -> builder::DeviceAuthRequest { + builder::DeviceAuthRequest::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct DeviceAuthVerify { pub user_code: String, } + impl DeviceAuthVerify { + pub fn builder() -> builder::DeviceAuthVerify { + builder::DeviceAuthVerify::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type", content = "value")] pub enum Digest { @@ -252,6 +300,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Disk { + pub fn builder() -> builder::Disk { + builder::Disk::default() + } + } + ///Create-time parameters for a /// [`Disk`](omicron_common::api::external::Disk) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -264,6 +318,12 @@ pub mod types { pub size: ByteCount, } + impl DiskCreate { + pub fn builder() -> builder::DiskCreate { + builder::DiskCreate::default() + } + } + ///Parameters for the [`Disk`](omicron_common::api::external::Disk) to be /// attached or detached to an instance #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -271,6 +331,12 @@ pub mod types { pub name: Name, } + impl DiskIdentifier { + pub fn builder() -> builder::DiskIdentifier { + builder::DiskIdentifier::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -327,6 +393,12 @@ pub mod types { pub next_page: Option, } + impl DiskResultsPage { + pub fn builder() -> builder::DiskResultsPage { + builder::DiskResultsPage::default() + } + } + ///Different sources for a disk #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type")] @@ -381,6 +453,12 @@ pub mod types { pub version: String, } + impl Distribution { + pub fn builder() -> builder::Distribution { + builder::Distribution::default() + } + } + ///Error information from a response. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Error { @@ -390,12 +468,24 @@ pub mod types { pub request_id: String, } + impl Error { + pub fn builder() -> builder::Error { + builder::Error::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ExternalIp { pub ip: std::net::IpAddr, pub kind: IpKind, } + impl ExternalIp { + pub fn builder() -> builder::ExternalIp { + builder::ExternalIp::default() + } + } + ///Parameters for creating an external IP address for instances. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type")] @@ -420,6 +510,12 @@ pub mod types { pub next_page: Option, } + impl ExternalIpResultsPage { + pub fn builder() -> builder::ExternalIpResultsPage { + builder::ExternalIpResultsPage::default() + } + } + ///The name and type information for a field of a timeseries schema. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct FieldSchema { @@ -428,6 +524,12 @@ pub mod types { pub ty: FieldType, } + impl FieldSchema { + pub fn builder() -> builder::FieldSchema { + builder::FieldSchema::default() + } + } + ///The source from which a field is derived, the target or metric. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, @@ -548,6 +650,12 @@ pub mod types { pub role_assignments: Vec, } + impl FleetRolePolicy { + pub fn builder() -> builder::FleetRolePolicy { + builder::FleetRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -561,6 +669,12 @@ pub mod types { pub role_name: FleetRole, } + impl FleetRoleRoleAssignment { + pub fn builder() -> builder::FleetRoleRoleAssignment { + builder::FleetRoleRoleAssignment::default() + } + } + ///Client view of global Images #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct GlobalImage { @@ -590,6 +704,12 @@ pub mod types { pub version: String, } + impl GlobalImage { + pub fn builder() -> builder::GlobalImage { + builder::GlobalImage::default() + } + } + ///Create-time parameters for an /// [`GlobalImage`](omicron_common::api::external::GlobalImage) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -604,6 +724,12 @@ pub mod types { pub source: ImageSource, } + impl GlobalImageCreate { + pub fn builder() -> builder::GlobalImageCreate { + builder::GlobalImageCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct GlobalImageResultsPage { @@ -614,6 +740,12 @@ pub mod types { pub next_page: Option, } + impl GlobalImageResultsPage { + pub fn builder() -> builder::GlobalImageResultsPage { + builder::GlobalImageResultsPage::default() + } + } + ///A simple type for managing a histogram metric. /// ///A histogram maintains the count of any number of samples, over a set of @@ -663,6 +795,12 @@ pub mod types { pub start_time: chrono::DateTime, } + impl Histogramdouble { + pub fn builder() -> builder::Histogramdouble { + builder::Histogramdouble::default() + } + } + ///A simple type for managing a histogram metric. /// ///A histogram maintains the count of any number of samples, over a set of @@ -712,6 +850,12 @@ pub mod types { pub start_time: chrono::DateTime, } + impl Histogramint64 { + pub fn builder() -> builder::Histogramint64 { + builder::Histogramint64::default() + } + } + ///Supported set of sort modes for scanning by id only. /// ///Currently, we only support scanning in ascending order. @@ -758,6 +902,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl IdentityProvider { + pub fn builder() -> builder::IdentityProvider { + builder::IdentityProvider::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct IdentityProviderResultsPage { @@ -768,6 +918,12 @@ pub mod types { pub next_page: Option, } + impl IdentityProviderResultsPage { + pub fn builder() -> builder::IdentityProviderResultsPage { + builder::IdentityProviderResultsPage::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -860,6 +1016,12 @@ pub mod types { pub version: Option, } + impl Image { + pub fn builder() -> builder::Image { + builder::Image::default() + } + } + ///Create-time parameters for an /// [`Image`](omicron_common::api::external::Image) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -872,6 +1034,12 @@ pub mod types { pub source: ImageSource, } + impl ImageCreate { + pub fn builder() -> builder::ImageCreate { + builder::ImageCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ImageResultsPage { @@ -882,6 +1050,12 @@ pub mod types { pub next_page: Option, } + impl ImageResultsPage { + pub fn builder() -> builder::ImageResultsPage { + builder::ImageResultsPage::default() + } + } + ///The source of the underlying image. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type")] @@ -919,6 +1093,12 @@ pub mod types { pub time_run_state_updated: chrono::DateTime, } + impl Instance { + pub fn builder() -> builder::Instance { + builder::Instance::default() + } + } + ///The number of CPUs in an Instance #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct InstanceCpuCount(pub u16); @@ -950,7 +1130,7 @@ pub mod types { pub name: Name, pub ncpus: InstanceCpuCount, ///The network interfaces to be created for this instance. - #[serde(default = "instance_create_network_interfaces")] + #[serde(default = "defaults::instance_create_network_interfaces")] pub network_interfaces: InstanceNetworkInterfaceAttachment, ///User data for instance initialization systems (such as cloud-init). /// Must be a Base64-encoded string, as specified in RFC 4648 ยง 4 (+ and @@ -959,8 +1139,10 @@ pub mod types { pub user_data: String, } - fn instance_create_network_interfaces() -> InstanceNetworkInterfaceAttachment { - InstanceNetworkInterfaceAttachment::Default + impl InstanceCreate { + pub fn builder() -> builder::InstanceCreate { + builder::InstanceCreate::default() + } } ///Describe the instance's disks at creation time @@ -992,6 +1174,12 @@ pub mod types { pub dst_sled_id: uuid::Uuid, } + impl InstanceMigrate { + pub fn builder() -> builder::InstanceMigrate { + builder::InstanceMigrate::default() + } + } + ///Describes an attachment of a `NetworkInterface` to an `Instance`, at the /// time the instance is created. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -1019,6 +1207,12 @@ pub mod types { pub next_page: Option, } + impl InstanceResultsPage { + pub fn builder() -> builder::InstanceResultsPage { + builder::InstanceResultsPage::default() + } + } + ///Contents of an Instance's serial console buffer. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct InstanceSerialConsoleData { @@ -1031,6 +1225,12 @@ pub mod types { pub last_byte_offset: u64, } + impl InstanceSerialConsoleData { + pub fn builder() -> builder::InstanceSerialConsoleData { + builder::InstanceSerialConsoleData::default() + } + } + ///Running state of an Instance (primarily: booted or stopped) /// ///This typically reflects whether it's starting, running, stopping, or @@ -1141,7 +1341,7 @@ pub mod types { Err("") .or_else(|_: Self::Error| Ok(Self::V4(Ipv4Net::try_from(value)?))) .or_else(|_: Self::Error| Ok(Self::V6(Ipv6Net::try_from(value)?))) - .or_else(|_: Self::Error| Err("string conversion failed for all variants")) + .map_err(|_: Self::Error| "string conversion failed for all variants") } } @@ -1170,6 +1370,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl IpPool { + pub fn builder() -> builder::IpPool { + builder::IpPool::default() + } + } + ///Create-time parameters for an IP Pool. /// ///See [`IpPool`](omicron_nexus::external_api::views::IpPool) @@ -1183,6 +1389,12 @@ pub mod types { pub project: Option, } + impl IpPoolCreate { + pub fn builder() -> builder::IpPoolCreate { + builder::IpPoolCreate::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct IpPoolRange { pub id: uuid::Uuid, @@ -1190,6 +1402,12 @@ pub mod types { pub time_created: chrono::DateTime, } + impl IpPoolRange { + pub fn builder() -> builder::IpPoolRange { + builder::IpPoolRange::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct IpPoolRangeResultsPage { @@ -1200,6 +1418,12 @@ pub mod types { pub next_page: Option, } + impl IpPoolRangeResultsPage { + pub fn builder() -> builder::IpPoolRangeResultsPage { + builder::IpPoolRangeResultsPage::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct IpPoolResultsPage { @@ -1210,6 +1434,12 @@ pub mod types { pub next_page: Option, } + impl IpPoolResultsPage { + pub fn builder() -> builder::IpPoolResultsPage { + builder::IpPoolResultsPage::default() + } + } + ///Parameters for updating an IP Pool #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct IpPoolUpdate { @@ -1219,6 +1449,12 @@ pub mod types { pub name: Option, } + impl IpPoolUpdate { + pub fn builder() -> builder::IpPoolUpdate { + builder::IpPoolUpdate::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(untagged)] pub enum IpRange { @@ -1270,6 +1506,12 @@ pub mod types { pub last: std::net::Ipv4Addr, } + impl Ipv4Range { + pub fn builder() -> builder::Ipv4Range { + builder::Ipv4Range::default() + } + } + ///An IPv6 subnet, including prefix and subnet mask #[derive(Clone, Debug, Serialize, JsonSchema)] pub struct Ipv6Net(String); @@ -1314,6 +1556,12 @@ pub mod types { pub last: std::net::Ipv6Addr, } + impl Ipv6Range { + pub fn builder() -> builder::Ipv6Range { + builder::Ipv6Range::default() + } + } + ///An inclusive-inclusive range of IP ports. The second port may be omitted /// to represent a single port #[derive(Clone, Debug, Serialize, JsonSchema)] @@ -1416,6 +1664,12 @@ pub mod types { pub timestamp: chrono::DateTime, } + impl Measurement { + pub fn builder() -> builder::Measurement { + builder::Measurement::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct MeasurementResultsPage { @@ -1426,6 +1680,12 @@ pub mod types { pub next_page: Option, } + impl MeasurementResultsPage { + pub fn builder() -> builder::MeasurementResultsPage { + builder::MeasurementResultsPage::default() + } + } + ///Names must begin with a lower case ASCII letter, be composed exclusively /// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end /// with a '-'. Names cannot be a UUID though they may contain a UUID. @@ -1558,6 +1818,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl NetworkInterface { + pub fn builder() -> builder::NetworkInterface { + builder::NetworkInterface::default() + } + } + ///Create-time parameters for a /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -1574,6 +1840,12 @@ pub mod types { pub vpc_name: Name, } + impl NetworkInterfaceCreate { + pub fn builder() -> builder::NetworkInterfaceCreate { + builder::NetworkInterfaceCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct NetworkInterfaceResultsPage { @@ -1584,6 +1856,12 @@ pub mod types { pub next_page: Option, } + impl NetworkInterfaceResultsPage { + pub fn builder() -> builder::NetworkInterfaceResultsPage { + builder::NetworkInterfaceResultsPage::default() + } + } + ///Parameters for updating a /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface). /// @@ -1610,6 +1888,12 @@ pub mod types { pub name: Option, } + impl NetworkInterfaceUpdate { + pub fn builder() -> builder::NetworkInterfaceUpdate { + builder::NetworkInterfaceUpdate::default() + } + } + ///Client view of an [`Organization`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Organization { @@ -1625,6 +1909,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Organization { + pub fn builder() -> builder::Organization { + builder::Organization::default() + } + } + ///Create-time parameters for an /// [`Organization`](crate::external_api::views::Organization) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -1633,6 +1923,12 @@ pub mod types { pub name: Name, } + impl OrganizationCreate { + pub fn builder() -> builder::OrganizationCreate { + builder::OrganizationCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct OrganizationResultsPage { @@ -1643,6 +1939,12 @@ pub mod types { pub next_page: Option, } + impl OrganizationResultsPage { + pub fn builder() -> builder::OrganizationResultsPage { + builder::OrganizationResultsPage::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -1689,6 +1991,12 @@ pub mod types { pub role_assignments: Vec, } + impl OrganizationRolePolicy { + pub fn builder() -> builder::OrganizationRolePolicy { + builder::OrganizationRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -1702,6 +2010,12 @@ pub mod types { pub role_name: OrganizationRole, } + impl OrganizationRoleRoleAssignment { + pub fn builder() -> builder::OrganizationRoleRoleAssignment { + builder::OrganizationRoleRoleAssignment::default() + } + } + ///Updateable properties of an /// [`Organization`](crate::external_api::views::Organization) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -1712,6 +2026,12 @@ pub mod types { pub name: Option, } + impl OrganizationUpdate { + pub fn builder() -> builder::OrganizationUpdate { + builder::OrganizationUpdate::default() + } + } + ///Client view of a [`Project`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Project { @@ -1728,6 +2048,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Project { + pub fn builder() -> builder::Project { + builder::Project::default() + } + } + ///Create-time parameters for a /// [`Project`](crate::external_api::views::Project) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -1736,6 +2062,12 @@ pub mod types { pub name: Name, } + impl ProjectCreate { + pub fn builder() -> builder::ProjectCreate { + builder::ProjectCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct ProjectResultsPage { @@ -1746,6 +2078,12 @@ pub mod types { pub next_page: Option, } + impl ProjectResultsPage { + pub fn builder() -> builder::ProjectResultsPage { + builder::ProjectResultsPage::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -1792,6 +2130,12 @@ pub mod types { pub role_assignments: Vec, } + impl ProjectRolePolicy { + pub fn builder() -> builder::ProjectRolePolicy { + builder::ProjectRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -1805,6 +2149,12 @@ pub mod types { pub role_name: ProjectRole, } + impl ProjectRoleRoleAssignment { + pub fn builder() -> builder::ProjectRoleRoleAssignment { + builder::ProjectRoleRoleAssignment::default() + } + } + ///Updateable properties of a /// [`Project`](crate::external_api::views::Project) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -1815,6 +2165,12 @@ pub mod types { pub name: Option, } + impl ProjectUpdate { + pub fn builder() -> builder::ProjectUpdate { + builder::ProjectUpdate::default() + } + } + ///Client view of an [`Rack`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Rack { @@ -1826,6 +2182,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Rack { + pub fn builder() -> builder::Rack { + builder::Rack::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct RackResultsPage { @@ -1836,6 +2198,12 @@ pub mod types { pub next_page: Option, } + impl RackResultsPage { + pub fn builder() -> builder::RackResultsPage { + builder::RackResultsPage::default() + } + } + ///Client view of a [`Role`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Role { @@ -1843,6 +2211,12 @@ pub mod types { pub name: RoleName, } + impl Role { + pub fn builder() -> builder::Role { + builder::Role::default() + } + } + ///Role names consist of two string components separated by dot ("."). #[derive(Clone, Debug, Serialize, JsonSchema)] pub struct RoleName(String); @@ -1897,6 +2271,12 @@ pub mod types { pub next_page: Option, } + impl RoleResultsPage { + pub fn builder() -> builder::RoleResultsPage { + builder::RoleResultsPage::default() + } + } + ///A `RouteDestination` is used to match traffic with a routing rule, on /// the destination of that traffic. /// @@ -1964,6 +2344,12 @@ pub mod types { pub vpc_router_id: uuid::Uuid, } + impl RouterRoute { + pub fn builder() -> builder::RouterRoute { + builder::RouterRoute::default() + } + } + ///Create-time parameters for a [`RouterRoute`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct RouterRouteCreateParams { @@ -1973,6 +2359,12 @@ pub mod types { pub target: RouteTarget, } + impl RouterRouteCreateParams { + pub fn builder() -> builder::RouterRouteCreateParams { + builder::RouterRouteCreateParams::default() + } + } + ///The classification of a [`RouterRoute`] as defined by the system. The /// kind determines certain attributes such as if the route is modifiable /// and describes how or where the route was created. @@ -2026,6 +2418,12 @@ pub mod types { pub next_page: Option, } + impl RouterRouteResultsPage { + pub fn builder() -> builder::RouterRouteResultsPage { + builder::RouterRouteResultsPage::default() + } + } + ///Updateable properties of a [`RouterRoute`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct RouterRouteUpdateParams { @@ -2037,12 +2435,24 @@ pub mod types { pub target: RouteTarget, } + impl RouterRouteUpdateParams { + pub fn builder() -> builder::RouterRouteUpdateParams { + builder::RouterRouteUpdateParams::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Saga { pub id: uuid::Uuid, pub state: SagaState, } + impl Saga { + pub fn builder() -> builder::Saga { + builder::Saga::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "error")] pub enum SagaErrorInfo { @@ -2068,6 +2478,12 @@ pub mod types { pub next_page: Option, } + impl SagaResultsPage { + pub fn builder() -> builder::SagaResultsPage { + builder::SagaResultsPage::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "state")] pub enum SagaState { @@ -2112,6 +2528,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl SamlIdentityProvider { + pub fn builder() -> builder::SamlIdentityProvider { + builder::SamlIdentityProvider::default() + } + } + ///Create-time identity-related parameters #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SamlIdentityProviderCreate { @@ -2134,6 +2556,12 @@ pub mod types { pub technical_contact_email: String, } + impl SamlIdentityProviderCreate { + pub fn builder() -> builder::SamlIdentityProviderCreate { + builder::SamlIdentityProviderCreate::default() + } + } + ///Client view of a ['Silo'] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Silo { @@ -2154,6 +2582,12 @@ pub mod types { pub user_provision_type: UserProvisionType, } + impl Silo { + pub fn builder() -> builder::Silo { + builder::Silo::default() + } + } + ///Create-time parameters for a [`Silo`](crate::external_api::views::Silo) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SiloCreate { @@ -2163,6 +2597,12 @@ pub mod types { pub user_provision_type: UserProvisionType, } + impl SiloCreate { + pub fn builder() -> builder::SiloCreate { + builder::SiloCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SiloResultsPage { @@ -2173,6 +2613,12 @@ pub mod types { pub next_page: Option, } + impl SiloResultsPage { + pub fn builder() -> builder::SiloResultsPage { + builder::SiloResultsPage::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -2219,6 +2665,12 @@ pub mod types { pub role_assignments: Vec, } + impl SiloRolePolicy { + pub fn builder() -> builder::SiloRolePolicy { + builder::SiloRolePolicy::default() + } + } + ///Describes the assignment of a particular role on a particular resource /// to a particular identity (user, group, etc.) /// @@ -2232,6 +2684,12 @@ pub mod types { pub role_name: SiloRole, } + impl SiloRoleRoleAssignment { + pub fn builder() -> builder::SiloRoleRoleAssignment { + builder::SiloRoleRoleAssignment::default() + } + } + ///Client view of an [`Sled`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Sled { @@ -2244,6 +2702,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Sled { + pub fn builder() -> builder::Sled { + builder::Sled::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SledResultsPage { @@ -2254,6 +2718,12 @@ pub mod types { pub next_page: Option, } + impl SledResultsPage { + pub fn builder() -> builder::SledResultsPage { + builder::SledResultsPage::default() + } + } + ///Client view of a Snapshot #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Snapshot { @@ -2272,6 +2742,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Snapshot { + pub fn builder() -> builder::Snapshot { + builder::Snapshot::default() + } + } + ///Create-time parameters for a /// [`Snapshot`](omicron_common::api::external::Snapshot) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2282,6 +2758,12 @@ pub mod types { pub name: Name, } + impl SnapshotCreate { + pub fn builder() -> builder::SnapshotCreate { + builder::SnapshotCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SnapshotResultsPage { @@ -2292,11 +2774,23 @@ pub mod types { pub next_page: Option, } + impl SnapshotResultsPage { + pub fn builder() -> builder::SnapshotResultsPage { + builder::SnapshotResultsPage::default() + } + } + #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SpoofLoginBody { pub username: String, } + impl SpoofLoginBody { + pub fn builder() -> builder::SpoofLoginBody { + builder::SpoofLoginBody::default() + } + } + ///Client view of a [`SshKey`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SshKey { @@ -2316,6 +2810,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl SshKey { + pub fn builder() -> builder::SshKey { + builder::SshKey::default() + } + } + ///Create-time parameters for an /// [`SshKey`](crate::external_api::views::SshKey) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2326,6 +2826,12 @@ pub mod types { pub public_key: String, } + impl SshKeyCreate { + pub fn builder() -> builder::SshKeyCreate { + builder::SshKeyCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct SshKeyResultsPage { @@ -2336,6 +2842,12 @@ pub mod types { pub next_page: Option, } + impl SshKeyResultsPage { + pub fn builder() -> builder::SshKeyResultsPage { + builder::SshKeyResultsPage::default() + } + } + ///Names are constructed by concatenating the target and metric names with /// ':'. Target and metric names must be lowercase alphanumeric characters /// with '_' separating words. @@ -2393,6 +2905,12 @@ pub mod types { pub timeseries_name: TimeseriesName, } + impl TimeseriesSchema { + pub fn builder() -> builder::TimeseriesSchema { + builder::TimeseriesSchema::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct TimeseriesSchemaResultsPage { @@ -2403,6 +2921,12 @@ pub mod types { pub next_page: Option, } + impl TimeseriesSchemaResultsPage { + pub fn builder() -> builder::TimeseriesSchemaResultsPage { + builder::TimeseriesSchemaResultsPage::default() + } + } + ///Client view of a [`User`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct User { @@ -2411,6 +2935,12 @@ pub mod types { pub id: uuid::Uuid, } + impl User { + pub fn builder() -> builder::User { + builder::User::default() + } + } + ///Client view of a [`UserBuiltin`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct UserBuiltin { @@ -2426,6 +2956,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl UserBuiltin { + pub fn builder() -> builder::UserBuiltin { + builder::UserBuiltin::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct UserBuiltinResultsPage { @@ -2436,6 +2972,12 @@ pub mod types { pub next_page: Option, } + impl UserBuiltinResultsPage { + pub fn builder() -> builder::UserBuiltinResultsPage { + builder::UserBuiltinResultsPage::default() + } + } + ///How users will be provisioned in a silo during authentication. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, @@ -2477,6 +3019,12 @@ pub mod types { pub next_page: Option, } + impl UserResultsPage { + pub fn builder() -> builder::UserResultsPage { + builder::UserResultsPage::default() + } + } + ///Client view of a [`Vpc`] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct Vpc { @@ -2500,6 +3048,12 @@ pub mod types { pub time_modified: chrono::DateTime, } + impl Vpc { + pub fn builder() -> builder::Vpc { + builder::Vpc::default() + } + } + ///Create-time parameters for a [`Vpc`](crate::external_api::views::Vpc) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct VpcCreate { @@ -2516,6 +3070,12 @@ pub mod types { pub name: Name, } + impl VpcCreate { + pub fn builder() -> builder::VpcCreate { + builder::VpcCreate::default() + } + } + ///A single rule in a VPC firewall #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct VpcFirewallRule { @@ -2545,6 +3105,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl VpcFirewallRule { + pub fn builder() -> builder::VpcFirewallRule { + builder::VpcFirewallRule::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -2622,6 +3188,12 @@ pub mod types { pub protocols: Option>, } + impl VpcFirewallRuleFilter { + pub fn builder() -> builder::VpcFirewallRuleFilter { + builder::VpcFirewallRuleFilter::default() + } + } + ///The `VpcFirewallRuleHostFilter` is used to filter traffic on the basis /// of its source or destination host. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2752,6 +3324,12 @@ pub mod types { pub targets: Vec, } + impl VpcFirewallRuleUpdate { + pub fn builder() -> builder::VpcFirewallRuleUpdate { + builder::VpcFirewallRuleUpdate::default() + } + } + ///Updateable properties of a `Vpc`'s firewall Note that VpcFirewallRules /// are implicitly created along with a Vpc, so there is no explicit /// creation. @@ -2760,12 +3338,24 @@ pub mod types { pub rules: Vec, } + impl VpcFirewallRuleUpdateParams { + pub fn builder() -> builder::VpcFirewallRuleUpdateParams { + builder::VpcFirewallRuleUpdateParams::default() + } + } + ///Collection of a [`Vpc`]'s firewall rules #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct VpcFirewallRules { pub rules: Vec, } + impl VpcFirewallRules { + pub fn builder() -> builder::VpcFirewallRules { + builder::VpcFirewallRules::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct VpcResultsPage { @@ -2776,6 +3366,12 @@ pub mod types { pub next_page: Option, } + impl VpcResultsPage { + pub fn builder() -> builder::VpcResultsPage { + builder::VpcResultsPage::default() + } + } + ///A VPC router defines a series of rules that indicate where traffic /// should be sent depending on its destination. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2795,6 +3391,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl VpcRouter { + pub fn builder() -> builder::VpcRouter { + builder::VpcRouter::default() + } + } + ///Create-time parameters for a /// [`VpcRouter`](crate::external_api::views::VpcRouter) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2803,6 +3405,12 @@ pub mod types { pub name: Name, } + impl VpcRouterCreate { + pub fn builder() -> builder::VpcRouterCreate { + builder::VpcRouterCreate::default() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema, )] @@ -2843,6 +3451,12 @@ pub mod types { pub next_page: Option, } + impl VpcRouterResultsPage { + pub fn builder() -> builder::VpcRouterResultsPage { + builder::VpcRouterResultsPage::default() + } + } + ///Updateable properties of a /// [`VpcRouter`](crate::external_api::views::VpcRouter) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2853,6 +3467,12 @@ pub mod types { pub name: Option, } + impl VpcRouterUpdate { + pub fn builder() -> builder::VpcRouterUpdate { + builder::VpcRouterUpdate::default() + } + } + ///A VPC subnet represents a logical grouping for instances that allows /// network traffic between them, within a IPv4 subnetwork or optionall an /// IPv6 subnetwork. @@ -2876,6 +3496,12 @@ pub mod types { pub vpc_id: uuid::Uuid, } + impl VpcSubnet { + pub fn builder() -> builder::VpcSubnet { + builder::VpcSubnet::default() + } + } + ///Create-time parameters for a /// [`VpcSubnet`](crate::external_api::views::VpcSubnet) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2897,6 +3523,12 @@ pub mod types { pub name: Name, } + impl VpcSubnetCreate { + pub fn builder() -> builder::VpcSubnetCreate { + builder::VpcSubnetCreate::default() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct VpcSubnetResultsPage { @@ -2907,6 +3539,12 @@ pub mod types { pub next_page: Option, } + impl VpcSubnetResultsPage { + pub fn builder() -> builder::VpcSubnetResultsPage { + builder::VpcSubnetResultsPage::default() + } + } + ///Updateable properties of a /// [`VpcSubnet`](crate::external_api::views::VpcSubnet) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] @@ -2917,6 +3555,12 @@ pub mod types { pub name: Option, } + impl VpcSubnetUpdate { + pub fn builder() -> builder::VpcSubnetUpdate { + builder::VpcSubnetUpdate::default() + } + } + ///Updateable properties of a [`Vpc`](crate::external_api::views::Vpc) #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] pub struct VpcUpdate { @@ -2927,6 +3571,7470 @@ pub mod types { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } + + impl VpcUpdate { + pub fn builder() -> builder::VpcUpdate { + builder::VpcUpdate::default() + } + } + + mod builder { + pub struct Bindouble { + count: Result, + range: Result, + } + + impl Default for Bindouble { + fn default() -> Self { + Self { + count: Err("no value supplied for count".to_string()), + range: Err("no value supplied for range".to_string()), + } + } + } + + impl Bindouble { + pub fn count(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.count = value + .try_into() + .map_err(|e| format!("error converting supplied value for count: {}", e)); + self + } + pub fn range(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.range = value + .try_into() + .map_err(|e| format!("error converting supplied value for range: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Bindouble { + type Error = String; + fn try_from(value: Bindouble) -> Result { + Ok(Self { + count: value.count?, + range: value.range?, + }) + } + } + + pub struct Binint64 { + count: Result, + range: Result, + } + + impl Default for Binint64 { + fn default() -> Self { + Self { + count: Err("no value supplied for count".to_string()), + range: Err("no value supplied for range".to_string()), + } + } + } + + impl Binint64 { + pub fn count(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.count = value + .try_into() + .map_err(|e| format!("error converting supplied value for count: {}", e)); + self + } + pub fn range(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.range = value + .try_into() + .map_err(|e| format!("error converting supplied value for range: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Binint64 { + type Error = String; + fn try_from(value: Binint64) -> Result { + Ok(Self { + count: value.count?, + range: value.range?, + }) + } + } + + pub struct Cumulativedouble { + start_time: Result, String>, + value: Result, + } + + impl Default for Cumulativedouble { + fn default() -> Self { + Self { + start_time: Err("no value supplied for start_time".to_string()), + value: Err("no value supplied for value".to_string()), + } + } + } + + impl Cumulativedouble { + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + pub fn value(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.value = value + .try_into() + .map_err(|e| format!("error converting supplied value for value: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Cumulativedouble { + type Error = String; + fn try_from(value: Cumulativedouble) -> Result { + Ok(Self { + start_time: value.start_time?, + value: value.value?, + }) + } + } + + pub struct Cumulativeint64 { + start_time: Result, String>, + value: Result, + } + + impl Default for Cumulativeint64 { + fn default() -> Self { + Self { + start_time: Err("no value supplied for start_time".to_string()), + value: Err("no value supplied for value".to_string()), + } + } + } + + impl Cumulativeint64 { + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + pub fn value(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.value = value + .try_into() + .map_err(|e| format!("error converting supplied value for value: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Cumulativeint64 { + type Error = String; + fn try_from(value: Cumulativeint64) -> Result { + Ok(Self { + start_time: value.start_time?, + value: value.value?, + }) + } + } + + pub struct DerEncodedKeyPair { + private_key: Result, + public_cert: Result, + } + + impl Default for DerEncodedKeyPair { + fn default() -> Self { + Self { + private_key: Err("no value supplied for private_key".to_string()), + public_cert: Err("no value supplied for public_cert".to_string()), + } + } + } + + impl DerEncodedKeyPair { + pub fn private_key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.private_key = value + .try_into() + .map_err(|e| format!("error converting supplied value for private_key: {}", e)); + self + } + pub fn public_cert(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.public_cert = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_cert: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DerEncodedKeyPair { + type Error = String; + fn try_from(value: DerEncodedKeyPair) -> Result { + Ok(Self { + private_key: value.private_key?, + public_cert: value.public_cert?, + }) + } + } + + pub struct DeviceAccessTokenRequest { + client_id: Result, + device_code: Result, + grant_type: Result, + } + + impl Default for DeviceAccessTokenRequest { + fn default() -> Self { + Self { + client_id: Err("no value supplied for client_id".to_string()), + device_code: Err("no value supplied for device_code".to_string()), + grant_type: Err("no value supplied for grant_type".to_string()), + } + } + } + + impl DeviceAccessTokenRequest { + pub fn client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.client_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for client_id: {}", e)); + self + } + pub fn device_code(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.device_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for device_code: {}", e)); + self + } + pub fn grant_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.grant_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for grant_type: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DeviceAccessTokenRequest { + type Error = String; + fn try_from(value: DeviceAccessTokenRequest) -> Result { + Ok(Self { + client_id: value.client_id?, + device_code: value.device_code?, + grant_type: value.grant_type?, + }) + } + } + + pub struct DeviceAuthRequest { + client_id: Result, + } + + impl Default for DeviceAuthRequest { + fn default() -> Self { + Self { + client_id: Err("no value supplied for client_id".to_string()), + } + } + } + + impl DeviceAuthRequest { + pub fn client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.client_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for client_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DeviceAuthRequest { + type Error = String; + fn try_from(value: DeviceAuthRequest) -> Result { + Ok(Self { + client_id: value.client_id?, + }) + } + } + + pub struct DeviceAuthVerify { + user_code: Result, + } + + impl Default for DeviceAuthVerify { + fn default() -> Self { + Self { + user_code: Err("no value supplied for user_code".to_string()), + } + } + } + + impl DeviceAuthVerify { + pub fn user_code(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for user_code: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DeviceAuthVerify { + type Error = String; + fn try_from(value: DeviceAuthVerify) -> Result { + Ok(Self { + user_code: value.user_code?, + }) + } + } + + pub struct Disk { + block_size: Result, + description: Result, + device_path: Result, + id: Result, + image_id: Result, String>, + name: Result, + project_id: Result, + size: Result, + snapshot_id: Result, String>, + state: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Disk { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + device_path: Err("no value supplied for device_path".to_string()), + id: Err("no value supplied for id".to_string()), + image_id: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + size: Err("no value supplied for size".to_string()), + snapshot_id: Ok(Default::default()), + state: Err("no value supplied for state".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Disk { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 device_path(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.device_path = value + .try_into() + .map_err(|e| format!("error converting supplied value for device_path: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn image_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.image_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for image_id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn snapshot_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.snapshot_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for snapshot_id: {}", e)); + self + } + pub fn state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.state = value + .try_into() + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Disk { + type Error = String; + fn try_from(value: Disk) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + device_path: value.device_path?, + id: value.id?, + image_id: value.image_id?, + name: value.name?, + project_id: value.project_id?, + size: value.size?, + snapshot_id: value.snapshot_id?, + state: value.state?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct DiskCreate { + description: Result, + disk_source: Result, + name: Result, + size: Result, + } + + impl Default for DiskCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disk_source: Err("no value supplied for disk_source".to_string()), + name: Err("no value supplied for name".to_string()), + size: Err("no value supplied for size".to_string()), + } + } + } + + impl DiskCreate { + 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 disk_source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.disk_source = value + .try_into() + .map_err(|e| format!("error converting supplied value for disk_source: {}", 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 + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DiskCreate { + type Error = String; + fn try_from(value: DiskCreate) -> Result { + Ok(Self { + description: value.description?, + disk_source: value.disk_source?, + name: value.name?, + size: value.size?, + }) + } + } + + pub struct DiskIdentifier { + name: Result, + } + + impl Default for DiskIdentifier { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + } + } + } + + impl DiskIdentifier { + 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::DiskIdentifier { + type Error = String; + fn try_from(value: DiskIdentifier) -> Result { + Ok(Self { name: value.name? }) + } + } + + pub struct DiskResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for DiskResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl DiskResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::DiskResultsPage { + type Error = String; + fn try_from(value: DiskResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Distribution { + name: Result, + version: Result, + } + + impl Default for Distribution { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + version: Err("no value supplied for version".to_string()), + } + } + } + + impl Distribution { + 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 + } + pub fn version(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Distribution { + type Error = String; + fn try_from(value: Distribution) -> Result { + Ok(Self { + name: value.name?, + version: value.version?, + }) + } + } + + pub struct Error { + error_code: Result, String>, + message: Result, + request_id: Result, + } + + impl Default for Error { + fn default() -> Self { + Self { + error_code: Ok(Default::default()), + message: Err("no value supplied for message".to_string()), + request_id: Err("no value supplied for request_id".to_string()), + } + } + } + + impl Error { + pub fn error_code(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.error_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for error_code: {}", e)); + self + } + pub fn message(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.message = value + .try_into() + .map_err(|e| format!("error converting supplied value for message: {}", e)); + self + } + pub fn request_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.request_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for request_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Error { + type Error = String; + fn try_from(value: Error) -> Result { + Ok(Self { + error_code: value.error_code?, + message: value.message?, + request_id: value.request_id?, + }) + } + } + + pub struct ExternalIp { + ip: Result, + kind: Result, + } + + impl Default for ExternalIp { + fn default() -> Self { + Self { + ip: Err("no value supplied for ip".to_string()), + kind: Err("no value supplied for kind".to_string()), + } + } + } + + impl ExternalIp { + pub fn ip(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ip = value + .try_into() + .map_err(|e| format!("error converting supplied value for ip: {}", e)); + self + } + pub fn kind(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.kind = value + .try_into() + .map_err(|e| format!("error converting supplied value for kind: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ExternalIp { + type Error = String; + fn try_from(value: ExternalIp) -> Result { + Ok(Self { + ip: value.ip?, + kind: value.kind?, + }) + } + } + + pub struct ExternalIpResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for ExternalIpResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl ExternalIpResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ExternalIpResultsPage { + type Error = String; + fn try_from(value: ExternalIpResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct FieldSchema { + name: Result, + source: Result, + ty: Result, + } + + impl Default for FieldSchema { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + source: Err("no value supplied for source".to_string()), + ty: Err("no value supplied for ty".to_string()), + } + } + } + + impl FieldSchema { + 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 + } + pub fn source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + pub fn ty(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ty = value + .try_into() + .map_err(|e| format!("error converting supplied value for ty: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::FieldSchema { + type Error = String; + fn try_from(value: FieldSchema) -> Result { + Ok(Self { + name: value.name?, + source: value.source?, + ty: value.ty?, + }) + } + } + + pub struct FleetRolePolicy { + role_assignments: Result, String>, + } + + impl Default for FleetRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl FleetRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::FleetRolePolicy { + type Error = String; + fn try_from(value: FleetRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct FleetRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for FleetRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl FleetRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::FleetRoleRoleAssignment { + type Error = String; + fn try_from(value: FleetRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct GlobalImage { + block_size: Result, + description: Result, + digest: Result, String>, + distribution: Result, + id: Result, + name: Result, + size: Result, + time_created: Result, String>, + time_modified: Result, String>, + url: Result, String>, + version: Result, + } + + impl Default for GlobalImage { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + digest: Ok(Default::default()), + distribution: Err("no value supplied for distribution".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + size: Err("no value supplied for size".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + url: Ok(Default::default()), + version: Err("no value supplied for version".to_string()), + } + } + } + + impl GlobalImage { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 digest(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.digest = value + .try_into() + .map_err(|e| format!("error converting supplied value for digest: {}", e)); + self + } + pub fn distribution(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.distribution = value.try_into().map_err(|e| { + format!("error converting supplied value for distribution: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn url(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.url = value + .try_into() + .map_err(|e| format!("error converting supplied value for url: {}", e)); + self + } + pub fn version(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalImage { + type Error = String; + fn try_from(value: GlobalImage) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + digest: value.digest?, + distribution: value.distribution?, + id: value.id?, + name: value.name?, + size: value.size?, + time_created: value.time_created?, + time_modified: value.time_modified?, + url: value.url?, + version: value.version?, + }) + } + } + + pub struct GlobalImageCreate { + block_size: Result, + description: Result, + distribution: Result, + name: Result, + source: Result, + } + + impl Default for GlobalImageCreate { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + distribution: Err("no value supplied for distribution".to_string()), + name: Err("no value supplied for name".to_string()), + source: Err("no value supplied for source".to_string()), + } + } + } + + impl GlobalImageCreate { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 distribution(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.distribution = value.try_into().map_err(|e| { + format!("error converting supplied value for distribution: {}", 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 + } + pub fn source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalImageCreate { + type Error = String; + fn try_from(value: GlobalImageCreate) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + distribution: value.distribution?, + name: value.name?, + source: value.source?, + }) + } + } + + pub struct GlobalImageResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for GlobalImageResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl GlobalImageResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::GlobalImageResultsPage { + type Error = String; + fn try_from(value: GlobalImageResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Histogramdouble { + bins: Result, String>, + n_samples: Result, + start_time: Result, String>, + } + + impl Default for Histogramdouble { + fn default() -> Self { + Self { + bins: Err("no value supplied for bins".to_string()), + n_samples: Err("no value supplied for n_samples".to_string()), + start_time: Err("no value supplied for start_time".to_string()), + } + } + } + + impl Histogramdouble { + pub fn bins(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.bins = value + .try_into() + .map_err(|e| format!("error converting supplied value for bins: {}", e)); + self + } + pub fn n_samples(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.n_samples = value + .try_into() + .map_err(|e| format!("error converting supplied value for n_samples: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Histogramdouble { + type Error = String; + fn try_from(value: Histogramdouble) -> Result { + Ok(Self { + bins: value.bins?, + n_samples: value.n_samples?, + start_time: value.start_time?, + }) + } + } + + pub struct Histogramint64 { + bins: Result, String>, + n_samples: Result, + start_time: Result, String>, + } + + impl Default for Histogramint64 { + fn default() -> Self { + Self { + bins: Err("no value supplied for bins".to_string()), + n_samples: Err("no value supplied for n_samples".to_string()), + start_time: Err("no value supplied for start_time".to_string()), + } + } + } + + impl Histogramint64 { + pub fn bins(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.bins = value + .try_into() + .map_err(|e| format!("error converting supplied value for bins: {}", e)); + self + } + pub fn n_samples(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.n_samples = value + .try_into() + .map_err(|e| format!("error converting supplied value for n_samples: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Histogramint64 { + type Error = String; + fn try_from(value: Histogramint64) -> Result { + Ok(Self { + bins: value.bins?, + n_samples: value.n_samples?, + start_time: value.start_time?, + }) + } + } + + pub struct IdentityProvider { + description: Result, + id: Result, + name: Result, + provider_type: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for IdentityProvider { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + provider_type: Err("no value supplied for provider_type".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl IdentityProvider { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn provider_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.provider_type = value.try_into().map_err(|e| { + format!("error converting supplied value for provider_type: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::IdentityProvider { + type Error = String; + fn try_from(value: IdentityProvider) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + provider_type: value.provider_type?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct IdentityProviderResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for IdentityProviderResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl IdentityProviderResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IdentityProviderResultsPage { + type Error = String; + fn try_from(value: IdentityProviderResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Image { + block_size: Result, + description: Result, + digest: Result, String>, + id: Result, + name: Result, + project_id: Result, + size: Result, + time_created: Result, String>, + time_modified: Result, String>, + url: Result, String>, + version: Result, String>, + } + + impl Default for Image { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + digest: Ok(Default::default()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + size: Err("no value supplied for size".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + url: Ok(Default::default()), + version: Ok(Default::default()), + } + } + } + + impl Image { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 digest(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.digest = value + .try_into() + .map_err(|e| format!("error converting supplied value for digest: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn url(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.url = value + .try_into() + .map_err(|e| format!("error converting supplied value for url: {}", e)); + self + } + pub fn version(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Image { + type Error = String; + fn try_from(value: Image) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + digest: value.digest?, + id: value.id?, + name: value.name?, + project_id: value.project_id?, + size: value.size?, + time_created: value.time_created?, + time_modified: value.time_modified?, + url: value.url?, + version: value.version?, + }) + } + } + + pub struct ImageCreate { + block_size: Result, + description: Result, + name: Result, + source: Result, + } + + impl Default for ImageCreate { + fn default() -> Self { + Self { + block_size: Err("no value supplied for block_size".to_string()), + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + source: Err("no value supplied for source".to_string()), + } + } + } + + impl ImageCreate { + pub fn block_size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.block_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for block_size: {}", e)); + self + } + 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 + } + pub fn source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ImageCreate { + type Error = String; + fn try_from(value: ImageCreate) -> Result { + Ok(Self { + block_size: value.block_size?, + description: value.description?, + name: value.name?, + source: value.source?, + }) + } + } + + pub struct ImageResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for ImageResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl ImageResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ImageResultsPage { + type Error = String; + fn try_from(value: ImageResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Instance { + description: Result, + hostname: Result, + id: Result, + memory: Result, + name: Result, + ncpus: Result, + project_id: Result, + run_state: Result, + time_created: Result, String>, + time_modified: Result, String>, + time_run_state_updated: Result, String>, + } + + impl Default for Instance { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + hostname: Err("no value supplied for hostname".to_string()), + id: Err("no value supplied for id".to_string()), + memory: Err("no value supplied for memory".to_string()), + name: Err("no value supplied for name".to_string()), + ncpus: Err("no value supplied for ncpus".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + run_state: Err("no value supplied for run_state".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + time_run_state_updated: Err( + "no value supplied for time_run_state_updated".to_string() + ), + } + } + } + + impl Instance { + 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 hostname(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.hostname = value + .try_into() + .map_err(|e| format!("error converting supplied value for hostname: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn memory(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.memory = value + .try_into() + .map_err(|e| format!("error converting supplied value for memory: {}", 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 + } + pub fn ncpus(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ncpus = value + .try_into() + .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); + self + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn run_state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.run_state = value + .try_into() + .map_err(|e| format!("error converting supplied value for run_state: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn time_run_state_updated(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_run_state_updated = value.try_into().map_err(|e| { + format!( + "error converting supplied value for time_run_state_updated: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::Instance { + type Error = String; + fn try_from(value: Instance) -> Result { + Ok(Self { + description: value.description?, + hostname: value.hostname?, + id: value.id?, + memory: value.memory?, + name: value.name?, + ncpus: value.ncpus?, + project_id: value.project_id?, + run_state: value.run_state?, + time_created: value.time_created?, + time_modified: value.time_modified?, + time_run_state_updated: value.time_run_state_updated?, + }) + } + } + + pub struct InstanceCreate { + description: Result, + disks: Result, String>, + external_ips: Result, String>, + hostname: Result, + memory: Result, + name: Result, + ncpus: Result, + network_interfaces: Result, + user_data: Result, + } + + impl Default for InstanceCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disks: Ok(Default::default()), + external_ips: Ok(Default::default()), + hostname: Err("no value supplied for hostname".to_string()), + memory: Err("no value supplied for memory".to_string()), + name: Err("no value supplied for name".to_string()), + ncpus: Err("no value supplied for ncpus".to_string()), + network_interfaces: Ok(super::defaults::instance_create_network_interfaces()), + user_data: Ok(Default::default()), + } + } + } + + impl InstanceCreate { + 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 disks(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.disks = value + .try_into() + .map_err(|e| format!("error converting supplied value for disks: {}", e)); + self + } + pub fn external_ips(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.external_ips = value.try_into().map_err(|e| { + format!("error converting supplied value for external_ips: {}", e) + }); + self + } + pub fn hostname(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.hostname = value + .try_into() + .map_err(|e| format!("error converting supplied value for hostname: {}", e)); + self + } + pub fn memory(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.memory = value + .try_into() + .map_err(|e| format!("error converting supplied value for memory: {}", 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 + } + pub fn ncpus(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ncpus = value + .try_into() + .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); + self + } + pub fn network_interfaces(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.network_interfaces = value.try_into().map_err(|e| { + format!( + "error converting supplied value for network_interfaces: {}", + e + ) + }); + self + } + pub fn user_data(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_data = value + .try_into() + .map_err(|e| format!("error converting supplied value for user_data: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::InstanceCreate { + type Error = String; + fn try_from(value: InstanceCreate) -> Result { + Ok(Self { + description: value.description?, + disks: value.disks?, + external_ips: value.external_ips?, + hostname: value.hostname?, + memory: value.memory?, + name: value.name?, + ncpus: value.ncpus?, + network_interfaces: value.network_interfaces?, + user_data: value.user_data?, + }) + } + } + + pub struct InstanceMigrate { + dst_sled_id: Result, + } + + impl Default for InstanceMigrate { + fn default() -> Self { + Self { + dst_sled_id: Err("no value supplied for dst_sled_id".to_string()), + } + } + } + + impl InstanceMigrate { + pub fn dst_sled_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dst_sled_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for dst_sled_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::InstanceMigrate { + type Error = String; + fn try_from(value: InstanceMigrate) -> Result { + Ok(Self { + dst_sled_id: value.dst_sled_id?, + }) + } + } + + pub struct InstanceResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for InstanceResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl InstanceResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::InstanceResultsPage { + type Error = String; + fn try_from(value: InstanceResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct InstanceSerialConsoleData { + data: Result, String>, + last_byte_offset: Result, + } + + impl Default for InstanceSerialConsoleData { + fn default() -> Self { + Self { + data: Err("no value supplied for data".to_string()), + last_byte_offset: Err("no value supplied for last_byte_offset".to_string()), + } + } + } + + impl InstanceSerialConsoleData { + pub fn data(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.data = value + .try_into() + .map_err(|e| format!("error converting supplied value for data: {}", e)); + self + } + pub fn last_byte_offset(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.last_byte_offset = value.try_into().map_err(|e| { + format!( + "error converting supplied value for last_byte_offset: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::InstanceSerialConsoleData { + type Error = String; + fn try_from(value: InstanceSerialConsoleData) -> Result { + Ok(Self { + data: value.data?, + last_byte_offset: value.last_byte_offset?, + }) + } + } + + pub struct IpPool { + description: Result, + id: Result, + name: Result, + project_id: Result, String>, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for IpPool { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Ok(Default::default()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl IpPool { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::IpPool { + type Error = String; + fn try_from(value: IpPool) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + project_id: value.project_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct IpPoolCreate { + description: Result, + name: Result, + organization: Result, String>, + project: Result, String>, + } + + impl Default for IpPoolCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + organization: Ok(Default::default()), + project: Ok(Default::default()), + } + } + } + + impl IpPoolCreate { + 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 + } + pub fn organization(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.organization = value.try_into().map_err(|e| { + format!("error converting supplied value for organization: {}", e) + }); + self + } + pub fn project(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.project = value + .try_into() + .map_err(|e| format!("error converting supplied value for project: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IpPoolCreate { + type Error = String; + fn try_from(value: IpPoolCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + organization: value.organization?, + project: value.project?, + }) + } + } + + pub struct IpPoolRange { + id: Result, + range: Result, + time_created: Result, String>, + } + + impl Default for IpPoolRange { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + range: Err("no value supplied for range".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + } + } + } + + impl IpPoolRange { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn range(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.range = value + .try_into() + .map_err(|e| format!("error converting supplied value for range: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::IpPoolRange { + type Error = String; + fn try_from(value: IpPoolRange) -> Result { + Ok(Self { + id: value.id?, + range: value.range?, + time_created: value.time_created?, + }) + } + } + + pub struct IpPoolRangeResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for IpPoolRangeResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl IpPoolRangeResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IpPoolRangeResultsPage { + type Error = String; + fn try_from(value: IpPoolRangeResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct IpPoolResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for IpPoolResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl IpPoolResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::IpPoolResultsPage { + type Error = String; + fn try_from(value: IpPoolResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct IpPoolUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for IpPoolUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl IpPoolUpdate { + 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::IpPoolUpdate { + type Error = String; + fn try_from(value: IpPoolUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct Ipv4Range { + first: Result, + last: Result, + } + + impl Default for Ipv4Range { + fn default() -> Self { + Self { + first: Err("no value supplied for first".to_string()), + last: Err("no value supplied for last".to_string()), + } + } + } + + impl Ipv4Range { + pub fn first(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.first = value + .try_into() + .map_err(|e| format!("error converting supplied value for first: {}", e)); + self + } + pub fn last(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.last = value + .try_into() + .map_err(|e| format!("error converting supplied value for last: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Ipv4Range { + type Error = String; + fn try_from(value: Ipv4Range) -> Result { + Ok(Self { + first: value.first?, + last: value.last?, + }) + } + } + + pub struct Ipv6Range { + first: Result, + last: Result, + } + + impl Default for Ipv6Range { + fn default() -> Self { + Self { + first: Err("no value supplied for first".to_string()), + last: Err("no value supplied for last".to_string()), + } + } + } + + impl Ipv6Range { + pub fn first(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.first = value + .try_into() + .map_err(|e| format!("error converting supplied value for first: {}", e)); + self + } + pub fn last(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.last = value + .try_into() + .map_err(|e| format!("error converting supplied value for last: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Ipv6Range { + type Error = String; + fn try_from(value: Ipv6Range) -> Result { + Ok(Self { + first: value.first?, + last: value.last?, + }) + } + } + + pub struct Measurement { + datum: Result, + timestamp: Result, String>, + } + + impl Default for Measurement { + fn default() -> Self { + Self { + datum: Err("no value supplied for datum".to_string()), + timestamp: Err("no value supplied for timestamp".to_string()), + } + } + } + + impl Measurement { + pub fn datum(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.datum = value + .try_into() + .map_err(|e| format!("error converting supplied value for datum: {}", e)); + self + } + pub fn timestamp(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.timestamp = value + .try_into() + .map_err(|e| format!("error converting supplied value for timestamp: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Measurement { + type Error = String; + fn try_from(value: Measurement) -> Result { + Ok(Self { + datum: value.datum?, + timestamp: value.timestamp?, + }) + } + } + + pub struct MeasurementResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for MeasurementResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl MeasurementResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::MeasurementResultsPage { + type Error = String; + fn try_from(value: MeasurementResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct NetworkInterface { + description: Result, + id: Result, + instance_id: Result, + ip: Result, + mac: Result, + name: Result, + primary: Result, + subnet_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for NetworkInterface { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + instance_id: Err("no value supplied for instance_id".to_string()), + ip: Err("no value supplied for ip".to_string()), + mac: Err("no value supplied for mac".to_string()), + name: Err("no value supplied for name".to_string()), + primary: Err("no value supplied for primary".to_string()), + subnet_id: Err("no value supplied for subnet_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl NetworkInterface { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn instance_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.instance_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for instance_id: {}", e)); + self + } + pub fn ip(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ip = value + .try_into() + .map_err(|e| format!("error converting supplied value for ip: {}", e)); + self + } + pub fn mac(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.mac = value + .try_into() + .map_err(|e| format!("error converting supplied value for mac: {}", 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 + } + pub fn primary(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.primary = value + .try_into() + .map_err(|e| format!("error converting supplied value for primary: {}", e)); + self + } + pub fn subnet_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.subnet_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for subnet_id: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NetworkInterface { + type Error = String; + fn try_from(value: NetworkInterface) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + instance_id: value.instance_id?, + ip: value.ip?, + mac: value.mac?, + name: value.name?, + primary: value.primary?, + subnet_id: value.subnet_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct NetworkInterfaceCreate { + description: Result, + ip: Result, String>, + name: Result, + subnet_name: Result, + vpc_name: Result, + } + + impl Default for NetworkInterfaceCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + ip: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + subnet_name: Err("no value supplied for subnet_name".to_string()), + vpc_name: Err("no value supplied for vpc_name".to_string()), + } + } + } + + impl NetworkInterfaceCreate { + 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 ip(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.ip = value + .try_into() + .map_err(|e| format!("error converting supplied value for ip: {}", 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 + } + pub fn subnet_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.subnet_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for subnet_name: {}", e)); + self + } + pub fn vpc_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NetworkInterfaceCreate { + type Error = String; + fn try_from(value: NetworkInterfaceCreate) -> Result { + Ok(Self { + description: value.description?, + ip: value.ip?, + name: value.name?, + subnet_name: value.subnet_name?, + vpc_name: value.vpc_name?, + }) + } + } + + pub struct NetworkInterfaceResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for NetworkInterfaceResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl NetworkInterfaceResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NetworkInterfaceResultsPage { + type Error = String; + fn try_from(value: NetworkInterfaceResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct NetworkInterfaceUpdate { + description: Result, String>, + make_primary: Result, + name: Result, String>, + } + + impl Default for NetworkInterfaceUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + make_primary: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl NetworkInterfaceUpdate { + 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 make_primary(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.make_primary = value.try_into().map_err(|e| { + format!("error converting supplied value for make_primary: {}", 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::NetworkInterfaceUpdate { + type Error = String; + fn try_from(value: NetworkInterfaceUpdate) -> Result { + Ok(Self { + description: value.description?, + make_primary: value.make_primary?, + name: value.name?, + }) + } + } + + pub struct Organization { + description: Result, + id: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Organization { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Organization { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Organization { + type Error = String; + fn try_from(value: Organization) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct OrganizationCreate { + description: Result, + name: Result, + } + + impl Default for OrganizationCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl OrganizationCreate { + 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::OrganizationCreate { + type Error = String; + fn try_from(value: OrganizationCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct OrganizationResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for OrganizationResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl OrganizationResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::OrganizationResultsPage { + type Error = String; + fn try_from(value: OrganizationResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct OrganizationRolePolicy { + role_assignments: Result, String>, + } + + impl Default for OrganizationRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl OrganizationRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::OrganizationRolePolicy { + type Error = String; + fn try_from(value: OrganizationRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct OrganizationRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for OrganizationRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl OrganizationRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom + for super::OrganizationRoleRoleAssignment + { + type Error = String; + fn try_from(value: OrganizationRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct OrganizationUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for OrganizationUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl OrganizationUpdate { + 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::OrganizationUpdate { + type Error = String; + fn try_from(value: OrganizationUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct Project { + description: Result, + id: Result, + name: Result, + organization_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Project { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + organization_id: Err("no value supplied for organization_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Project { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn organization_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.organization_id = value.try_into().map_err(|e| { + format!("error converting supplied value for organization_id: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Project { + type Error = String; + fn try_from(value: Project) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + organization_id: value.organization_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct ProjectCreate { + description: Result, + name: Result, + } + + impl Default for ProjectCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl ProjectCreate { + 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::ProjectCreate { + type Error = String; + fn try_from(value: ProjectCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct ProjectResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for ProjectResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl ProjectResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ProjectResultsPage { + type Error = String; + fn try_from(value: ProjectResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct ProjectRolePolicy { + role_assignments: Result, String>, + } + + impl Default for ProjectRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl ProjectRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::ProjectRolePolicy { + type Error = String; + fn try_from(value: ProjectRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct ProjectRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for ProjectRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl ProjectRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::ProjectRoleRoleAssignment { + type Error = String; + fn try_from(value: ProjectRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct ProjectUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for ProjectUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl ProjectUpdate { + 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::ProjectUpdate { + type Error = String; + fn try_from(value: ProjectUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct Rack { + id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Rack { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Rack { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Rack { + type Error = String; + fn try_from(value: Rack) -> Result { + Ok(Self { + id: value.id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct RackResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for RackResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl RackResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RackResultsPage { + type Error = String; + fn try_from(value: RackResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Role { + description: Result, + name: Result, + } + + impl Default for Role { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl Role { + 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::Role { + type Error = String; + fn try_from(value: Role) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct RoleResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for RoleResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl RoleResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RoleResultsPage { + type Error = String; + fn try_from(value: RoleResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct RouterRoute { + description: Result, + destination: Result, + id: Result, + kind: Result, + name: Result, + target: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_router_id: Result, + } + + impl Default for RouterRoute { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + destination: Err("no value supplied for destination".to_string()), + id: Err("no value supplied for id".to_string()), + kind: Err("no value supplied for kind".to_string()), + name: Err("no value supplied for name".to_string()), + target: Err("no value supplied for target".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_router_id: Err("no value supplied for vpc_router_id".to_string()), + } + } + } + + impl RouterRoute { + 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 destination(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.destination = value + .try_into() + .map_err(|e| format!("error converting supplied value for destination: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn kind(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.kind = value + .try_into() + .map_err(|e| format!("error converting supplied value for kind: {}", 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 + } + pub fn target(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.target = value + .try_into() + .map_err(|e| format!("error converting supplied value for target: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_router_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_router_id = value.try_into().map_err(|e| { + format!("error converting supplied value for vpc_router_id: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::RouterRoute { + type Error = String; + fn try_from(value: RouterRoute) -> Result { + Ok(Self { + description: value.description?, + destination: value.destination?, + id: value.id?, + kind: value.kind?, + name: value.name?, + target: value.target?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_router_id: value.vpc_router_id?, + }) + } + } + + pub struct RouterRouteCreateParams { + description: Result, + destination: Result, + name: Result, + target: Result, + } + + impl Default for RouterRouteCreateParams { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + destination: Err("no value supplied for destination".to_string()), + name: Err("no value supplied for name".to_string()), + target: Err("no value supplied for target".to_string()), + } + } + } + + impl RouterRouteCreateParams { + 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 destination(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.destination = value + .try_into() + .map_err(|e| format!("error converting supplied value for destination: {}", 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 + } + pub fn target(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.target = value + .try_into() + .map_err(|e| format!("error converting supplied value for target: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouterRouteCreateParams { + type Error = String; + fn try_from(value: RouterRouteCreateParams) -> Result { + Ok(Self { + description: value.description?, + destination: value.destination?, + name: value.name?, + target: value.target?, + }) + } + } + + pub struct RouterRouteResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for RouterRouteResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl RouterRouteResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouterRouteResultsPage { + type Error = String; + fn try_from(value: RouterRouteResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct RouterRouteUpdateParams { + description: Result, String>, + destination: Result, + name: Result, String>, + target: Result, + } + + impl Default for RouterRouteUpdateParams { + fn default() -> Self { + Self { + description: Ok(Default::default()), + destination: Err("no value supplied for destination".to_string()), + name: Ok(Default::default()), + target: Err("no value supplied for target".to_string()), + } + } + } + + impl RouterRouteUpdateParams { + 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 destination(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.destination = value + .try_into() + .map_err(|e| format!("error converting supplied value for destination: {}", 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 + } + pub fn target(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.target = value + .try_into() + .map_err(|e| format!("error converting supplied value for target: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouterRouteUpdateParams { + type Error = String; + fn try_from(value: RouterRouteUpdateParams) -> Result { + Ok(Self { + description: value.description?, + destination: value.destination?, + name: value.name?, + target: value.target?, + }) + } + } + + pub struct Saga { + id: Result, + state: Result, + } + + impl Default for Saga { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + state: Err("no value supplied for state".to_string()), + } + } + } + + impl Saga { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn state(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.state = value + .try_into() + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::Saga { + type Error = String; + fn try_from(value: Saga) -> Result { + Ok(Self { + id: value.id?, + state: value.state?, + }) + } + } + + pub struct SagaResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SagaResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SagaResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SagaResultsPage { + type Error = String; + fn try_from(value: SagaResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct SamlIdentityProvider { + acs_url: Result, + description: Result, + id: Result, + idp_entity_id: Result, + name: Result, + public_cert: Result, String>, + slo_url: Result, + sp_client_id: Result, + technical_contact_email: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for SamlIdentityProvider { + fn default() -> Self { + Self { + acs_url: Err("no value supplied for acs_url".to_string()), + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + idp_entity_id: Err("no value supplied for idp_entity_id".to_string()), + name: Err("no value supplied for name".to_string()), + public_cert: Ok(Default::default()), + slo_url: Err("no value supplied for slo_url".to_string()), + sp_client_id: Err("no value supplied for sp_client_id".to_string()), + technical_contact_email: Err( + "no value supplied for technical_contact_email".to_string() + ), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl SamlIdentityProvider { + pub fn acs_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.acs_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for acs_url: {}", e)); + self + } + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn idp_entity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idp_entity_id = value.try_into().map_err(|e| { + format!("error converting supplied value for idp_entity_id: {}", 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 + } + pub fn public_cert(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.public_cert = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_cert: {}", e)); + self + } + pub fn slo_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.slo_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for slo_url: {}", e)); + self + } + pub fn sp_client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.sp_client_id = value.try_into().map_err(|e| { + format!("error converting supplied value for sp_client_id: {}", e) + }); + self + } + pub fn technical_contact_email(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.technical_contact_email = value.try_into().map_err(|e| { + format!( + "error converting supplied value for technical_contact_email: {}", + e + ) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::SamlIdentityProvider { + type Error = String; + fn try_from(value: SamlIdentityProvider) -> Result { + Ok(Self { + acs_url: value.acs_url?, + description: value.description?, + id: value.id?, + idp_entity_id: value.idp_entity_id?, + name: value.name?, + public_cert: value.public_cert?, + slo_url: value.slo_url?, + sp_client_id: value.sp_client_id?, + technical_contact_email: value.technical_contact_email?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SamlIdentityProviderCreate { + acs_url: Result, + description: Result, + idp_entity_id: Result, + idp_metadata_source: Result, + name: Result, + signing_keypair: Result, String>, + slo_url: Result, + sp_client_id: Result, + technical_contact_email: Result, + } + + impl Default for SamlIdentityProviderCreate { + fn default() -> Self { + Self { + acs_url: Err("no value supplied for acs_url".to_string()), + description: Err("no value supplied for description".to_string()), + idp_entity_id: Err("no value supplied for idp_entity_id".to_string()), + idp_metadata_source: Err( + "no value supplied for idp_metadata_source".to_string() + ), + name: Err("no value supplied for name".to_string()), + signing_keypair: Ok(Default::default()), + slo_url: Err("no value supplied for slo_url".to_string()), + sp_client_id: Err("no value supplied for sp_client_id".to_string()), + technical_contact_email: Err( + "no value supplied for technical_contact_email".to_string() + ), + } + } + } + + impl SamlIdentityProviderCreate { + pub fn acs_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.acs_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for acs_url: {}", e)); + self + } + 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 idp_entity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idp_entity_id = value.try_into().map_err(|e| { + format!("error converting supplied value for idp_entity_id: {}", e) + }); + self + } + pub fn idp_metadata_source(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idp_metadata_source = value.try_into().map_err(|e| { + format!( + "error converting supplied value for idp_metadata_source: {}", + 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 + } + pub fn signing_keypair(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.signing_keypair = value.try_into().map_err(|e| { + format!("error converting supplied value for signing_keypair: {}", e) + }); + self + } + pub fn slo_url(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.slo_url = value + .try_into() + .map_err(|e| format!("error converting supplied value for slo_url: {}", e)); + self + } + pub fn sp_client_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.sp_client_id = value.try_into().map_err(|e| { + format!("error converting supplied value for sp_client_id: {}", e) + }); + self + } + pub fn technical_contact_email(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.technical_contact_email = value.try_into().map_err(|e| { + format!( + "error converting supplied value for technical_contact_email: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::SamlIdentityProviderCreate { + type Error = String; + fn try_from(value: SamlIdentityProviderCreate) -> Result { + Ok(Self { + acs_url: value.acs_url?, + description: value.description?, + idp_entity_id: value.idp_entity_id?, + idp_metadata_source: value.idp_metadata_source?, + name: value.name?, + signing_keypair: value.signing_keypair?, + slo_url: value.slo_url?, + sp_client_id: value.sp_client_id?, + technical_contact_email: value.technical_contact_email?, + }) + } + } + + pub struct Silo { + description: Result, + discoverable: Result, + id: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + user_provision_type: Result, + } + + impl Default for Silo { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + discoverable: Err("no value supplied for discoverable".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + user_provision_type: Err( + "no value supplied for user_provision_type".to_string() + ), + } + } + } + + impl Silo { + 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 discoverable(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.discoverable = value.try_into().map_err(|e| { + format!("error converting supplied value for discoverable: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn user_provision_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_provision_type = value.try_into().map_err(|e| { + format!( + "error converting supplied value for user_provision_type: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::Silo { + type Error = String; + fn try_from(value: Silo) -> Result { + Ok(Self { + description: value.description?, + discoverable: value.discoverable?, + id: value.id?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + user_provision_type: value.user_provision_type?, + }) + } + } + + pub struct SiloCreate { + description: Result, + discoverable: Result, + name: Result, + user_provision_type: Result, + } + + impl Default for SiloCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + discoverable: Err("no value supplied for discoverable".to_string()), + name: Err("no value supplied for name".to_string()), + user_provision_type: Err( + "no value supplied for user_provision_type".to_string() + ), + } + } + } + + impl SiloCreate { + 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 discoverable(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.discoverable = value.try_into().map_err(|e| { + format!("error converting supplied value for discoverable: {}", 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 + } + pub fn user_provision_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.user_provision_type = value.try_into().map_err(|e| { + format!( + "error converting supplied value for user_provision_type: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::SiloCreate { + type Error = String; + fn try_from(value: SiloCreate) -> Result { + Ok(Self { + description: value.description?, + discoverable: value.discoverable?, + name: value.name?, + user_provision_type: value.user_provision_type?, + }) + } + } + + pub struct SiloResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SiloResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SiloResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SiloResultsPage { + type Error = String; + fn try_from(value: SiloResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct SiloRolePolicy { + role_assignments: Result, String>, + } + + impl Default for SiloRolePolicy { + fn default() -> Self { + Self { + role_assignments: Err("no value supplied for role_assignments".to_string()), + } + } + } + + impl SiloRolePolicy { + pub fn role_assignments(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.role_assignments = value.try_into().map_err(|e| { + format!( + "error converting supplied value for role_assignments: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::SiloRolePolicy { + type Error = String; + fn try_from(value: SiloRolePolicy) -> Result { + Ok(Self { + role_assignments: value.role_assignments?, + }) + } + } + + pub struct SiloRoleRoleAssignment { + identity_id: Result, + identity_type: Result, + role_name: Result, + } + + impl Default for SiloRoleRoleAssignment { + fn default() -> Self { + Self { + identity_id: Err("no value supplied for identity_id".to_string()), + identity_type: Err("no value supplied for identity_type".to_string()), + role_name: Err("no value supplied for role_name".to_string()), + } + } + } + + impl SiloRoleRoleAssignment { + pub fn identity_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); + self + } + pub fn identity_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.identity_type = value.try_into().map_err(|e| { + format!("error converting supplied value for identity_type: {}", e) + }); + self + } + pub fn role_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.role_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for role_name: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SiloRoleRoleAssignment { + type Error = String; + fn try_from(value: SiloRoleRoleAssignment) -> Result { + Ok(Self { + identity_id: value.identity_id?, + identity_type: value.identity_type?, + role_name: value.role_name?, + }) + } + } + + pub struct Sled { + id: Result, + service_address: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Sled { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + service_address: Err("no value supplied for service_address".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Sled { + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn service_address(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.service_address = value.try_into().map_err(|e| { + format!("error converting supplied value for service_address: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Sled { + type Error = String; + fn try_from(value: Sled) -> Result { + Ok(Self { + id: value.id?, + service_address: value.service_address?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SledResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SledResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SledResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SledResultsPage { + type Error = String; + fn try_from(value: SledResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Snapshot { + description: Result, + disk_id: Result, + id: Result, + name: Result, + project_id: Result, + size: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Snapshot { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disk_id: Err("no value supplied for disk_id".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + size: Err("no value supplied for size".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Snapshot { + 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 disk_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.disk_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for disk_id: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Snapshot { + type Error = String; + fn try_from(value: Snapshot) -> Result { + Ok(Self { + description: value.description?, + disk_id: value.disk_id?, + id: value.id?, + name: value.name?, + project_id: value.project_id?, + size: value.size?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SnapshotCreate { + description: Result, + disk: Result, + name: Result, + } + + impl Default for SnapshotCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + disk: Err("no value supplied for disk".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl SnapshotCreate { + 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 disk(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.disk = value + .try_into() + .map_err(|e| format!("error converting supplied value for disk: {}", 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::SnapshotCreate { + type Error = String; + fn try_from(value: SnapshotCreate) -> Result { + Ok(Self { + description: value.description?, + disk: value.disk?, + name: value.name?, + }) + } + } + + pub struct SnapshotResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SnapshotResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SnapshotResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SnapshotResultsPage { + type Error = String; + fn try_from(value: SnapshotResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct SpoofLoginBody { + username: Result, + } + + impl Default for SpoofLoginBody { + fn default() -> Self { + Self { + username: Err("no value supplied for username".to_string()), + } + } + } + + impl SpoofLoginBody { + pub fn username(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.username = value + .try_into() + .map_err(|e| format!("error converting supplied value for username: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SpoofLoginBody { + type Error = String; + fn try_from(value: SpoofLoginBody) -> Result { + Ok(Self { + username: value.username?, + }) + } + } + + pub struct SshKey { + description: Result, + id: Result, + name: Result, + public_key: Result, + silo_user_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for SshKey { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + public_key: Err("no value supplied for public_key".to_string()), + silo_user_id: Err("no value supplied for silo_user_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl SshKey { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn public_key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.public_key = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_key: {}", e)); + self + } + pub fn silo_user_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.silo_user_id = value.try_into().map_err(|e| { + format!("error converting supplied value for silo_user_id: {}", e) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::SshKey { + type Error = String; + fn try_from(value: SshKey) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + public_key: value.public_key?, + silo_user_id: value.silo_user_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct SshKeyCreate { + description: Result, + name: Result, + public_key: Result, + } + + impl Default for SshKeyCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + public_key: Err("no value supplied for public_key".to_string()), + } + } + } + + impl SshKeyCreate { + 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 + } + pub fn public_key(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.public_key = value + .try_into() + .map_err(|e| format!("error converting supplied value for public_key: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SshKeyCreate { + type Error = String; + fn try_from(value: SshKeyCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + public_key: value.public_key?, + }) + } + } + + pub struct SshKeyResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for SshKeyResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl SshKeyResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::SshKeyResultsPage { + type Error = String; + fn try_from(value: SshKeyResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct TimeseriesSchema { + created: Result, String>, + datum_type: Result, + field_schema: Result, String>, + timeseries_name: Result, + } + + impl Default for TimeseriesSchema { + fn default() -> Self { + Self { + created: Err("no value supplied for created".to_string()), + datum_type: Err("no value supplied for datum_type".to_string()), + field_schema: Err("no value supplied for field_schema".to_string()), + timeseries_name: Err("no value supplied for timeseries_name".to_string()), + } + } + } + + impl TimeseriesSchema { + pub fn created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.created = value + .try_into() + .map_err(|e| format!("error converting supplied value for created: {}", e)); + self + } + pub fn datum_type(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.datum_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for datum_type: {}", e)); + self + } + pub fn field_schema(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.field_schema = value.try_into().map_err(|e| { + format!("error converting supplied value for field_schema: {}", e) + }); + self + } + pub fn timeseries_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.timeseries_name = value.try_into().map_err(|e| { + format!("error converting supplied value for timeseries_name: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::TimeseriesSchema { + type Error = String; + fn try_from(value: TimeseriesSchema) -> Result { + Ok(Self { + created: value.created?, + datum_type: value.datum_type?, + field_schema: value.field_schema?, + timeseries_name: value.timeseries_name?, + }) + } + } + + pub struct TimeseriesSchemaResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for TimeseriesSchemaResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl TimeseriesSchemaResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::TimeseriesSchemaResultsPage { + type Error = String; + fn try_from(value: TimeseriesSchemaResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct User { + display_name: Result, + id: Result, + } + + impl Default for User { + fn default() -> Self { + Self { + display_name: Err("no value supplied for display_name".to_string()), + id: Err("no value supplied for id".to_string()), + } + } + } + + impl User { + pub fn display_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.display_name = value.try_into().map_err(|e| { + format!("error converting supplied value for display_name: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::User { + type Error = String; + fn try_from(value: User) -> Result { + Ok(Self { + display_name: value.display_name?, + id: value.id?, + }) + } + } + + pub struct UserBuiltin { + description: Result, + id: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for UserBuiltin { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl UserBuiltin { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::UserBuiltin { + type Error = String; + fn try_from(value: UserBuiltin) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct UserBuiltinResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for UserBuiltinResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl UserBuiltinResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UserBuiltinResultsPage { + type Error = String; + fn try_from(value: UserBuiltinResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct UserResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for UserResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl UserResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::UserResultsPage { + type Error = String; + fn try_from(value: UserResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct Vpc { + description: Result, + dns_name: Result, + id: Result, + ipv6_prefix: Result, + name: Result, + project_id: Result, + system_router_id: Result, + time_created: Result, String>, + time_modified: Result, String>, + } + + impl Default for Vpc { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + dns_name: Err("no value supplied for dns_name".to_string()), + id: Err("no value supplied for id".to_string()), + ipv6_prefix: Err("no value supplied for ipv6_prefix".to_string()), + name: Err("no value supplied for name".to_string()), + project_id: Err("no value supplied for project_id".to_string()), + system_router_id: Err("no value supplied for system_router_id".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + } + } + } + + impl Vpc { + 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 dns_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dns_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn ipv6_prefix(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv6_prefix = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_prefix: {}", 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 + } + pub fn project_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.project_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for project_id: {}", e)); + self + } + pub fn system_router_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.system_router_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for system_router_id: {}", + e + ) + }); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::Vpc { + type Error = String; + fn try_from(value: Vpc) -> Result { + Ok(Self { + description: value.description?, + dns_name: value.dns_name?, + id: value.id?, + ipv6_prefix: value.ipv6_prefix?, + name: value.name?, + project_id: value.project_id?, + system_router_id: value.system_router_id?, + time_created: value.time_created?, + time_modified: value.time_modified?, + }) + } + } + + pub struct VpcCreate { + description: Result, + dns_name: Result, + ipv6_prefix: Result, String>, + name: Result, + } + + impl Default for VpcCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + dns_name: Err("no value supplied for dns_name".to_string()), + ipv6_prefix: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl VpcCreate { + 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 dns_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dns_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); + self + } + pub fn ipv6_prefix(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.ipv6_prefix = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_prefix: {}", 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::VpcCreate { + type Error = String; + fn try_from(value: VpcCreate) -> Result { + Ok(Self { + description: value.description?, + dns_name: value.dns_name?, + ipv6_prefix: value.ipv6_prefix?, + name: value.name?, + }) + } + } + + pub struct VpcFirewallRule { + action: Result, + description: Result, + direction: Result, + filters: Result, + id: Result, + name: Result, + priority: Result, + status: Result, + targets: Result, String>, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for VpcFirewallRule { + fn default() -> Self { + Self { + action: Err("no value supplied for action".to_string()), + description: Err("no value supplied for description".to_string()), + direction: Err("no value supplied for direction".to_string()), + filters: Err("no value supplied for filters".to_string()), + id: Err("no value supplied for id".to_string()), + name: Err("no value supplied for name".to_string()), + priority: Err("no value supplied for priority".to_string()), + status: Err("no value supplied for status".to_string()), + targets: Err("no value supplied for targets".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl VpcFirewallRule { + pub fn action(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.action = value + .try_into() + .map_err(|e| format!("error converting supplied value for action: {}", e)); + self + } + 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 direction(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.direction = value + .try_into() + .map_err(|e| format!("error converting supplied value for direction: {}", e)); + self + } + pub fn filters(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.filters = value + .try_into() + .map_err(|e| format!("error converting supplied value for filters: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", 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 + } + pub fn priority(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn targets(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.targets = value + .try_into() + .map_err(|e| format!("error converting supplied value for targets: {}", e)); + self + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRule { + type Error = String; + fn try_from(value: VpcFirewallRule) -> Result { + Ok(Self { + action: value.action?, + description: value.description?, + direction: value.direction?, + filters: value.filters?, + id: value.id?, + name: value.name?, + priority: value.priority?, + status: value.status?, + targets: value.targets?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct VpcFirewallRuleFilter { + hosts: Result>, String>, + ports: Result>, String>, + protocols: Result>, String>, + } + + impl Default for VpcFirewallRuleFilter { + fn default() -> Self { + Self { + hosts: Ok(Default::default()), + ports: Ok(Default::default()), + protocols: Ok(Default::default()), + } + } + } + + impl VpcFirewallRuleFilter { + pub fn hosts(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.hosts = value + .try_into() + .map_err(|e| format!("error converting supplied value for hosts: {}", e)); + self + } + pub fn ports(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.ports = value + .try_into() + .map_err(|e| format!("error converting supplied value for ports: {}", e)); + self + } + pub fn protocols(mut self, value: T) -> Self + where + T: std::convert::TryInto>>, + T::Error: std::fmt::Display, + { + self.protocols = value + .try_into() + .map_err(|e| format!("error converting supplied value for protocols: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRuleFilter { + type Error = String; + fn try_from(value: VpcFirewallRuleFilter) -> Result { + Ok(Self { + hosts: value.hosts?, + ports: value.ports?, + protocols: value.protocols?, + }) + } + } + + pub struct VpcFirewallRuleUpdate { + action: Result, + description: Result, + direction: Result, + filters: Result, + name: Result, + priority: Result, + status: Result, + targets: Result, String>, + } + + impl Default for VpcFirewallRuleUpdate { + fn default() -> Self { + Self { + action: Err("no value supplied for action".to_string()), + description: Err("no value supplied for description".to_string()), + direction: Err("no value supplied for direction".to_string()), + filters: Err("no value supplied for filters".to_string()), + name: Err("no value supplied for name".to_string()), + priority: Err("no value supplied for priority".to_string()), + status: Err("no value supplied for status".to_string()), + targets: Err("no value supplied for targets".to_string()), + } + } + } + + impl VpcFirewallRuleUpdate { + pub fn action(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.action = value + .try_into() + .map_err(|e| format!("error converting supplied value for action: {}", e)); + self + } + 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 direction(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.direction = value + .try_into() + .map_err(|e| format!("error converting supplied value for direction: {}", e)); + self + } + pub fn filters(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.filters = value + .try_into() + .map_err(|e| format!("error converting supplied value for filters: {}", 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 + } + pub fn priority(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn targets(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.targets = value + .try_into() + .map_err(|e| format!("error converting supplied value for targets: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRuleUpdate { + type Error = String; + fn try_from(value: VpcFirewallRuleUpdate) -> Result { + Ok(Self { + action: value.action?, + description: value.description?, + direction: value.direction?, + filters: value.filters?, + name: value.name?, + priority: value.priority?, + status: value.status?, + targets: value.targets?, + }) + } + } + + pub struct VpcFirewallRuleUpdateParams { + rules: Result, String>, + } + + impl Default for VpcFirewallRuleUpdateParams { + fn default() -> Self { + Self { + rules: Err("no value supplied for rules".to_string()), + } + } + } + + impl VpcFirewallRuleUpdateParams { + pub fn rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.rules = value + .try_into() + .map_err(|e| format!("error converting supplied value for rules: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRuleUpdateParams { + type Error = String; + fn try_from(value: VpcFirewallRuleUpdateParams) -> Result { + Ok(Self { + rules: value.rules?, + }) + } + } + + pub struct VpcFirewallRules { + rules: Result, String>, + } + + impl Default for VpcFirewallRules { + fn default() -> Self { + Self { + rules: Err("no value supplied for rules".to_string()), + } + } + } + + impl VpcFirewallRules { + pub fn rules(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.rules = value + .try_into() + .map_err(|e| format!("error converting supplied value for rules: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcFirewallRules { + type Error = String; + fn try_from(value: VpcFirewallRules) -> Result { + Ok(Self { + rules: value.rules?, + }) + } + } + + pub struct VpcResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for VpcResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl VpcResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcResultsPage { + type Error = String; + fn try_from(value: VpcResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct VpcRouter { + description: Result, + id: Result, + kind: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for VpcRouter { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + kind: Err("no value supplied for kind".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl VpcRouter { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn kind(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.kind = value + .try_into() + .map_err(|e| format!("error converting supplied value for kind: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcRouter { + type Error = String; + fn try_from(value: VpcRouter) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + kind: value.kind?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct VpcRouterCreate { + description: Result, + name: Result, + } + + impl Default for VpcRouterCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl VpcRouterCreate { + 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::VpcRouterCreate { + type Error = String; + fn try_from(value: VpcRouterCreate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct VpcRouterResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for VpcRouterResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl VpcRouterResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcRouterResultsPage { + type Error = String; + fn try_from(value: VpcRouterResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct VpcRouterUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for VpcRouterUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl VpcRouterUpdate { + 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::VpcRouterUpdate { + type Error = String; + fn try_from(value: VpcRouterUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct VpcSubnet { + description: Result, + id: Result, + ipv4_block: Result, + ipv6_block: Result, + name: Result, + time_created: Result, String>, + time_modified: Result, String>, + vpc_id: Result, + } + + impl Default for VpcSubnet { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + id: Err("no value supplied for id".to_string()), + ipv4_block: Err("no value supplied for ipv4_block".to_string()), + ipv6_block: Err("no value supplied for ipv6_block".to_string()), + name: Err("no value supplied for name".to_string()), + time_created: Err("no value supplied for time_created".to_string()), + time_modified: Err("no value supplied for time_modified".to_string()), + vpc_id: Err("no value supplied for vpc_id".to_string()), + } + } + } + + impl VpcSubnet { + 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 id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn ipv4_block(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv4_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv4_block: {}", e)); + self + } + pub fn ipv6_block(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv6_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_block: {}", 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 + } + pub fn time_created(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_created = value.try_into().map_err(|e| { + format!("error converting supplied value for time_created: {}", e) + }); + self + } + pub fn time_modified(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.time_modified = value.try_into().map_err(|e| { + format!("error converting supplied value for time_modified: {}", e) + }); + self + } + pub fn vpc_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.vpc_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcSubnet { + type Error = String; + fn try_from(value: VpcSubnet) -> Result { + Ok(Self { + description: value.description?, + id: value.id?, + ipv4_block: value.ipv4_block?, + ipv6_block: value.ipv6_block?, + name: value.name?, + time_created: value.time_created?, + time_modified: value.time_modified?, + vpc_id: value.vpc_id?, + }) + } + } + + pub struct VpcSubnetCreate { + description: Result, + ipv4_block: Result, + ipv6_block: Result, String>, + name: Result, + } + + impl Default for VpcSubnetCreate { + fn default() -> Self { + Self { + description: Err("no value supplied for description".to_string()), + ipv4_block: Err("no value supplied for ipv4_block".to_string()), + ipv6_block: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + + impl VpcSubnetCreate { + 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 ipv4_block(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ipv4_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv4_block: {}", e)); + self + } + pub fn ipv6_block(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.ipv6_block = value + .try_into() + .map_err(|e| format!("error converting supplied value for ipv6_block: {}", 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::VpcSubnetCreate { + type Error = String; + fn try_from(value: VpcSubnetCreate) -> Result { + Ok(Self { + description: value.description?, + ipv4_block: value.ipv4_block?, + ipv6_block: value.ipv6_block?, + name: value.name?, + }) + } + } + + pub struct VpcSubnetResultsPage { + items: Result, String>, + next_page: Result, String>, + } + + impl Default for VpcSubnetResultsPage { + fn default() -> Self { + Self { + items: Err("no value supplied for items".to_string()), + next_page: Ok(Default::default()), + } + } + } + + impl VpcSubnetResultsPage { + pub fn items(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.items = value + .try_into() + .map_err(|e| format!("error converting supplied value for items: {}", e)); + self + } + pub fn next_page(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.next_page = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_page: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::VpcSubnetResultsPage { + type Error = String; + fn try_from(value: VpcSubnetResultsPage) -> Result { + Ok(Self { + items: value.items?, + next_page: value.next_page?, + }) + } + } + + pub struct VpcSubnetUpdate { + description: Result, String>, + name: Result, String>, + } + + impl Default for VpcSubnetUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl VpcSubnetUpdate { + 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::VpcSubnetUpdate { + type Error = String; + fn try_from(value: VpcSubnetUpdate) -> Result { + Ok(Self { + description: value.description?, + name: value.name?, + }) + } + } + + pub struct VpcUpdate { + description: Result, String>, + dns_name: Result, String>, + name: Result, String>, + } + + impl Default for VpcUpdate { + fn default() -> Self { + Self { + description: Ok(Default::default()), + dns_name: Ok(Default::default()), + name: Ok(Default::default()), + } + } + } + + impl VpcUpdate { + 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 dns_name(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.dns_name = value + .try_into() + .map_err(|e| format!("error converting supplied value for dns_name: {}", 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::VpcUpdate { + type Error = String; + fn try_from(value: VpcUpdate) -> Result { + Ok(Self { + description: value.description?, + dns_name: value.dns_name?, + name: value.name?, + }) + } + } + } + + mod defaults { + pub(super) fn instance_create_network_interfaces( + ) -> super::InstanceNetworkInterfaceAttachment { + super::InstanceNetworkInterfaceAttachment::Default + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/nexus-positional.out b/progenitor-impl/tests/output/nexus-positional.out index 164129c..2a51043 100644 --- a/progenitor-impl/tests/output/nexus-positional.out +++ b/progenitor-impl/tests/output/nexus-positional.out @@ -934,7 +934,7 @@ pub mod types { pub name: Name, pub ncpus: InstanceCpuCount, ///The network interfaces to be created for this instance. - #[serde(default = "instance_create_network_interfaces")] + #[serde(default = "defaults::instance_create_network_interfaces")] pub network_interfaces: InstanceNetworkInterfaceAttachment, ///User data for instance initialization systems (such as cloud-init). /// Must be a Base64-encoded string, as specified in RFC 4648 ยง 4 (+ and @@ -943,10 +943,6 @@ pub mod types { pub user_data: String, } - fn instance_create_network_interfaces() -> InstanceNetworkInterfaceAttachment { - InstanceNetworkInterfaceAttachment::Default - } - ///Describe the instance's disks at creation time #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] @@ -1121,7 +1117,7 @@ pub mod types { Err("") .or_else(|_: Self::Error| Ok(Self::V4(Ipv4Net::try_from(value)?))) .or_else(|_: Self::Error| Ok(Self::V6(Ipv6Net::try_from(value)?))) - .or_else(|_: Self::Error| Err("string conversion failed for all variants")) + .map_err(|_: Self::Error| "string conversion failed for all variants") } } @@ -2883,6 +2879,13 @@ pub mod types { #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } + + mod defaults { + pub(super) fn instance_create_network_interfaces( + ) -> super::InstanceNetworkInterfaceAttachment { + super::InstanceNetworkInterfaceAttachment::Default + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/output/test_default_params.out b/progenitor-impl/tests/output/test_default_params.out index 3717c2a..7493588 100644 --- a/progenitor-impl/tests/output/test_default_params.out +++ b/progenitor-impl/tests/output/test_default_params.out @@ -5,16 +5,6 @@ pub mod types { use serde::{Deserialize, Serialize}; #[allow(unused_imports)] use std::convert::TryFrom; - mod defaults { - pub(super) fn default_u64() -> T - where - T: std::convert::TryFrom, - >::Error: std::fmt::Debug, - { - T::try_from(V).unwrap() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] pub struct BodyWithDefaults { #[serde(rename = "forty-two", default = "defaults::default_u64::")] @@ -32,6 +22,16 @@ pub mod types { pub message: String, pub request_id: String, } + + mod defaults { + pub(super) fn default_u64() -> T + where + T: std::convert::TryFrom, + >::Error: std::fmt::Debug, + { + T::try_from(V).unwrap() + } + } } #[derive(Clone, Debug)] diff --git a/progenitor-impl/tests/test_output.rs b/progenitor-impl/tests/test_output.rs index 693bb75..c9c9076 100644 --- a/progenitor-impl/tests/test_output.rs +++ b/progenitor-impl/tests/test_output.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Oxide Computer Company +// Copyright 2022 Oxide Computer Company use std::{fs::File, path::PathBuf}; @@ -25,7 +25,7 @@ fn verify_apis(openapi_file: &str) { GenerationSettings::default() .with_interface(InterfaceStyle::Builder) .with_tag(TagStyle::Merged) - .with_derive(quote::quote! {JsonSchema}), + .with_derive("JsonSchema"), ); let output = generator.generate_text_normalize_comments(&spec).unwrap(); expectorate::assert_contents( diff --git a/progenitor/tests/build_nexus.rs b/progenitor/tests/build_nexus.rs index acca7f9..4dcce28 100644 --- a/progenitor/tests/build_nexus.rs +++ b/progenitor/tests/build_nexus.rs @@ -70,5 +70,12 @@ mod builder_tagged { .instance_name("instance") .stream(); let _ = stream.collect::>(); + + // client + // .instance_create() + // .organization_name("org") + // .project_name("project") + // .body(types::InstanceCreate::builder()) + // .send(); } }