#[allow(unused_imports)] use progenitor_client::{encode_path, RequestBuilderExt}; pub use progenitor_client::{ByteStream, Error, ResponseValue}; #[allow(unused_imports)] use reqwest::header::{HeaderMap, HeaderValue}; pub mod types { use serde::{Deserialize, Serialize}; #[allow(unused_imports)] use std::convert::TryFrom; ///Describes properties that should uniquely identify a Gimlet. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Baseboard { pub part: String, pub revision: i64, pub serial: String, } impl From<&Baseboard> for Baseboard { fn from(value: &Baseboard) -> Self { value.clone() } } impl Baseboard { pub fn builder() -> builder::Baseboard { builder::Baseboard::default() } } ///A type storing a range over `T`. /// ///This type supports ranges similar to the `RangeTo`, `Range` and /// `RangeFrom` types in the standard library. Those cover `(..end)`, /// `(start..end)`, and `(start..)` respectively. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum BinRangedouble { ///A range unbounded below and exclusively above, `..end`. #[serde(rename = "range_to")] RangeTo { end: f64 }, ///A range bounded inclusively below and exclusively above, /// `start..end`. #[serde(rename = "range")] Range { end: f64, start: f64 }, ///A range bounded inclusively below and unbounded above, `start..`. #[serde(rename = "range_from")] RangeFrom { start: f64 }, } impl From<&BinRangedouble> for BinRangedouble { fn from(value: &BinRangedouble) -> Self { value.clone() } } ///A type storing a range over `T`. /// ///This type supports ranges similar to the `RangeTo`, `Range` and /// `RangeFrom` types in the standard library. Those cover `(..end)`, /// `(start..end)`, and `(start..)` respectively. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum BinRangeint64 { ///A range unbounded below and exclusively above, `..end`. #[serde(rename = "range_to")] RangeTo { end: i64 }, ///A range bounded inclusively below and exclusively above, /// `start..end`. #[serde(rename = "range")] Range { end: i64, start: i64 }, ///A range bounded inclusively below and unbounded above, `start..`. #[serde(rename = "range_from")] RangeFrom { start: i64 }, } impl From<&BinRangeint64> for BinRangeint64 { fn from(value: &BinRangeint64) -> Self { value.clone() } } ///Type storing bin edges and a count of samples within it. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Bindouble { ///The total count of samples in this bin. pub count: u64, ///The range of the support covered by this bin. pub range: BinRangedouble, } impl From<&Bindouble> for Bindouble { fn from(value: &Bindouble) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct Binint64 { ///The total count of samples in this bin. pub count: u64, ///The range of the support covered by this bin. pub range: BinRangeint64, } impl From<&Binint64> for Binint64 { fn from(value: &Binint64) -> Self { value.clone() } } impl Binint64 { pub fn builder() -> builder::Binint64 { builder::Binint64::default() } } #[derive(Clone, Debug, JsonSchema, Serialize)] pub struct BlockSize(i64); impl std::ops::Deref for BlockSize { type Target = i64; fn deref(&self) -> &i64 { &self.0 } } impl From for i64 { fn from(value: BlockSize) -> Self { value.0 } } impl From<&BlockSize> for BlockSize { fn from(value: &BlockSize) -> Self { value.clone() } } impl std::convert::TryFrom for BlockSize { type Error = &'static str; fn try_from(value: i64) -> Result { if ![512_i64, 2048_i64, 4096_i64].contains(&value) { Err("invalid value") } else { Ok(Self(value)) } } } impl<'de> serde::Deserialize<'de> for BlockSize { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(i64::deserialize(deserializer)?) .map_err(|e| ::custom(e.to_string())) } } ///A count of bytes, typically used either for memory or storage capacity /// ///The maximum supported byte count is [`i64::MAX`]. This makes it /// somewhat inconvenient to define constructors: a u32 constructor can be /// infallible, but an i64 constructor can fail (if the value is negative) /// and a u64 constructor can fail (if the value is larger than i64::MAX). /// We provide all of these for consumers' convenience. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ByteCount(pub u64); impl std::ops::Deref for ByteCount { type Target = u64; fn deref(&self) -> &u64 { &self.0 } } impl From for u64 { fn from(value: ByteCount) -> Self { value.0 } } impl From<&ByteCount> for ByteCount { fn from(value: &ByteCount) -> Self { value.clone() } } impl From for ByteCount { fn from(value: u64) -> Self { Self(value) } } impl std::str::FromStr for ByteCount { type Err = ::Err; fn from_str(value: &str) -> Result { Ok(Self(value.parse()?)) } } impl std::convert::TryFrom<&str> for ByteCount { type Error = ::Err; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for ByteCount { type Error = ::Err; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for ByteCount { type Error = ::Err; fn try_from(value: String) -> Result { value.parse() } } impl ToString for ByteCount { fn to_string(&self) -> String { self.0.to_string() } } ///Client view of a [`Certificate`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Certificate { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, pub service: ServiceUsingCertificate, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Certificate> for Certificate { fn from(value: &Certificate) -> Self { value.clone() } } impl Certificate { pub fn builder() -> builder::Certificate { builder::Certificate::default() } } ///Create-time parameters for a /// [`Certificate`](crate::external_api::views::Certificate) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct CertificateCreate { ///PEM file containing public certificate chain pub cert: Vec, pub description: String, ///PEM file containing private key pub key: Vec, pub name: Name, ///The service using this certificate pub service: ServiceUsingCertificate, } impl From<&CertificateCreate> for CertificateCreate { fn from(value: &CertificateCreate) -> Self { value.clone() } } impl CertificateCreate { pub fn builder() -> builder::CertificateCreate { builder::CertificateCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct CertificateResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&CertificateResultsPage> for CertificateResultsPage { fn from(value: &CertificateResultsPage) -> Self { value.clone() } } impl CertificateResultsPage { pub fn builder() -> builder::CertificateResultsPage { builder::CertificateResultsPage::default() } } ///Identity-related metadata that's included in "asset" public API objects /// (which generally have no name or description) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ComponentUpdate { pub component_type: UpdateableComponentType, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, pub version: SemverVersion, } impl From<&ComponentUpdate> for ComponentUpdate { fn from(value: &ComponentUpdate) -> Self { value.clone() } } impl ComponentUpdate { pub fn builder() -> builder::ComponentUpdate { builder::ComponentUpdate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ComponentUpdateResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&ComponentUpdateResultsPage> for ComponentUpdateResultsPage { fn from(value: &ComponentUpdateResultsPage) -> Self { value.clone() } } impl ComponentUpdateResultsPage { pub fn builder() -> builder::ComponentUpdateResultsPage { builder::ComponentUpdateResultsPage::default() } } ///A cumulative or counter data type. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Cumulativedouble { pub start_time: chrono::DateTime, pub value: f64, } impl From<&Cumulativedouble> for Cumulativedouble { fn from(value: &Cumulativedouble) -> Self { value.clone() } } impl Cumulativedouble { pub fn builder() -> builder::Cumulativedouble { builder::Cumulativedouble::default() } } ///A cumulative or counter data type. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Cumulativeint64 { pub start_time: chrono::DateTime, pub value: i64, } impl From<&Cumulativeint64> for Cumulativeint64 { fn from(value: &Cumulativeint64) -> Self { value.clone() } } 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, JsonSchema, Serialize)] #[serde(tag = "type", content = "datum")] pub enum Datum { #[serde(rename = "bool")] Bool(bool), #[serde(rename = "i64")] I64(i64), #[serde(rename = "f64")] F64(f64), #[serde(rename = "string")] String(String), #[serde(rename = "bytes")] Bytes(Vec), #[serde(rename = "cumulative_i64")] CumulativeI64(Cumulativeint64), #[serde(rename = "cumulative_f64")] CumulativeF64(Cumulativedouble), #[serde(rename = "histogram_i64")] HistogramI64(Histogramint64), #[serde(rename = "histogram_f64")] HistogramF64(Histogramdouble), } impl From<&Datum> for Datum { fn from(value: &Datum) -> Self { value.clone() } } impl From for Datum { fn from(value: bool) -> Self { Self::Bool(value) } } impl From for Datum { fn from(value: i64) -> Self { Self::I64(value) } } impl From for Datum { fn from(value: f64) -> Self { Self::F64(value) } } impl From> for Datum { fn from(value: Vec) -> Self { Self::Bytes(value) } } impl From for Datum { fn from(value: Cumulativeint64) -> Self { Self::CumulativeI64(value) } } impl From for Datum { fn from(value: Cumulativedouble) -> Self { Self::CumulativeF64(value) } } impl From for Datum { fn from(value: Histogramint64) -> Self { Self::HistogramI64(value) } } impl From for Datum { fn from(value: Histogramdouble) -> Self { Self::HistogramF64(value) } } ///The type of an individual datum of a metric. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum DatumType { #[serde(rename = "bool")] Bool, #[serde(rename = "i64")] I64, #[serde(rename = "f64")] F64, #[serde(rename = "string")] String, #[serde(rename = "bytes")] Bytes, #[serde(rename = "cumulative_i64")] CumulativeI64, #[serde(rename = "cumulative_f64")] CumulativeF64, #[serde(rename = "histogram_i64")] HistogramI64, #[serde(rename = "histogram_f64")] HistogramF64, } impl From<&DatumType> for DatumType { fn from(value: &DatumType) -> Self { value.clone() } } impl ToString for DatumType { fn to_string(&self) -> String { match *self { Self::Bool => "bool".to_string(), Self::I64 => "i64".to_string(), Self::F64 => "f64".to_string(), Self::String => "string".to_string(), Self::Bytes => "bytes".to_string(), Self::CumulativeI64 => "cumulative_i64".to_string(), Self::CumulativeF64 => "cumulative_f64".to_string(), Self::HistogramI64 => "histogram_i64".to_string(), Self::HistogramF64 => "histogram_f64".to_string(), } } } impl std::str::FromStr for DatumType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "bool" => Ok(Self::Bool), "i64" => Ok(Self::I64), "f64" => Ok(Self::F64), "string" => Ok(Self::String), "bytes" => Ok(Self::Bytes), "cumulative_i64" => Ok(Self::CumulativeI64), "cumulative_f64" => Ok(Self::CumulativeF64), "histogram_i64" => Ok(Self::HistogramI64), "histogram_f64" => Ok(Self::HistogramF64), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for DatumType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for DatumType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for DatumType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DerEncodedKeyPair { ///request signing private key (base64 encoded der file) pub private_key: String, ///request signing public certificate (base64 encoded der file) pub public_cert: String, } impl From<&DerEncodedKeyPair> for DerEncodedKeyPair { fn from(value: &DerEncodedKeyPair) -> Self { value.clone() } } impl DerEncodedKeyPair { pub fn builder() -> builder::DerEncodedKeyPair { builder::DerEncodedKeyPair::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DeviceAccessTokenRequest { pub client_id: uuid::Uuid, pub device_code: String, pub grant_type: String, } impl From<&DeviceAccessTokenRequest> for DeviceAccessTokenRequest { fn from(value: &DeviceAccessTokenRequest) -> Self { value.clone() } } impl DeviceAccessTokenRequest { pub fn builder() -> builder::DeviceAccessTokenRequest { builder::DeviceAccessTokenRequest::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DeviceAuthRequest { pub client_id: uuid::Uuid, } impl From<&DeviceAuthRequest> for DeviceAuthRequest { fn from(value: &DeviceAuthRequest) -> Self { value.clone() } } impl DeviceAuthRequest { pub fn builder() -> builder::DeviceAuthRequest { builder::DeviceAuthRequest::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DeviceAuthVerify { pub user_code: String, } impl From<&DeviceAuthVerify> for DeviceAuthVerify { fn from(value: &DeviceAuthVerify) -> Self { value.clone() } } impl DeviceAuthVerify { pub fn builder() -> builder::DeviceAuthVerify { builder::DeviceAuthVerify::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type", content = "value")] pub enum Digest { #[serde(rename = "sha256")] Sha256(String), } impl From<&Digest> for Digest { fn from(value: &Digest) -> Self { value.clone() } } ///Client view of a [`Disk`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Disk { pub block_size: ByteCount, ///human-readable free-form text about a resource pub description: String, pub device_path: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, #[serde(default, skip_serializing_if = "Option::is_none")] pub image_id: Option, ///unique, mutable, user-controlled identifier for each resource pub name: Name, pub project_id: uuid::Uuid, pub size: ByteCount, #[serde(default, skip_serializing_if = "Option::is_none")] pub snapshot_id: Option, pub state: DiskState, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Disk> for Disk { fn from(value: &Disk) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct DiskCreate { pub description: String, ///initial source for this disk pub disk_source: DiskSource, pub name: Name, ///total size of the Disk in bytes pub size: ByteCount, } impl From<&DiskCreate> for DiskCreate { fn from(value: &DiskCreate) -> Self { value.clone() } } impl DiskCreate { pub fn builder() -> builder::DiskCreate { builder::DiskCreate::default() } } ///TODO-v1: Delete this Parameters for the /// [`Disk`](omicron_common::api::external::Disk) to be attached or detached /// to an instance #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DiskIdentifier { pub name: Name, } impl From<&DiskIdentifier> for DiskIdentifier { fn from(value: &DiskIdentifier) -> Self { value.clone() } } impl DiskIdentifier { pub fn builder() -> builder::DiskIdentifier { builder::DiskIdentifier::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum DiskMetricName { #[serde(rename = "activated")] Activated, #[serde(rename = "flush")] Flush, #[serde(rename = "read")] Read, #[serde(rename = "read_bytes")] ReadBytes, #[serde(rename = "write")] Write, #[serde(rename = "write_bytes")] WriteBytes, } impl From<&DiskMetricName> for DiskMetricName { fn from(value: &DiskMetricName) -> Self { value.clone() } } impl ToString for DiskMetricName { fn to_string(&self) -> String { match *self { Self::Activated => "activated".to_string(), Self::Flush => "flush".to_string(), Self::Read => "read".to_string(), Self::ReadBytes => "read_bytes".to_string(), Self::Write => "write".to_string(), Self::WriteBytes => "write_bytes".to_string(), } } } impl std::str::FromStr for DiskMetricName { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "activated" => Ok(Self::Activated), "flush" => Ok(Self::Flush), "read" => Ok(Self::Read), "read_bytes" => Ok(Self::ReadBytes), "write" => Ok(Self::Write), "write_bytes" => Ok(Self::WriteBytes), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for DiskMetricName { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for DiskMetricName { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for DiskMetricName { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DiskPath { pub disk: NameOrId, } impl From<&DiskPath> for DiskPath { fn from(value: &DiskPath) -> Self { value.clone() } } impl DiskPath { pub fn builder() -> builder::DiskPath { builder::DiskPath::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DiskResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&DiskResultsPage> for DiskResultsPage { fn from(value: &DiskResultsPage) -> Self { value.clone() } } impl DiskResultsPage { pub fn builder() -> builder::DiskResultsPage { builder::DiskResultsPage::default() } } ///Different sources for a disk #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum DiskSource { ///Create a blank disk #[serde(rename = "blank")] Blank { ///size of blocks for this Disk. valid values are: 512, 2048, or /// 4096 block_size: BlockSize, }, ///Create a disk from a disk snapshot #[serde(rename = "snapshot")] Snapshot { snapshot_id: uuid::Uuid }, ///Create a disk from a project image #[serde(rename = "image")] Image { image_id: uuid::Uuid }, ///Create a disk from a global image #[serde(rename = "global_image")] GlobalImage { image_id: uuid::Uuid }, } impl From<&DiskSource> for DiskSource { fn from(value: &DiskSource) -> Self { value.clone() } } ///State of a Disk (primarily: attached or not) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "state", content = "instance")] pub enum DiskState { #[serde(rename = "creating")] Creating, #[serde(rename = "detached")] Detached, ///Disk is being attached to the given Instance #[serde(rename = "attaching")] Attaching(uuid::Uuid), ///Disk is attached to the given Instance #[serde(rename = "attached")] Attached(uuid::Uuid), ///Disk is being detached from the given Instance #[serde(rename = "detaching")] Detaching(uuid::Uuid), #[serde(rename = "destroyed")] Destroyed, #[serde(rename = "faulted")] Faulted, } impl From<&DiskState> for DiskState { fn from(value: &DiskState) -> Self { value.clone() } } ///OS image distribution #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Distribution { ///The name of the distribution (e.g. "alpine" or "ubuntu") pub name: Name, ///The version of the distribution (e.g. "3.10" or "18.04") pub version: String, } impl From<&Distribution> for Distribution { fn from(value: &Distribution) -> Self { value.clone() } } impl Distribution { pub fn builder() -> builder::Distribution { builder::Distribution::default() } } ///Error information from a response. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Error { #[serde(default, skip_serializing_if = "Option::is_none")] pub error_code: Option, pub message: String, pub request_id: String, } impl From<&Error> for Error { fn from(value: &Error) -> Self { value.clone() } } impl Error { pub fn builder() -> builder::Error { builder::Error::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ExternalIp { pub ip: std::net::IpAddr, pub kind: IpKind, } impl From<&ExternalIp> for ExternalIp { fn from(value: &ExternalIp) -> Self { value.clone() } } impl ExternalIp { pub fn builder() -> builder::ExternalIp { builder::ExternalIp::default() } } ///Parameters for creating an external IP address for instances. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum ExternalIpCreate { ///An IP address providing both inbound and outbound access. The /// address is automatically-assigned from the provided IP Pool, or all /// available pools if not specified. #[serde(rename = "ephemeral")] Ephemeral { #[serde(default, skip_serializing_if = "Option::is_none")] pool_name: Option, }, } impl From<&ExternalIpCreate> for ExternalIpCreate { fn from(value: &ExternalIpCreate) -> Self { value.clone() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ExternalIpResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&ExternalIpResultsPage> for ExternalIpResultsPage { fn from(value: &ExternalIpResultsPage) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct FieldSchema { pub name: String, pub source: FieldSource, pub ty: FieldType, } impl From<&FieldSchema> for FieldSchema { fn from(value: &FieldSchema) -> Self { value.clone() } } 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, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum FieldSource { #[serde(rename = "target")] Target, #[serde(rename = "metric")] Metric, } impl From<&FieldSource> for FieldSource { fn from(value: &FieldSource) -> Self { value.clone() } } impl ToString for FieldSource { fn to_string(&self) -> String { match *self { Self::Target => "target".to_string(), Self::Metric => "metric".to_string(), } } } impl std::str::FromStr for FieldSource { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "target" => Ok(Self::Target), "metric" => Ok(Self::Metric), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for FieldSource { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for FieldSource { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for FieldSource { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///The `FieldType` identifies the data type of a target or metric field. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum FieldType { #[serde(rename = "string")] String, #[serde(rename = "i64")] I64, #[serde(rename = "ip_addr")] IpAddr, #[serde(rename = "uuid")] Uuid, #[serde(rename = "bool")] Bool, } impl From<&FieldType> for FieldType { fn from(value: &FieldType) -> Self { value.clone() } } impl ToString for FieldType { fn to_string(&self) -> String { match *self { Self::String => "string".to_string(), Self::I64 => "i64".to_string(), Self::IpAddr => "ip_addr".to_string(), Self::Uuid => "uuid".to_string(), Self::Bool => "bool".to_string(), } } } impl std::str::FromStr for FieldType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "string" => Ok(Self::String), "i64" => Ok(Self::I64), "ip_addr" => Ok(Self::IpAddr), "uuid" => Ok(Self::Uuid), "bool" => Ok(Self::Bool), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for FieldType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for FieldType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for FieldType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum FleetRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, #[serde(rename = "viewer")] Viewer, } impl From<&FleetRole> for FleetRole { fn from(value: &FleetRole) -> Self { value.clone() } } impl ToString for FleetRole { fn to_string(&self) -> String { match *self { Self::Admin => "admin".to_string(), Self::Collaborator => "collaborator".to_string(), Self::Viewer => "viewer".to_string(), } } } impl std::str::FromStr for FleetRole { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "admin" => Ok(Self::Admin), "collaborator" => Ok(Self::Collaborator), "viewer" => Ok(Self::Viewer), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for FleetRole { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for FleetRole { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for FleetRole { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// ///Note that the Policy only describes access granted explicitly for this /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct FleetRolePolicy { ///Roles directly assigned on this resource pub role_assignments: Vec, } impl From<&FleetRolePolicy> for FleetRolePolicy { fn from(value: &FleetRolePolicy) -> Self { value.clone() } } 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.) /// ///The resource is not part of this structure. Rather, [`RoleAssignment`]s /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct FleetRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, pub role_name: FleetRole, } impl From<&FleetRoleRoleAssignment> for FleetRoleRoleAssignment { fn from(value: &FleetRoleRoleAssignment) -> Self { value.clone() } } impl FleetRoleRoleAssignment { pub fn builder() -> builder::FleetRoleRoleAssignment { builder::FleetRoleRoleAssignment::default() } } ///Client view of global Images #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct GlobalImage { ///size of blocks in bytes pub block_size: ByteCount, ///human-readable free-form text about a resource pub description: String, ///Hash of the image contents, if applicable #[serde(default, skip_serializing_if = "Option::is_none")] pub digest: Option, ///Image distribution pub distribution: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///total size in bytes pub size: ByteCount, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///URL source of this image, if any #[serde(default, skip_serializing_if = "Option::is_none")] pub url: Option, ///Image version pub version: String, } impl From<&GlobalImage> for GlobalImage { fn from(value: &GlobalImage) -> Self { value.clone() } } impl GlobalImage { pub fn builder() -> builder::GlobalImage { builder::GlobalImage::default() } } ///Create-time parameters for an /// [`GlobalImage`](crate::external_api::views::GlobalImage) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct GlobalImageCreate { ///block size in bytes pub block_size: BlockSize, pub description: String, ///OS image distribution pub distribution: Distribution, pub name: Name, ///The source of the image's contents. pub source: ImageSource, } impl From<&GlobalImageCreate> for GlobalImageCreate { fn from(value: &GlobalImageCreate) -> Self { value.clone() } } impl GlobalImageCreate { pub fn builder() -> builder::GlobalImageCreate { builder::GlobalImageCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct GlobalImageResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&GlobalImageResultsPage> for GlobalImageResultsPage { fn from(value: &GlobalImageResultsPage) -> Self { value.clone() } } impl GlobalImageResultsPage { pub fn builder() -> builder::GlobalImageResultsPage { builder::GlobalImageResultsPage::default() } } ///Client view of a [`Group`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Group { ///Human-readable name that can identify the group pub display_name: String, pub id: uuid::Uuid, ///Uuid of the silo to which this group belongs pub silo_id: uuid::Uuid, } impl From<&Group> for Group { fn from(value: &Group) -> Self { value.clone() } } impl Group { pub fn builder() -> builder::Group { builder::Group::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct GroupResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&GroupResultsPage> for GroupResultsPage { fn from(value: &GroupResultsPage) -> Self { value.clone() } } impl GroupResultsPage { pub fn builder() -> builder::GroupResultsPage { builder::GroupResultsPage::default() } } ///A simple type for managing a histogram metric. /// ///A histogram maintains the count of any number of samples, over a set of /// bins. Bins are specified on construction via their _left_ edges, /// inclusive. There can't be any "gaps" in the bins, and an additional bin /// may be added to the left, right, or both so that the bins extend to the /// entire range of the support. /// ///Note that any gaps, unsorted bins, or non-finite values will result in /// an error. /// ///Example ------- ```rust use oximeter::histogram::{BinRange, Histogram}; /// ///let edges = [0i64, 10, 20]; let mut hist = /// Histogram::new(&edges).unwrap(); assert_eq!(hist.n_bins(), 4); // One /// additional bin for the range (20..) assert_eq!(hist.n_samples(), 0); /// hist.sample(4); hist.sample(100); assert_eq!(hist.n_samples(), 2); /// ///let data = hist.iter().collect::>(); assert_eq!(data[0].range, /// BinRange::range(i64::MIN, 0)); // An additional bin for `..0` /// assert_eq!(data[0].count, 0); // Nothing is in this bin /// ///assert_eq!(data[1].range, BinRange::range(0, 10)); // The range `0..10` /// assert_eq!(data[1].count, 1); // 4 is sampled into this bin ``` /// ///Notes ----- /// ///Histograms may be constructed either from their left bin edges, or from /// a sequence of ranges. In either case, the left-most bin may be converted /// upon construction. In particular, if the left-most value is not equal to /// the minimum of the support, a new bin will be added from the minimum to /// that provided value. If the left-most value _is_ the support's minimum, /// because the provided bin was unbounded below, such as `(..0)`, then that /// bin will be converted into one bounded below, `(MIN..0)` in this case. /// ///The short of this is that, most of the time, it shouldn't matter. If one /// specifies the extremes of the support as their bins, be aware that the /// left-most may be converted from a `BinRange::RangeTo` into a /// `BinRange::Range`. In other words, the first bin of a histogram is /// _always_ a `Bin::Range` or a `Bin::RangeFrom` after construction. In /// fact, every bin is one of those variants, the `BinRange::RangeTo` is /// only provided as a convenience during construction. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Histogramdouble { pub bins: Vec, pub n_samples: u64, pub start_time: chrono::DateTime, } impl From<&Histogramdouble> for Histogramdouble { fn from(value: &Histogramdouble) -> Self { value.clone() } } 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 /// bins. Bins are specified on construction via their _left_ edges, /// inclusive. There can't be any "gaps" in the bins, and an additional bin /// may be added to the left, right, or both so that the bins extend to the /// entire range of the support. /// ///Note that any gaps, unsorted bins, or non-finite values will result in /// an error. /// ///Example ------- ```rust use oximeter::histogram::{BinRange, Histogram}; /// ///let edges = [0i64, 10, 20]; let mut hist = /// Histogram::new(&edges).unwrap(); assert_eq!(hist.n_bins(), 4); // One /// additional bin for the range (20..) assert_eq!(hist.n_samples(), 0); /// hist.sample(4); hist.sample(100); assert_eq!(hist.n_samples(), 2); /// ///let data = hist.iter().collect::>(); assert_eq!(data[0].range, /// BinRange::range(i64::MIN, 0)); // An additional bin for `..0` /// assert_eq!(data[0].count, 0); // Nothing is in this bin /// ///assert_eq!(data[1].range, BinRange::range(0, 10)); // The range `0..10` /// assert_eq!(data[1].count, 1); // 4 is sampled into this bin ``` /// ///Notes ----- /// ///Histograms may be constructed either from their left bin edges, or from /// a sequence of ranges. In either case, the left-most bin may be converted /// upon construction. In particular, if the left-most value is not equal to /// the minimum of the support, a new bin will be added from the minimum to /// that provided value. If the left-most value _is_ the support's minimum, /// because the provided bin was unbounded below, such as `(..0)`, then that /// bin will be converted into one bounded below, `(MIN..0)` in this case. /// ///The short of this is that, most of the time, it shouldn't matter. If one /// specifies the extremes of the support as their bins, be aware that the /// left-most may be converted from a `BinRange::RangeTo` into a /// `BinRange::Range`. In other words, the first bin of a histogram is /// _always_ a `Bin::Range` or a `Bin::RangeFrom` after construction. In /// fact, every bin is one of those variants, the `BinRange::RangeTo` is /// only provided as a convenience during construction. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Histogramint64 { pub bins: Vec, pub n_samples: u64, pub start_time: chrono::DateTime, } impl From<&Histogramint64> for Histogramint64 { fn from(value: &Histogramint64) -> Self { value.clone() } } 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. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum IdSortMode { ///sort in increasing order of "id" #[serde(rename = "id_ascending")] IdAscending, } impl From<&IdSortMode> for IdSortMode { fn from(value: &IdSortMode) -> Self { value.clone() } } impl ToString for IdSortMode { fn to_string(&self) -> String { match *self { Self::IdAscending => "id_ascending".to_string(), } } } impl std::str::FromStr for IdSortMode { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "id_ascending" => Ok(Self::IdAscending), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for IdSortMode { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for IdSortMode { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for IdSortMode { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of an [`IdentityProvider`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IdentityProvider { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///Identity provider type pub provider_type: IdentityProviderType, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&IdentityProvider> for IdentityProvider { fn from(value: &IdentityProvider) -> Self { value.clone() } } impl IdentityProvider { pub fn builder() -> builder::IdentityProvider { builder::IdentityProvider::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IdentityProviderResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&IdentityProviderResultsPage> for IdentityProviderResultsPage { fn from(value: &IdentityProviderResultsPage) -> Self { value.clone() } } impl IdentityProviderResultsPage { pub fn builder() -> builder::IdentityProviderResultsPage { builder::IdentityProviderResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum IdentityProviderType { ///SAML identity provider #[serde(rename = "saml")] Saml, } impl From<&IdentityProviderType> for IdentityProviderType { fn from(value: &IdentityProviderType) -> Self { value.clone() } } impl ToString for IdentityProviderType { fn to_string(&self) -> String { match *self { Self::Saml => "saml".to_string(), } } } impl std::str::FromStr for IdentityProviderType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "saml" => Ok(Self::Saml), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for IdentityProviderType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for IdentityProviderType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for IdentityProviderType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Describes what kind of identity is described by an id #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum IdentityType { #[serde(rename = "silo_user")] SiloUser, #[serde(rename = "silo_group")] SiloGroup, } impl From<&IdentityType> for IdentityType { fn from(value: &IdentityType) -> Self { value.clone() } } impl ToString for IdentityType { fn to_string(&self) -> String { match *self { Self::SiloUser => "silo_user".to_string(), Self::SiloGroup => "silo_group".to_string(), } } } impl std::str::FromStr for IdentityType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "silo_user" => Ok(Self::SiloUser), "silo_group" => Ok(Self::SiloGroup), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for IdentityType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for IdentityType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for IdentityType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum IdpMetadataSource { #[serde(rename = "url")] Url { url: String }, #[serde(rename = "base64_encoded_xml")] Base64EncodedXml { data: String }, } impl From<&IdpMetadataSource> for IdpMetadataSource { fn from(value: &IdpMetadataSource) -> Self { value.clone() } } ///Client view of project Images #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Image { ///size of blocks in bytes pub block_size: ByteCount, ///human-readable free-form text about a resource pub description: String, ///Hash of the image contents, if applicable #[serde(default, skip_serializing_if = "Option::is_none")] pub digest: Option, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///The project the disk belongs to pub project_id: uuid::Uuid, ///total size in bytes pub size: ByteCount, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///URL source of this image, if any #[serde(default, skip_serializing_if = "Option::is_none")] pub url: Option, ///Version of this, if any #[serde(default, skip_serializing_if = "Option::is_none")] pub version: Option, } impl From<&Image> for Image { fn from(value: &Image) -> Self { value.clone() } } impl Image { pub fn builder() -> builder::Image { builder::Image::default() } } ///Create-time parameters for an /// [`Image`](crate::external_api::views::Image) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ImageCreate { ///block size in bytes pub block_size: BlockSize, pub description: String, pub name: Name, ///The source of the image's contents. pub source: ImageSource, } impl From<&ImageCreate> for ImageCreate { fn from(value: &ImageCreate) -> Self { value.clone() } } impl ImageCreate { pub fn builder() -> builder::ImageCreate { builder::ImageCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ImageResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&ImageResultsPage> for ImageResultsPage { fn from(value: &ImageResultsPage) -> Self { value.clone() } } impl ImageResultsPage { pub fn builder() -> builder::ImageResultsPage { builder::ImageResultsPage::default() } } ///The source of the underlying image. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum ImageSource { #[serde(rename = "url")] Url { url: String }, #[serde(rename = "snapshot")] Snapshot { id: uuid::Uuid }, #[serde(rename = "you_can_boot_anything_as_long_as_its_alpine")] YouCanBootAnythingAsLongAsItsAlpine, } impl From<&ImageSource> for ImageSource { fn from(value: &ImageSource) -> Self { value.clone() } } ///Client view of an [`Instance`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Instance { ///human-readable free-form text about a resource pub description: String, ///RFC1035-compliant hostname for the Instance. pub hostname: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///memory allocated for this Instance pub memory: ByteCount, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///number of CPUs allocated for this Instance pub ncpus: InstanceCpuCount, ///id for the project containing this Instance pub project_id: uuid::Uuid, pub run_state: InstanceState, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, pub time_run_state_updated: chrono::DateTime, } impl From<&Instance> for Instance { fn from(value: &Instance) -> Self { value.clone() } } impl Instance { pub fn builder() -> builder::Instance { builder::Instance::default() } } ///The number of CPUs in an Instance #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct InstanceCpuCount(pub u16); impl std::ops::Deref for InstanceCpuCount { type Target = u16; fn deref(&self) -> &u16 { &self.0 } } impl From for u16 { fn from(value: InstanceCpuCount) -> Self { value.0 } } impl From<&InstanceCpuCount> for InstanceCpuCount { fn from(value: &InstanceCpuCount) -> Self { value.clone() } } impl From for InstanceCpuCount { fn from(value: u16) -> Self { Self(value) } } impl std::str::FromStr for InstanceCpuCount { type Err = ::Err; fn from_str(value: &str) -> Result { Ok(Self(value.parse()?)) } } impl std::convert::TryFrom<&str> for InstanceCpuCount { type Error = ::Err; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for InstanceCpuCount { type Error = ::Err; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for InstanceCpuCount { type Error = ::Err; fn try_from(value: String) -> Result { value.parse() } } impl ToString for InstanceCpuCount { fn to_string(&self) -> String { self.0.to_string() } } ///Create-time parameters for an /// [`Instance`](omicron_common::api::external::Instance) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct InstanceCreate { pub description: String, ///The disks to be created or attached for this instance. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub disks: Vec, ///The external IP addresses provided to this instance. /// ///By default, all instances have outbound connectivity, but no inbound /// connectivity. These external addresses can be used to provide a /// fixed, known IP address for making inbound connections to the /// instance. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub external_ips: Vec, pub hostname: String, pub memory: ByteCount, pub name: Name, pub ncpus: InstanceCpuCount, ///The network interfaces to be created for this instance. #[serde(default = "defaults::instance_create_network_interfaces")] pub network_interfaces: InstanceNetworkInterfaceAttachment, ///Should this instance be started upon creation; true by default. #[serde(default = "defaults::default_bool::")] pub start: bool, ///User data for instance initialization systems (such as cloud-init). /// Must be a Base64-encoded string, as specified in RFC 4648 ยง 4 (+ and /// / characters with padding). Maximum 32 KiB unencoded data. #[serde(default)] pub user_data: String, } impl From<&InstanceCreate> for InstanceCreate { fn from(value: &InstanceCreate) -> Self { value.clone() } } impl InstanceCreate { pub fn builder() -> builder::InstanceCreate { builder::InstanceCreate::default() } } ///Describe the instance's disks at creation time #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum InstanceDiskAttachment { ///During instance creation, create and attach disks #[serde(rename = "create")] Create { description: String, ///initial source for this disk disk_source: DiskSource, name: Name, ///total size of the Disk in bytes size: ByteCount, }, ///During instance creation, attach this disk #[serde(rename = "attach")] Attach { ///A disk name to attach name: Name, }, } impl From<&InstanceDiskAttachment> for InstanceDiskAttachment { fn from(value: &InstanceDiskAttachment) -> Self { value.clone() } } ///Migration parameters for an /// [`Instance`](omicron_common::api::external::Instance) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct InstanceMigrate { pub dst_sled_id: uuid::Uuid, } impl From<&InstanceMigrate> for InstanceMigrate { fn from(value: &InstanceMigrate) -> Self { value.clone() } } 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, JsonSchema, Serialize)] #[serde(tag = "type", content = "params")] pub enum InstanceNetworkInterfaceAttachment { ///Create one or more `NetworkInterface`s for the `Instance`. /// ///If more than one interface is provided, then the first will be /// designated the primary interface for the instance. #[serde(rename = "create")] Create(Vec), #[serde(rename = "default")] Default, #[serde(rename = "none")] None, } impl From<&InstanceNetworkInterfaceAttachment> for InstanceNetworkInterfaceAttachment { fn from(value: &InstanceNetworkInterfaceAttachment) -> Self { value.clone() } } impl From> for InstanceNetworkInterfaceAttachment { fn from(value: Vec) -> Self { Self::Create(value) } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct InstanceResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&InstanceResultsPage> for InstanceResultsPage { fn from(value: &InstanceResultsPage) -> Self { value.clone() } } impl InstanceResultsPage { pub fn builder() -> builder::InstanceResultsPage { builder::InstanceResultsPage::default() } } ///Contents of an Instance's serial console buffer. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct InstanceSerialConsoleData { ///The bytes starting from the requested offset up to either the end of /// the buffer or the request's `max_bytes`. Provided as a u8 array /// rather than a string, as it may not be UTF-8. pub data: Vec, ///The absolute offset since boot (suitable for use as `byte_offset` in /// a subsequent request) of the last byte returned in `data`. pub last_byte_offset: u64, } impl From<&InstanceSerialConsoleData> for InstanceSerialConsoleData { fn from(value: &InstanceSerialConsoleData) -> Self { value.clone() } } 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 /// stopped, but also includes states related to the Instance's lifecycle #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum InstanceState { ///The instance is being created. #[serde(rename = "creating")] Creating, ///The instance is currently starting up. #[serde(rename = "starting")] Starting, ///The instance is currently running. #[serde(rename = "running")] Running, ///The instance has been requested to stop and a transition to /// "Stopped" is imminent. #[serde(rename = "stopping")] Stopping, ///The instance is currently stopped. #[serde(rename = "stopped")] Stopped, ///The instance is in the process of rebooting - it will remain in the /// "rebooting" state until the VM is starting once more. #[serde(rename = "rebooting")] Rebooting, ///The instance is in the process of migrating - it will remain in the /// "migrating" state until the migration process is complete and the /// destination propolis is ready to continue execution. #[serde(rename = "migrating")] Migrating, ///The instance is attempting to recover from a failure. #[serde(rename = "repairing")] Repairing, ///The instance has encountered a failure. #[serde(rename = "failed")] Failed, ///The instance has been deleted. #[serde(rename = "destroyed")] Destroyed, } impl From<&InstanceState> for InstanceState { fn from(value: &InstanceState) -> Self { value.clone() } } impl ToString for InstanceState { fn to_string(&self) -> String { match *self { Self::Creating => "creating".to_string(), Self::Starting => "starting".to_string(), Self::Running => "running".to_string(), Self::Stopping => "stopping".to_string(), Self::Stopped => "stopped".to_string(), Self::Rebooting => "rebooting".to_string(), Self::Migrating => "migrating".to_string(), Self::Repairing => "repairing".to_string(), Self::Failed => "failed".to_string(), Self::Destroyed => "destroyed".to_string(), } } } impl std::str::FromStr for InstanceState { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "creating" => Ok(Self::Creating), "starting" => Ok(Self::Starting), "running" => Ok(Self::Running), "stopping" => Ok(Self::Stopping), "stopped" => Ok(Self::Stopped), "rebooting" => Ok(Self::Rebooting), "migrating" => Ok(Self::Migrating), "repairing" => Ok(Self::Repairing), "failed" => Ok(Self::Failed), "destroyed" => Ok(Self::Destroyed), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for InstanceState { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for InstanceState { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for InstanceState { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///The kind of an external IP address for an instance #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum IpKind { #[serde(rename = "ephemeral")] Ephemeral, #[serde(rename = "floating")] Floating, } impl From<&IpKind> for IpKind { fn from(value: &IpKind) -> Self { value.clone() } } impl ToString for IpKind { fn to_string(&self) -> String { match *self { Self::Ephemeral => "ephemeral".to_string(), Self::Floating => "floating".to_string(), } } } impl std::str::FromStr for IpKind { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "ephemeral" => Ok(Self::Ephemeral), "floating" => Ok(Self::Floating), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for IpKind { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for IpKind { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for IpKind { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(untagged)] pub enum IpNet { V4(Ipv4Net), V6(Ipv6Net), } impl From<&IpNet> for IpNet { fn from(value: &IpNet) -> Self { value.clone() } } impl std::str::FromStr for IpNet { type Err = &'static str; fn from_str(value: &str) -> Result { if let Ok(v) = value.parse() { Ok(Self::V4(v)) } else if let Ok(v) = value.parse() { Ok(Self::V6(v)) } else { Err("string conversion failed for all variants") } } } impl std::convert::TryFrom<&str> for IpNet { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for IpNet { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for IpNet { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl ToString for IpNet { fn to_string(&self) -> String { match self { Self::V4(x) => x.to_string(), Self::V6(x) => x.to_string(), } } } impl From for IpNet { fn from(value: Ipv4Net) -> Self { Self::V4(value) } } impl From for IpNet { fn from(value: Ipv6Net) -> Self { Self::V6(value) } } ///Identity-related metadata that's included in nearly all public API /// objects #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPool { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&IpPool> for IpPool { fn from(value: &IpPool) -> Self { value.clone() } } impl IpPool { pub fn builder() -> builder::IpPool { builder::IpPool::default() } } ///Create-time parameters for an IP Pool. /// ///See [`IpPool`](crate::external_api::views::IpPool) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPoolCreate { pub description: String, pub name: Name, } impl From<&IpPoolCreate> for IpPoolCreate { fn from(value: &IpPoolCreate) -> Self { value.clone() } } impl IpPoolCreate { pub fn builder() -> builder::IpPoolCreate { builder::IpPoolCreate::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPoolRange { pub id: uuid::Uuid, pub range: IpRange, pub time_created: chrono::DateTime, } impl From<&IpPoolRange> for IpPoolRange { fn from(value: &IpPoolRange) -> Self { value.clone() } } impl IpPoolRange { pub fn builder() -> builder::IpPoolRange { builder::IpPoolRange::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPoolRangeResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&IpPoolRangeResultsPage> for IpPoolRangeResultsPage { fn from(value: &IpPoolRangeResultsPage) -> Self { value.clone() } } impl IpPoolRangeResultsPage { pub fn builder() -> builder::IpPoolRangeResultsPage { builder::IpPoolRangeResultsPage::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPoolResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&IpPoolResultsPage> for IpPoolResultsPage { fn from(value: &IpPoolResultsPage) -> Self { value.clone() } } impl IpPoolResultsPage { pub fn builder() -> builder::IpPoolResultsPage { builder::IpPoolResultsPage::default() } } ///Parameters for updating an IP Pool #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPoolUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl From<&IpPoolUpdate> for IpPoolUpdate { fn from(value: &IpPoolUpdate) -> Self { value.clone() } } impl IpPoolUpdate { pub fn builder() -> builder::IpPoolUpdate { builder::IpPoolUpdate::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(untagged)] pub enum IpRange { V4(Ipv4Range), V6(Ipv6Range), } impl From<&IpRange> for IpRange { fn from(value: &IpRange) -> Self { value.clone() } } impl From for IpRange { fn from(value: Ipv4Range) -> Self { Self::V4(value) } } impl From for IpRange { fn from(value: Ipv6Range) -> Self { Self::V6(value) } } ///An IPv4 subnet, including prefix and subnet mask #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct Ipv4Net(String); impl std::ops::Deref for Ipv4Net { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: Ipv4Net) -> Self { value.0 } } impl From<&Ipv4Net> for Ipv4Net { fn from(value: &Ipv4Net) -> Self { value.clone() } } impl std::str::FromStr for Ipv4Net { type Err = &'static str; fn from_str(value: &str) -> Result { if regress::Regex::new( "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.\ ){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/\ ([8-9]|1[0-9]|2[0-9]|3[0-2])$", ) .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \ \"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.\ ){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/\ ([8-9]|1[0-9]|2[0-9]|3[0-2])$\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for Ipv4Net { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for Ipv4Net { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for Ipv4Net { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for Ipv4Net { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///A non-decreasing IPv4 address range, inclusive of both ends. /// ///The first address must be less than or equal to the last address. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Ipv4Range { pub first: std::net::Ipv4Addr, pub last: std::net::Ipv4Addr, } impl From<&Ipv4Range> for Ipv4Range { fn from(value: &Ipv4Range) -> Self { value.clone() } } impl Ipv4Range { pub fn builder() -> builder::Ipv4Range { builder::Ipv4Range::default() } } ///An IPv6 subnet, including prefix and subnet mask #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct Ipv6Net(String); impl std::ops::Deref for Ipv6Net { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: Ipv6Net) -> Self { value.0 } } impl From<&Ipv6Net> for Ipv6Net { fn from(value: &Ipv6Net) -> Self { value.clone() } } impl std::str::FromStr for Ipv6Net { type Err = &'static str; fn from_str(value: &str) -> Result { if regress::Regex::new( "^([fF][dD])[0-9a-fA-F]{2}:(([0-9a-fA-F]{1,4}:){6}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,\ 4}:){1,6}:)\\/([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$", ) .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \ \"^([fF][dD])[0-9a-fA-F]{2}:(([0-9a-fA-F]{1,4}:){6}[0-9a-fA-F]{1,\ 4}|([0-9a-fA-F]{1,4}:){1,6}:)\\/\ ([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for Ipv6Net { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for Ipv6Net { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for Ipv6Net { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for Ipv6Net { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///A non-decreasing IPv6 address range, inclusive of both ends. /// ///The first address must be less than or equal to the last address. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Ipv6Range { pub first: std::net::Ipv6Addr, pub last: std::net::Ipv6Addr, } impl From<&Ipv6Range> for Ipv6Range { fn from(value: &Ipv6Range) -> Self { value.clone() } } 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, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct L4PortRange(String); impl std::ops::Deref for L4PortRange { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: L4PortRange) -> Self { value.0 } } impl From<&L4PortRange> for L4PortRange { fn from(value: &L4PortRange) -> Self { value.clone() } } impl std::str::FromStr for L4PortRange { type Err = &'static str; fn from_str(value: &str) -> Result { if value.len() > 11usize { return Err("longer than 11 characters"); } if value.len() < 1usize { return Err("shorter than 1 characters"); } if regress::Regex::new("^[0-9]{1,5}(-[0-9]{1,5})?$") .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \"^[0-9]{1,5}(-[0-9]{1,5})?$\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for L4PortRange { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for L4PortRange { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for L4PortRange { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for L4PortRange { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///A Media Access Control address, in EUI-48 format #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct MacAddr(String); impl std::ops::Deref for MacAddr { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: MacAddr) -> Self { value.0 } } impl From<&MacAddr> for MacAddr { fn from(value: &MacAddr) -> Self { value.clone() } } impl std::str::FromStr for MacAddr { type Err = &'static str; fn from_str(value: &str) -> Result { if value.len() > 17usize { return Err("longer than 17 characters"); } if value.len() < 17usize { return Err("shorter than 17 characters"); } if regress::Regex::new("^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$") .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for MacAddr { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for MacAddr { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for MacAddr { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for MacAddr { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///A `Measurement` is a timestamped datum from a single metric #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Measurement { pub datum: Datum, pub timestamp: chrono::DateTime, } impl From<&Measurement> for Measurement { fn from(value: &Measurement) -> Self { value.clone() } } impl Measurement { pub fn builder() -> builder::Measurement { builder::Measurement::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct MeasurementResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&MeasurementResultsPage> for MeasurementResultsPage { fn from(value: &MeasurementResultsPage) -> Self { value.clone() } } 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. #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct Name(String); impl std::ops::Deref for Name { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: Name) -> Self { value.0 } } impl From<&Name> for Name { fn from(value: &Name) -> Self { value.clone() } } impl std::str::FromStr for Name { type Err = &'static str; fn from_str(value: &str) -> Result { if value.len() > 63usize { return Err("longer than 63 characters"); } if regress :: Regex :: new ("^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$") . unwrap () . find (value) . is_none () { return Err ("doesn't match pattern \"^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$\"") ; } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for Name { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for Name { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for Name { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for Name { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(untagged)] pub enum NameOrId { Id(uuid::Uuid), Name(Name), } impl From<&NameOrId> for NameOrId { fn from(value: &NameOrId) -> Self { value.clone() } } impl std::str::FromStr for NameOrId { type Err = &'static str; fn from_str(value: &str) -> Result { if let Ok(v) = value.parse() { Ok(Self::Id(v)) } else if let Ok(v) = value.parse() { Ok(Self::Name(v)) } else { Err("string conversion failed for all variants") } } } impl std::convert::TryFrom<&str> for NameOrId { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for NameOrId { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for NameOrId { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl ToString for NameOrId { fn to_string(&self) -> String { match self { Self::Id(x) => x.to_string(), Self::Name(x) => x.to_string(), } } } impl From for NameOrId { fn from(value: uuid::Uuid) -> Self { Self::Id(value) } } impl From for NameOrId { fn from(value: Name) -> Self { Self::Name(value) } } ///Supported set of sort modes for scanning by name or id #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum NameOrIdSortMode { ///sort in increasing order of "name" #[serde(rename = "name_ascending")] NameAscending, ///sort in decreasing order of "name" #[serde(rename = "name_descending")] NameDescending, ///sort in increasing order of "id" #[serde(rename = "id_ascending")] IdAscending, } impl From<&NameOrIdSortMode> for NameOrIdSortMode { fn from(value: &NameOrIdSortMode) -> Self { value.clone() } } impl ToString for NameOrIdSortMode { fn to_string(&self) -> String { match *self { Self::NameAscending => "name_ascending".to_string(), Self::NameDescending => "name_descending".to_string(), Self::IdAscending => "id_ascending".to_string(), } } } impl std::str::FromStr for NameOrIdSortMode { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "name_ascending" => Ok(Self::NameAscending), "name_descending" => Ok(Self::NameDescending), "id_ascending" => Ok(Self::IdAscending), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for NameOrIdSortMode { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for NameOrIdSortMode { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for NameOrIdSortMode { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Supported set of sort modes for scanning by name only /// ///Currently, we only support scanning in ascending order. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum NameSortMode { ///sort in increasing order of "name" #[serde(rename = "name_ascending")] NameAscending, } impl From<&NameSortMode> for NameSortMode { fn from(value: &NameSortMode) -> Self { value.clone() } } impl ToString for NameSortMode { fn to_string(&self) -> String { match *self { Self::NameAscending => "name_ascending".to_string(), } } } impl std::str::FromStr for NameSortMode { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "name_ascending" => Ok(Self::NameAscending), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for NameSortMode { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for NameSortMode { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for NameSortMode { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///A `NetworkInterface` represents a virtual network interface device. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct NetworkInterface { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///The Instance to which the interface belongs. pub instance_id: uuid::Uuid, ///The IP address assigned to this interface. pub ip: std::net::IpAddr, ///The MAC address assigned to this interface. pub mac: MacAddr, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///True if this interface is the primary for the instance to which it's /// attached. pub primary: bool, ///The subnet to which the interface belongs. pub subnet_id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///The VPC to which the interface belongs. pub vpc_id: uuid::Uuid, } impl From<&NetworkInterface> for NetworkInterface { fn from(value: &NetworkInterface) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct NetworkInterfaceCreate { pub description: String, ///The IP address for the interface. One will be auto-assigned if not /// provided. #[serde(default, skip_serializing_if = "Option::is_none")] pub ip: Option, pub name: Name, ///The VPC Subnet in which to create the interface. pub subnet_name: Name, ///The VPC in which to create the interface. pub vpc_name: Name, } impl From<&NetworkInterfaceCreate> for NetworkInterfaceCreate { fn from(value: &NetworkInterfaceCreate) -> Self { value.clone() } } impl NetworkInterfaceCreate { pub fn builder() -> builder::NetworkInterfaceCreate { builder::NetworkInterfaceCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct NetworkInterfaceResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&NetworkInterfaceResultsPage> for NetworkInterfaceResultsPage { fn from(value: &NetworkInterfaceResultsPage) -> Self { value.clone() } } impl NetworkInterfaceResultsPage { pub fn builder() -> builder::NetworkInterfaceResultsPage { builder::NetworkInterfaceResultsPage::default() } } ///Parameters for updating a /// [`NetworkInterface`](omicron_common::api::external::NetworkInterface). /// ///Note that modifying IP addresses for an interface is not yet supported, /// a new interface must be created instead. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct NetworkInterfaceUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, ///Make a secondary interface the instance's primary interface. /// ///If applied to a secondary interface, that interface will become the /// primary on the next reboot of the instance. Note that this may have /// implications for routing between instances, as the new primary /// interface will be on a distinct subnet from the previous primary /// interface. /// ///Note that this can only be used to select a new primary interface /// for an instance. Requests to change the primary interface into a /// secondary will return an error. #[serde(default)] pub primary: bool, } impl From<&NetworkInterfaceUpdate> for NetworkInterfaceUpdate { fn from(value: &NetworkInterfaceUpdate) -> Self { value.clone() } } impl NetworkInterfaceUpdate { pub fn builder() -> builder::NetworkInterfaceUpdate { builder::NetworkInterfaceUpdate::default() } } ///Unique name for a saga [`Node`] /// ///Each node requires a string name that's unique within its DAG. The name /// is used to identify its output. Nodes that depend on a given node /// (either directly or indirectly) can access the node's output using its /// name. #[derive( Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub struct NodeName(pub String); impl std::ops::Deref for NodeName { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: NodeName) -> Self { value.0 } } impl From<&NodeName> for NodeName { fn from(value: &NodeName) -> Self { value.clone() } } impl From for NodeName { fn from(value: String) -> Self { Self(value) } } impl std::str::FromStr for NodeName { type Err = std::convert::Infallible; fn from_str(value: &str) -> Result { Ok(Self(value.to_string())) } } impl ToString for NodeName { fn to_string(&self) -> String { self.0.to_string() } } ///Client view of an [`Organization`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Organization { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Organization> for Organization { fn from(value: &Organization) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct OrganizationCreate { pub description: String, pub name: Name, } impl From<&OrganizationCreate> for OrganizationCreate { fn from(value: &OrganizationCreate) -> Self { value.clone() } } impl OrganizationCreate { pub fn builder() -> builder::OrganizationCreate { builder::OrganizationCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct OrganizationResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&OrganizationResultsPage> for OrganizationResultsPage { fn from(value: &OrganizationResultsPage) -> Self { value.clone() } } impl OrganizationResultsPage { pub fn builder() -> builder::OrganizationResultsPage { builder::OrganizationResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum OrganizationRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, #[serde(rename = "viewer")] Viewer, } impl From<&OrganizationRole> for OrganizationRole { fn from(value: &OrganizationRole) -> Self { value.clone() } } impl ToString for OrganizationRole { fn to_string(&self) -> String { match *self { Self::Admin => "admin".to_string(), Self::Collaborator => "collaborator".to_string(), Self::Viewer => "viewer".to_string(), } } } impl std::str::FromStr for OrganizationRole { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "admin" => Ok(Self::Admin), "collaborator" => Ok(Self::Collaborator), "viewer" => Ok(Self::Viewer), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for OrganizationRole { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for OrganizationRole { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for OrganizationRole { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// ///Note that the Policy only describes access granted explicitly for this /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct OrganizationRolePolicy { ///Roles directly assigned on this resource pub role_assignments: Vec, } impl From<&OrganizationRolePolicy> for OrganizationRolePolicy { fn from(value: &OrganizationRolePolicy) -> Self { value.clone() } } 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.) /// ///The resource is not part of this structure. Rather, [`RoleAssignment`]s /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct OrganizationRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, pub role_name: OrganizationRole, } impl From<&OrganizationRoleRoleAssignment> for OrganizationRoleRoleAssignment { fn from(value: &OrganizationRoleRoleAssignment) -> Self { value.clone() } } impl OrganizationRoleRoleAssignment { pub fn builder() -> builder::OrganizationRoleRoleAssignment { builder::OrganizationRoleRoleAssignment::default() } } ///Updateable properties of an /// [`Organization`](crate::external_api::views::Organization) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct OrganizationUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl From<&OrganizationUpdate> for OrganizationUpdate { fn from(value: &OrganizationUpdate) -> Self { value.clone() } } impl OrganizationUpdate { pub fn builder() -> builder::OrganizationUpdate { builder::OrganizationUpdate::default() } } ///Passwords may be subject to additional constraints. #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct Password(String); impl std::ops::Deref for Password { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: Password) -> Self { value.0 } } impl From<&Password> for Password { fn from(value: &Password) -> Self { value.clone() } } impl std::str::FromStr for Password { type Err = &'static str; fn from_str(value: &str) -> Result { if value.len() > 512usize { return Err("longer than 512 characters"); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for Password { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for Password { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for Password { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for Password { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///Client view of a [`PhysicalDisk`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct PhysicalDisk { pub disk_type: PhysicalDiskType, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, pub model: String, pub serial: String, ///The sled to which this disk is attached, if any. #[serde(default, skip_serializing_if = "Option::is_none")] pub sled_id: Option, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, pub vendor: String, } impl From<&PhysicalDisk> for PhysicalDisk { fn from(value: &PhysicalDisk) -> Self { value.clone() } } impl PhysicalDisk { pub fn builder() -> builder::PhysicalDisk { builder::PhysicalDisk::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct PhysicalDiskResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&PhysicalDiskResultsPage> for PhysicalDiskResultsPage { fn from(value: &PhysicalDiskResultsPage) -> Self { value.clone() } } impl PhysicalDiskResultsPage { pub fn builder() -> builder::PhysicalDiskResultsPage { builder::PhysicalDiskResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum PhysicalDiskType { #[serde(rename = "internal")] Internal, #[serde(rename = "external")] External, } impl From<&PhysicalDiskType> for PhysicalDiskType { fn from(value: &PhysicalDiskType) -> Self { value.clone() } } impl ToString for PhysicalDiskType { fn to_string(&self) -> String { match *self { Self::Internal => "internal".to_string(), Self::External => "external".to_string(), } } } impl std::str::FromStr for PhysicalDiskType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "internal" => Ok(Self::Internal), "external" => Ok(Self::External), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for PhysicalDiskType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for PhysicalDiskType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for PhysicalDiskType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a [`Project`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Project { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, pub organization_id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Project> for Project { fn from(value: &Project) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct ProjectCreate { pub description: String, pub name: Name, } impl From<&ProjectCreate> for ProjectCreate { fn from(value: &ProjectCreate) -> Self { value.clone() } } impl ProjectCreate { pub fn builder() -> builder::ProjectCreate { builder::ProjectCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ProjectResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&ProjectResultsPage> for ProjectResultsPage { fn from(value: &ProjectResultsPage) -> Self { value.clone() } } impl ProjectResultsPage { pub fn builder() -> builder::ProjectResultsPage { builder::ProjectResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum ProjectRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, #[serde(rename = "viewer")] Viewer, } impl From<&ProjectRole> for ProjectRole { fn from(value: &ProjectRole) -> Self { value.clone() } } impl ToString for ProjectRole { fn to_string(&self) -> String { match *self { Self::Admin => "admin".to_string(), Self::Collaborator => "collaborator".to_string(), Self::Viewer => "viewer".to_string(), } } } impl std::str::FromStr for ProjectRole { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "admin" => Ok(Self::Admin), "collaborator" => Ok(Self::Collaborator), "viewer" => Ok(Self::Viewer), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for ProjectRole { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for ProjectRole { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for ProjectRole { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// ///Note that the Policy only describes access granted explicitly for this /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ProjectRolePolicy { ///Roles directly assigned on this resource pub role_assignments: Vec, } impl From<&ProjectRolePolicy> for ProjectRolePolicy { fn from(value: &ProjectRolePolicy) -> Self { value.clone() } } 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.) /// ///The resource is not part of this structure. Rather, [`RoleAssignment`]s /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ProjectRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, pub role_name: ProjectRole, } impl From<&ProjectRoleRoleAssignment> for ProjectRoleRoleAssignment { fn from(value: &ProjectRoleRoleAssignment) -> Self { value.clone() } } impl ProjectRoleRoleAssignment { pub fn builder() -> builder::ProjectRoleRoleAssignment { builder::ProjectRoleRoleAssignment::default() } } ///Updateable properties of a /// [`Project`](crate::external_api::views::Project) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct ProjectUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl From<&ProjectUpdate> for ProjectUpdate { fn from(value: &ProjectUpdate) -> Self { value.clone() } } impl ProjectUpdate { pub fn builder() -> builder::ProjectUpdate { builder::ProjectUpdate::default() } } ///Client view of an [`Rack`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Rack { ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Rack> for Rack { fn from(value: &Rack) -> Self { value.clone() } } impl Rack { pub fn builder() -> builder::Rack { builder::Rack::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RackResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&RackResultsPage> for RackResultsPage { fn from(value: &RackResultsPage) -> Self { value.clone() } } impl RackResultsPage { pub fn builder() -> builder::RackResultsPage { builder::RackResultsPage::default() } } ///Client view of a [`Role`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Role { pub description: String, pub name: RoleName, } impl From<&Role> for Role { fn from(value: &Role) -> Self { value.clone() } } impl Role { pub fn builder() -> builder::Role { builder::Role::default() } } ///Role names consist of two string components separated by dot ("."). #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct RoleName(String); impl std::ops::Deref for RoleName { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: RoleName) -> Self { value.0 } } impl From<&RoleName> for RoleName { fn from(value: &RoleName) -> Self { value.clone() } } impl std::str::FromStr for RoleName { type Err = &'static str; fn from_str(value: &str) -> Result { if value.len() > 63usize { return Err("longer than 63 characters"); } if regress::Regex::new("[a-z-]+\\.[a-z-]+") .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \"[a-z-]+\\.[a-z-]+\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for RoleName { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for RoleName { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for RoleName { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for RoleName { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RoleResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&RoleResultsPage> for RoleResultsPage { fn from(value: &RoleResultsPage) -> Self { value.clone() } } 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. /// ///When traffic is to be sent to a destination that is within a given /// `RouteDestination`, the corresponding [`RouterRoute`] applies, and /// traffic will be forward to the [`RouteTarget`] for that rule. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type", content = "value")] pub enum RouteDestination { ///Route applies to traffic destined for a specific IP address #[serde(rename = "ip")] Ip(std::net::IpAddr), ///Route applies to traffic destined for a specific IP subnet #[serde(rename = "ip_net")] IpNet(IpNet), ///Route applies to traffic destined for the given VPC. #[serde(rename = "vpc")] Vpc(Name), ///Route applies to traffic #[serde(rename = "subnet")] Subnet(Name), } impl From<&RouteDestination> for RouteDestination { fn from(value: &RouteDestination) -> Self { value.clone() } } impl From for RouteDestination { fn from(value: std::net::IpAddr) -> Self { Self::Ip(value) } } impl From for RouteDestination { fn from(value: IpNet) -> Self { Self::IpNet(value) } } ///A `RouteTarget` describes the possible locations that traffic matching a /// route destination can be sent. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type", content = "value")] pub enum RouteTarget { ///Forward traffic to a particular IP address. #[serde(rename = "ip")] Ip(std::net::IpAddr), ///Forward traffic to a VPC #[serde(rename = "vpc")] Vpc(Name), ///Forward traffic to a VPC Subnet #[serde(rename = "subnet")] Subnet(Name), ///Forward traffic to a specific instance #[serde(rename = "instance")] Instance(Name), ///Forward traffic to an internet gateway #[serde(rename = "internet_gateway")] InternetGateway(Name), } impl From<&RouteTarget> for RouteTarget { fn from(value: &RouteTarget) -> Self { value.clone() } } impl From for RouteTarget { fn from(value: std::net::IpAddr) -> Self { Self::Ip(value) } } ///A route defines a rule that governs where traffic should be sent based /// on its destination. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RouterRoute { ///human-readable free-form text about a resource pub description: String, pub destination: RouteDestination, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///Describes the kind of router. Set at creation. `read-only` pub kind: RouterRouteKind, ///unique, mutable, user-controlled identifier for each resource pub name: Name, pub target: RouteTarget, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///The VPC Router to which the route belongs. pub vpc_router_id: uuid::Uuid, } impl From<&RouterRoute> for RouterRoute { fn from(value: &RouterRoute) -> Self { value.clone() } } impl RouterRoute { pub fn builder() -> builder::RouterRoute { builder::RouterRoute::default() } } ///Create-time parameters for a [`RouterRoute`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RouterRouteCreateParams { pub description: String, pub destination: RouteDestination, pub name: Name, pub target: RouteTarget, } impl From<&RouterRouteCreateParams> for RouterRouteCreateParams { fn from(value: &RouterRouteCreateParams) -> Self { value.clone() } } 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. /// ///See [RFD-21](https://rfd.shared.oxide.computer/rfd/0021#concept-router) for more context #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum RouterRouteKind { ///Determines the default destination of traffic, such as whether it /// goes to the internet or not. /// ///`Destination: An Internet Gateway` `Modifiable: true` #[serde(rename = "default")] Default, ///Automatically added for each VPC Subnet in the VPC /// ///`Destination: A VPC Subnet` `Modifiable: false` #[serde(rename = "vpc_subnet")] VpcSubnet, ///Automatically added when VPC peering is established /// ///`Destination: A different VPC` `Modifiable: false` #[serde(rename = "vpc_peering")] VpcPeering, ///Created by a user See [`RouteTarget`] /// ///`Destination: User defined` `Modifiable: true` #[serde(rename = "custom")] Custom, } impl From<&RouterRouteKind> for RouterRouteKind { fn from(value: &RouterRouteKind) -> Self { value.clone() } } impl ToString for RouterRouteKind { fn to_string(&self) -> String { match *self { Self::Default => "default".to_string(), Self::VpcSubnet => "vpc_subnet".to_string(), Self::VpcPeering => "vpc_peering".to_string(), Self::Custom => "custom".to_string(), } } } impl std::str::FromStr for RouterRouteKind { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "default" => Ok(Self::Default), "vpc_subnet" => Ok(Self::VpcSubnet), "vpc_peering" => Ok(Self::VpcPeering), "custom" => Ok(Self::Custom), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for RouterRouteKind { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for RouterRouteKind { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for RouterRouteKind { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RouterRouteResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&RouterRouteResultsPage> for RouterRouteResultsPage { fn from(value: &RouterRouteResultsPage) -> Self { value.clone() } } impl RouterRouteResultsPage { pub fn builder() -> builder::RouterRouteResultsPage { builder::RouterRouteResultsPage::default() } } ///Updateable properties of a [`RouterRoute`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RouterRouteUpdateParams { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, pub destination: RouteDestination, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, pub target: RouteTarget, } impl From<&RouterRouteUpdateParams> for RouterRouteUpdateParams { fn from(value: &RouterRouteUpdateParams) -> Self { value.clone() } } impl RouterRouteUpdateParams { pub fn builder() -> builder::RouterRouteUpdateParams { builder::RouterRouteUpdateParams::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Saga { pub id: uuid::Uuid, pub state: SagaState, } impl From<&Saga> for Saga { fn from(value: &Saga) -> Self { value.clone() } } impl Saga { pub fn builder() -> builder::Saga { builder::Saga::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "error")] pub enum SagaErrorInfo { #[serde(rename = "action_failed")] ActionFailed { source_error: serde_json::Value }, #[serde(rename = "deserialize_failed")] DeserializeFailed { message: String }, #[serde(rename = "injected_error")] InjectedError, #[serde(rename = "serialize_failed")] SerializeFailed { message: String }, #[serde(rename = "subsaga_create_failed")] SubsagaCreateFailed { message: String }, } impl From<&SagaErrorInfo> for SagaErrorInfo { fn from(value: &SagaErrorInfo) -> Self { value.clone() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SagaResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&SagaResultsPage> for SagaResultsPage { fn from(value: &SagaResultsPage) -> Self { value.clone() } } impl SagaResultsPage { pub fn builder() -> builder::SagaResultsPage { builder::SagaResultsPage::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "state")] pub enum SagaState { #[serde(rename = "running")] Running, #[serde(rename = "succeeded")] Succeeded, #[serde(rename = "failed")] Failed { error_info: SagaErrorInfo, error_node_name: NodeName, }, } impl From<&SagaState> for SagaState { fn from(value: &SagaState) -> Self { value.clone() } } ///Identity-related metadata that's included in nearly all public API /// objects #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SamlIdentityProvider { ///service provider endpoint where the response will be sent pub acs_url: String, ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///idp's entity id pub idp_entity_id: String, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///optional request signing public certificate (base64 encoded der /// file) #[serde(default, skip_serializing_if = "Option::is_none")] pub public_cert: Option, ///service provider endpoint where the idp should send log out requests pub slo_url: String, ///sp's client id pub sp_client_id: String, ///customer's technical contact for saml configuration pub technical_contact_email: String, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&SamlIdentityProvider> for SamlIdentityProvider { fn from(value: &SamlIdentityProvider) -> Self { value.clone() } } impl SamlIdentityProvider { pub fn builder() -> builder::SamlIdentityProvider { builder::SamlIdentityProvider::default() } } ///Create-time identity-related parameters #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SamlIdentityProviderCreate { ///service provider endpoint where the response will be sent pub acs_url: String, pub description: String, ///If set, SAML attributes with this name will be considered to denote /// a user's group membership, where the attribute value(s) should be a /// comma-separated list of group names. #[serde(default, skip_serializing_if = "Option::is_none")] pub group_attribute_name: Option, ///idp's entity id pub idp_entity_id: String, ///the source of an identity provider metadata descriptor pub idp_metadata_source: IdpMetadataSource, pub name: Name, ///optional request signing key pair #[serde(default, skip_serializing_if = "Option::is_none")] pub signing_keypair: Option, ///service provider endpoint where the idp should send log out requests pub slo_url: String, ///sp's client id pub sp_client_id: String, ///customer's technical contact for saml configuration pub technical_contact_email: String, } impl From<&SamlIdentityProviderCreate> for SamlIdentityProviderCreate { fn from(value: &SamlIdentityProviderCreate) -> Self { value.clone() } } impl SamlIdentityProviderCreate { pub fn builder() -> builder::SamlIdentityProviderCreate { builder::SamlIdentityProviderCreate::default() } } #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct SemverVersion(String); impl std::ops::Deref for SemverVersion { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: SemverVersion) -> Self { value.0 } } impl From<&SemverVersion> for SemverVersion { fn from(value: &SemverVersion) -> Self { value.clone() } } impl std::str::FromStr for SemverVersion { type Err = &'static str; fn from_str(value: &str) -> Result { if regress::Regex::new("^\\d+\\.\\d+\\.\\d+([\\-\\+].+)?$") .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \"^\\d+\\.\\d+\\.\\d+([\\-\\+].+)?$\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for SemverVersion { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for SemverVersion { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for SemverVersion { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for SemverVersion { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///The service intended to use this certificate. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum ServiceUsingCertificate { ///This certificate is intended for access to the external API. #[serde(rename = "external_api")] ExternalApi, } impl From<&ServiceUsingCertificate> for ServiceUsingCertificate { fn from(value: &ServiceUsingCertificate) -> Self { value.clone() } } impl ToString for ServiceUsingCertificate { fn to_string(&self) -> String { match *self { Self::ExternalApi => "external_api".to_string(), } } } impl std::str::FromStr for ServiceUsingCertificate { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "external_api" => Ok(Self::ExternalApi), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for ServiceUsingCertificate { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for ServiceUsingCertificate { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for ServiceUsingCertificate { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a ['Silo'] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Silo { ///human-readable free-form text about a resource pub description: String, ///A silo where discoverable is false can be retrieved only by its id - /// it will not be part of the "list all silos" output. pub discoverable: bool, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///How users and groups are managed in this Silo pub identity_mode: SiloIdentityMode, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Silo> for Silo { fn from(value: &Silo) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct SiloCreate { ///If set, this group will be created during Silo creation and granted /// the "Silo Admin" role. Identity providers can assert that users /// belong to this group and those users can log in and further /// initialize the Silo. /// ///Note that if configuring a SAML based identity provider, /// group_attribute_name must be set for users to be considered part of /// a group. See [`SamlIdentityProviderCreate`] for more information. #[serde(default, skip_serializing_if = "Option::is_none")] pub admin_group_name: Option, pub description: String, pub discoverable: bool, pub identity_mode: SiloIdentityMode, pub name: Name, } impl From<&SiloCreate> for SiloCreate { fn from(value: &SiloCreate) -> Self { value.clone() } } impl SiloCreate { pub fn builder() -> builder::SiloCreate { builder::SiloCreate::default() } } ///Describes how identities are managed and users are authenticated in this /// Silo #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum SiloIdentityMode { ///Users are authenticated with SAML using an external authentication /// provider. The system updates information about users and groups /// only during successful authentication (i.e,. "JIT provisioning" of /// users and groups). #[serde(rename = "saml_jit")] SamlJit, ///The system is the source of truth about users. There is no linkage /// to an external authentication provider or identity provider. #[serde(rename = "local_only")] LocalOnly, } impl From<&SiloIdentityMode> for SiloIdentityMode { fn from(value: &SiloIdentityMode) -> Self { value.clone() } } impl ToString for SiloIdentityMode { fn to_string(&self) -> String { match *self { Self::SamlJit => "saml_jit".to_string(), Self::LocalOnly => "local_only".to_string(), } } } impl std::str::FromStr for SiloIdentityMode { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "saml_jit" => Ok(Self::SamlJit), "local_only" => Ok(Self::LocalOnly), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for SiloIdentityMode { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for SiloIdentityMode { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for SiloIdentityMode { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SiloResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&SiloResultsPage> for SiloResultsPage { fn from(value: &SiloResultsPage) -> Self { value.clone() } } impl SiloResultsPage { pub fn builder() -> builder::SiloResultsPage { builder::SiloResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum SiloRole { #[serde(rename = "admin")] Admin, #[serde(rename = "collaborator")] Collaborator, #[serde(rename = "viewer")] Viewer, } impl From<&SiloRole> for SiloRole { fn from(value: &SiloRole) -> Self { value.clone() } } impl ToString for SiloRole { fn to_string(&self) -> String { match *self { Self::Admin => "admin".to_string(), Self::Collaborator => "collaborator".to_string(), Self::Viewer => "viewer".to_string(), } } } impl std::str::FromStr for SiloRole { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "admin" => Ok(Self::Admin), "collaborator" => Ok(Self::Collaborator), "viewer" => Ok(Self::Viewer), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for SiloRole { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for SiloRole { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for SiloRole { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// ///Note that the Policy only describes access granted explicitly for this /// resource. The policies of parent resources can also cause a user to /// have access to this resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SiloRolePolicy { ///Roles directly assigned on this resource pub role_assignments: Vec, } impl From<&SiloRolePolicy> for SiloRolePolicy { fn from(value: &SiloRolePolicy) -> Self { value.clone() } } 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.) /// ///The resource is not part of this structure. Rather, [`RoleAssignment`]s /// are put into a [`Policy`] and that Policy is applied to a particular /// resource. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SiloRoleRoleAssignment { pub identity_id: uuid::Uuid, pub identity_type: IdentityType, pub role_name: SiloRole, } impl From<&SiloRoleRoleAssignment> for SiloRoleRoleAssignment { fn from(value: &SiloRoleRoleAssignment) -> Self { value.clone() } } impl SiloRoleRoleAssignment { pub fn builder() -> builder::SiloRoleRoleAssignment { builder::SiloRoleRoleAssignment::default() } } ///Client view of a [`Sled`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Sled { pub baseboard: Baseboard, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, pub service_address: String, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Sled> for Sled { fn from(value: &Sled) -> Self { value.clone() } } impl Sled { pub fn builder() -> builder::Sled { builder::Sled::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SledResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&SledResultsPage> for SledResultsPage { fn from(value: &SledResultsPage) -> Self { value.clone() } } impl SledResultsPage { pub fn builder() -> builder::SledResultsPage { builder::SledResultsPage::default() } } ///Client view of a Snapshot #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Snapshot { ///human-readable free-form text about a resource pub description: String, pub disk_id: uuid::Uuid, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, pub project_id: uuid::Uuid, pub size: ByteCount, pub state: SnapshotState, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Snapshot> for Snapshot { fn from(value: &Snapshot) -> Self { value.clone() } } impl Snapshot { pub fn builder() -> builder::Snapshot { builder::Snapshot::default() } } ///Create-time parameters for a /// [`Snapshot`](crate::external_api::views::Snapshot) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SnapshotCreate { pub description: String, ///The name of the disk to be snapshotted pub disk: Name, pub name: Name, } impl From<&SnapshotCreate> for SnapshotCreate { fn from(value: &SnapshotCreate) -> Self { value.clone() } } impl SnapshotCreate { pub fn builder() -> builder::SnapshotCreate { builder::SnapshotCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SnapshotResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&SnapshotResultsPage> for SnapshotResultsPage { fn from(value: &SnapshotResultsPage) -> Self { value.clone() } } impl SnapshotResultsPage { pub fn builder() -> builder::SnapshotResultsPage { builder::SnapshotResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum SnapshotState { #[serde(rename = "creating")] Creating, #[serde(rename = "ready")] Ready, #[serde(rename = "faulted")] Faulted, #[serde(rename = "destroyed")] Destroyed, } impl From<&SnapshotState> for SnapshotState { fn from(value: &SnapshotState) -> Self { value.clone() } } impl ToString for SnapshotState { fn to_string(&self) -> String { match *self { Self::Creating => "creating".to_string(), Self::Ready => "ready".to_string(), Self::Faulted => "faulted".to_string(), Self::Destroyed => "destroyed".to_string(), } } } impl std::str::FromStr for SnapshotState { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "creating" => Ok(Self::Creating), "ready" => Ok(Self::Ready), "faulted" => Ok(Self::Faulted), "destroyed" => Ok(Self::Destroyed), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for SnapshotState { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for SnapshotState { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for SnapshotState { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SpoofLoginBody { pub username: String, } impl From<&SpoofLoginBody> for SpoofLoginBody { fn from(value: &SpoofLoginBody) -> Self { value.clone() } } impl SpoofLoginBody { pub fn builder() -> builder::SpoofLoginBody { builder::SpoofLoginBody::default() } } ///Client view of a [`SshKey`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SshKey { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///SSH public key, e.g., `"ssh-ed25519 AAAAC3NzaC..."` pub public_key: String, ///The user to whom this key belongs pub silo_user_id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&SshKey> for SshKey { fn from(value: &SshKey) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct SshKeyCreate { pub description: String, pub name: Name, ///SSH public key, e.g., `"ssh-ed25519 AAAAC3NzaC..."` pub public_key: String, } impl From<&SshKeyCreate> for SshKeyCreate { fn from(value: &SshKeyCreate) -> Self { value.clone() } } impl SshKeyCreate { pub fn builder() -> builder::SshKeyCreate { builder::SshKeyCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SshKeyResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&SshKeyResultsPage> for SshKeyResultsPage { fn from(value: &SshKeyResultsPage) -> Self { value.clone() } } impl SshKeyResultsPage { pub fn builder() -> builder::SshKeyResultsPage { builder::SshKeyResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum SystemMetricName { #[serde(rename = "virtual_disk_space_provisioned")] VirtualDiskSpaceProvisioned, #[serde(rename = "cpus_provisioned")] CpusProvisioned, #[serde(rename = "ram_provisioned")] RamProvisioned, } impl From<&SystemMetricName> for SystemMetricName { fn from(value: &SystemMetricName) -> Self { value.clone() } } impl ToString for SystemMetricName { fn to_string(&self) -> String { match *self { Self::VirtualDiskSpaceProvisioned => "virtual_disk_space_provisioned".to_string(), Self::CpusProvisioned => "cpus_provisioned".to_string(), Self::RamProvisioned => "ram_provisioned".to_string(), } } } impl std::str::FromStr for SystemMetricName { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "virtual_disk_space_provisioned" => Ok(Self::VirtualDiskSpaceProvisioned), "cpus_provisioned" => Ok(Self::CpusProvisioned), "ram_provisioned" => Ok(Self::RamProvisioned), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for SystemMetricName { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for SystemMetricName { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for SystemMetricName { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Identity-related metadata that's included in "asset" public API objects /// (which generally have no name or description) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SystemUpdate { ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, pub version: SemverVersion, } impl From<&SystemUpdate> for SystemUpdate { fn from(value: &SystemUpdate) -> Self { value.clone() } } impl SystemUpdate { pub fn builder() -> builder::SystemUpdate { builder::SystemUpdate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SystemUpdateResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&SystemUpdateResultsPage> for SystemUpdateResultsPage { fn from(value: &SystemUpdateResultsPage) -> Self { value.clone() } } impl SystemUpdateResultsPage { pub fn builder() -> builder::SystemUpdateResultsPage { builder::SystemUpdateResultsPage::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SystemUpdateStart { pub version: SemverVersion, } impl From<&SystemUpdateStart> for SystemUpdateStart { fn from(value: &SystemUpdateStart) -> Self { value.clone() } } impl SystemUpdateStart { pub fn builder() -> builder::SystemUpdateStart { builder::SystemUpdateStart::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SystemVersion { pub status: UpdateStatus, pub version_range: VersionRange, } impl From<&SystemVersion> for SystemVersion { fn from(value: &SystemVersion) -> Self { value.clone() } } impl SystemVersion { pub fn builder() -> builder::SystemVersion { builder::SystemVersion::default() } } ///Names are constructed by concatenating the target and metric names with /// ':'. Target and metric names must be lowercase alphanumeric characters /// with '_' separating words. #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct TimeseriesName(String); impl std::ops::Deref for TimeseriesName { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: TimeseriesName) -> Self { value.0 } } impl From<&TimeseriesName> for TimeseriesName { fn from(value: &TimeseriesName) -> Self { value.clone() } } impl std::str::FromStr for TimeseriesName { type Err = &'static str; fn from_str(value: &str) -> Result { if regress::Regex::new( "(([a-z]+[a-z0-9]*)(_([a-z0-9]+))*):(([a-z]+[a-z0-9]*)(_([a-z0-9]+))*)", ) .unwrap() .find(value) .is_none() { return Err("doesn't match pattern \ \"(([a-z]+[a-z0-9]*)(_([a-z0-9]+))*):(([a-z]+[a-z0-9]*\ )(_([a-z0-9]+))*)\""); } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for TimeseriesName { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for TimeseriesName { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for TimeseriesName { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for TimeseriesName { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///The schema for a timeseries. /// ///This includes the name of the timeseries, as well as the datum type of /// its metric and the schema for each field. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct TimeseriesSchema { pub created: chrono::DateTime, pub datum_type: DatumType, pub field_schema: Vec, pub timeseries_name: TimeseriesName, } impl From<&TimeseriesSchema> for TimeseriesSchema { fn from(value: &TimeseriesSchema) -> Self { value.clone() } } impl TimeseriesSchema { pub fn builder() -> builder::TimeseriesSchema { builder::TimeseriesSchema::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct TimeseriesSchemaResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&TimeseriesSchemaResultsPage> for TimeseriesSchemaResultsPage { fn from(value: &TimeseriesSchemaResultsPage) -> Self { value.clone() } } impl TimeseriesSchemaResultsPage { pub fn builder() -> builder::TimeseriesSchemaResultsPage { builder::TimeseriesSchemaResultsPage::default() } } ///Identity-related metadata that's included in "asset" public API objects /// (which generally have no name or description) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UpdateDeployment { ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, pub status: UpdateStatus, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, pub version: SemverVersion, } impl From<&UpdateDeployment> for UpdateDeployment { fn from(value: &UpdateDeployment) -> Self { value.clone() } } impl UpdateDeployment { pub fn builder() -> builder::UpdateDeployment { builder::UpdateDeployment::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UpdateDeploymentResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&UpdateDeploymentResultsPage> for UpdateDeploymentResultsPage { fn from(value: &UpdateDeploymentResultsPage) -> Self { value.clone() } } impl UpdateDeploymentResultsPage { pub fn builder() -> builder::UpdateDeploymentResultsPage { builder::UpdateDeploymentResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] #[serde(tag = "status")] pub enum UpdateStatus { #[serde(rename = "updating")] Updating, #[serde(rename = "steady")] Steady, } impl From<&UpdateStatus> for UpdateStatus { fn from(value: &UpdateStatus) -> Self { value.clone() } } impl ToString for UpdateStatus { fn to_string(&self) -> String { match *self { Self::Updating => "updating".to_string(), Self::Steady => "steady".to_string(), } } } impl std::str::FromStr for UpdateStatus { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "updating" => Ok(Self::Updating), "steady" => Ok(Self::Steady), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for UpdateStatus { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for UpdateStatus { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for UpdateStatus { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Identity-related metadata that's included in "asset" public API objects /// (which generally have no name or description) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UpdateableComponent { pub component_type: UpdateableComponentType, pub device_id: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, pub status: UpdateStatus, pub system_version: SemverVersion, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, pub version: SemverVersion, } impl From<&UpdateableComponent> for UpdateableComponent { fn from(value: &UpdateableComponent) -> Self { value.clone() } } impl UpdateableComponent { pub fn builder() -> builder::UpdateableComponent { builder::UpdateableComponent::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UpdateableComponentResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&UpdateableComponentResultsPage> for UpdateableComponentResultsPage { fn from(value: &UpdateableComponentResultsPage) -> Self { value.clone() } } impl UpdateableComponentResultsPage { pub fn builder() -> builder::UpdateableComponentResultsPage { builder::UpdateableComponentResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum UpdateableComponentType { #[serde(rename = "bootloader_for_rot")] BootloaderForRot, #[serde(rename = "bootloader_for_sp")] BootloaderForSp, #[serde(rename = "bootloader_for_host_proc")] BootloaderForHostProc, #[serde(rename = "hubris_for_psc_rot")] HubrisForPscRot, #[serde(rename = "hubris_for_psc_sp")] HubrisForPscSp, #[serde(rename = "hubris_for_sidecar_rot")] HubrisForSidecarRot, #[serde(rename = "hubris_for_sidecar_sp")] HubrisForSidecarSp, #[serde(rename = "hubris_for_gimlet_rot")] HubrisForGimletRot, #[serde(rename = "hubris_for_gimlet_sp")] HubrisForGimletSp, #[serde(rename = "helios_host_phase1")] HeliosHostPhase1, #[serde(rename = "helios_host_phase2")] HeliosHostPhase2, #[serde(rename = "host_omicron")] HostOmicron, } impl From<&UpdateableComponentType> for UpdateableComponentType { fn from(value: &UpdateableComponentType) -> Self { value.clone() } } impl ToString for UpdateableComponentType { fn to_string(&self) -> String { match *self { Self::BootloaderForRot => "bootloader_for_rot".to_string(), Self::BootloaderForSp => "bootloader_for_sp".to_string(), Self::BootloaderForHostProc => "bootloader_for_host_proc".to_string(), Self::HubrisForPscRot => "hubris_for_psc_rot".to_string(), Self::HubrisForPscSp => "hubris_for_psc_sp".to_string(), Self::HubrisForSidecarRot => "hubris_for_sidecar_rot".to_string(), Self::HubrisForSidecarSp => "hubris_for_sidecar_sp".to_string(), Self::HubrisForGimletRot => "hubris_for_gimlet_rot".to_string(), Self::HubrisForGimletSp => "hubris_for_gimlet_sp".to_string(), Self::HeliosHostPhase1 => "helios_host_phase1".to_string(), Self::HeliosHostPhase2 => "helios_host_phase2".to_string(), Self::HostOmicron => "host_omicron".to_string(), } } } impl std::str::FromStr for UpdateableComponentType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "bootloader_for_rot" => Ok(Self::BootloaderForRot), "bootloader_for_sp" => Ok(Self::BootloaderForSp), "bootloader_for_host_proc" => Ok(Self::BootloaderForHostProc), "hubris_for_psc_rot" => Ok(Self::HubrisForPscRot), "hubris_for_psc_sp" => Ok(Self::HubrisForPscSp), "hubris_for_sidecar_rot" => Ok(Self::HubrisForSidecarRot), "hubris_for_sidecar_sp" => Ok(Self::HubrisForSidecarSp), "hubris_for_gimlet_rot" => Ok(Self::HubrisForGimletRot), "hubris_for_gimlet_sp" => Ok(Self::HubrisForGimletSp), "helios_host_phase1" => Ok(Self::HeliosHostPhase1), "helios_host_phase2" => Ok(Self::HeliosHostPhase2), "host_omicron" => Ok(Self::HostOmicron), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for UpdateableComponentType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for UpdateableComponentType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for UpdateableComponentType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Client view of a [`User`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct User { ///Human-readable name that can identify the user pub display_name: String, pub id: uuid::Uuid, ///Uuid of the silo to which this user belongs pub silo_id: uuid::Uuid, } impl From<&User> for User { fn from(value: &User) -> Self { value.clone() } } impl User { pub fn builder() -> builder::User { builder::User::default() } } ///Client view of a [`UserBuiltin`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserBuiltin { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&UserBuiltin> for UserBuiltin { fn from(value: &UserBuiltin) -> Self { value.clone() } } impl UserBuiltin { pub fn builder() -> builder::UserBuiltin { builder::UserBuiltin::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserBuiltinResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&UserBuiltinResultsPage> for UserBuiltinResultsPage { fn from(value: &UserBuiltinResultsPage) -> Self { value.clone() } } impl UserBuiltinResultsPage { pub fn builder() -> builder::UserBuiltinResultsPage { builder::UserBuiltinResultsPage::default() } } ///Create-time parameters for a [`User`](crate::external_api::views::User) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserCreate { ///username used to log in pub external_id: UserId, ///password used to log in pub password: UserPassword, } impl From<&UserCreate> for UserCreate { fn from(value: &UserCreate) -> Self { value.clone() } } impl UserCreate { pub fn builder() -> builder::UserCreate { builder::UserCreate::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. #[derive(Clone, Debug, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize)] pub struct UserId(String); impl std::ops::Deref for UserId { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From for String { fn from(value: UserId) -> Self { value.0 } } impl From<&UserId> for UserId { fn from(value: &UserId) -> Self { value.clone() } } impl std::str::FromStr for UserId { type Err = &'static str; fn from_str(value: &str) -> Result { if value.len() > 63usize { return Err("longer than 63 characters"); } if regress :: Regex :: new ("^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$") . unwrap () . find (value) . is_none () { return Err ("doesn't match pattern \"^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$\"") ; } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&str> for UserId { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for UserId { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for UserId { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } impl<'de> serde::Deserialize<'de> for UserId { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { String::deserialize(deserializer)? .parse() .map_err(|e: &'static str| ::custom(e.to_string())) } } ///Parameters for setting a user's password #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "user_password_value", content = "details")] pub enum UserPassword { ///Sets the user's password to the provided value #[serde(rename = "password")] Password(Password), #[serde(rename = "invalid_password")] InvalidPassword, } impl From<&UserPassword> for UserPassword { fn from(value: &UserPassword) -> Self { value.clone() } } impl From for UserPassword { fn from(value: Password) -> Self { Self::Password(value) } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&UserResultsPage> for UserResultsPage { fn from(value: &UserResultsPage) -> Self { value.clone() } } impl UserResultsPage { pub fn builder() -> builder::UserResultsPage { builder::UserResultsPage::default() } } ///Credentials for local user login #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UsernamePasswordCredentials { pub password: Password, pub username: UserId, } impl From<&UsernamePasswordCredentials> for UsernamePasswordCredentials { fn from(value: &UsernamePasswordCredentials) -> Self { value.clone() } } impl UsernamePasswordCredentials { pub fn builder() -> builder::UsernamePasswordCredentials { builder::UsernamePasswordCredentials::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VersionRange { pub high: SemverVersion, pub low: SemverVersion, } impl From<&VersionRange> for VersionRange { fn from(value: &VersionRange) -> Self { value.clone() } } impl VersionRange { pub fn builder() -> builder::VersionRange { builder::VersionRange::default() } } ///Client view of a [`Vpc`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Vpc { ///human-readable free-form text about a resource pub description: String, ///The name used for the VPC in DNS. pub dns_name: Name, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///The unique local IPv6 address range for subnets in this VPC pub ipv6_prefix: Ipv6Net, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///id for the project containing this VPC pub project_id: uuid::Uuid, ///id for the system router where subnet default routes are registered pub system_router_id: uuid::Uuid, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl From<&Vpc> for Vpc { fn from(value: &Vpc) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct VpcCreate { pub description: String, pub dns_name: Name, ///The IPv6 prefix for this VPC. /// ///All IPv6 subnets created from this VPC must be taken from this /// range, which sould be a Unique Local Address in the range /// `fd00::/48`. The default VPC Subnet will have the first `/64` range /// from this prefix. #[serde(default, skip_serializing_if = "Option::is_none")] pub ipv6_prefix: Option, pub name: Name, } impl From<&VpcCreate> for VpcCreate { fn from(value: &VpcCreate) -> Self { value.clone() } } impl VpcCreate { pub fn builder() -> builder::VpcCreate { builder::VpcCreate::default() } } ///A single rule in a VPC firewall #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcFirewallRule { ///whether traffic matching the rule should be allowed or dropped pub action: VpcFirewallRuleAction, ///human-readable free-form text about a resource pub description: String, ///whether this rule is for incoming or outgoing traffic pub direction: VpcFirewallRuleDirection, ///reductions on the scope of the rule pub filters: VpcFirewallRuleFilter, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///the relative priority of this rule pub priority: u16, ///whether this rule is in effect pub status: VpcFirewallRuleStatus, ///list of sets of instances that the rule applies to pub targets: Vec, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///the VPC to which this rule belongs pub vpc_id: uuid::Uuid, } impl From<&VpcFirewallRule> for VpcFirewallRule { fn from(value: &VpcFirewallRule) -> Self { value.clone() } } impl VpcFirewallRule { pub fn builder() -> builder::VpcFirewallRule { builder::VpcFirewallRule::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcFirewallRuleAction { #[serde(rename = "allow")] Allow, #[serde(rename = "deny")] Deny, } impl From<&VpcFirewallRuleAction> for VpcFirewallRuleAction { fn from(value: &VpcFirewallRuleAction) -> Self { value.clone() } } impl ToString for VpcFirewallRuleAction { fn to_string(&self) -> String { match *self { Self::Allow => "allow".to_string(), Self::Deny => "deny".to_string(), } } } impl std::str::FromStr for VpcFirewallRuleAction { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "allow" => Ok(Self::Allow), "deny" => Ok(Self::Deny), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for VpcFirewallRuleAction { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for VpcFirewallRuleAction { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for VpcFirewallRuleAction { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcFirewallRuleDirection { #[serde(rename = "inbound")] Inbound, #[serde(rename = "outbound")] Outbound, } impl From<&VpcFirewallRuleDirection> for VpcFirewallRuleDirection { fn from(value: &VpcFirewallRuleDirection) -> Self { value.clone() } } impl ToString for VpcFirewallRuleDirection { fn to_string(&self) -> String { match *self { Self::Inbound => "inbound".to_string(), Self::Outbound => "outbound".to_string(), } } } impl std::str::FromStr for VpcFirewallRuleDirection { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "inbound" => Ok(Self::Inbound), "outbound" => Ok(Self::Outbound), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for VpcFirewallRuleDirection { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for VpcFirewallRuleDirection { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for VpcFirewallRuleDirection { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///Filter for a firewall rule. A given packet must match every field that /// is present for the rule to apply to it. A packet matches a field if any /// entry in that field matches the packet. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcFirewallRuleFilter { ///If present, the sources (if incoming) or destinations (if outgoing) /// this rule applies to. #[serde(default, skip_serializing_if = "Option::is_none")] pub hosts: Option>, ///If present, the destination ports this rule applies to. #[serde(default, skip_serializing_if = "Option::is_none")] pub ports: Option>, ///If present, the networking protocols this rule applies to. #[serde(default, skip_serializing_if = "Option::is_none")] pub protocols: Option>, } impl From<&VpcFirewallRuleFilter> for VpcFirewallRuleFilter { fn from(value: &VpcFirewallRuleFilter) -> Self { value.clone() } } 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, JsonSchema, Serialize)] #[serde(tag = "type", content = "value")] pub enum VpcFirewallRuleHostFilter { ///The rule applies to traffic from/to all instances in the VPC #[serde(rename = "vpc")] Vpc(Name), ///The rule applies to traffic from/to all instances in the VPC Subnet #[serde(rename = "subnet")] Subnet(Name), ///The rule applies to traffic from/to this specific instance #[serde(rename = "instance")] Instance(Name), ///The rule applies to traffic from/to a specific IP address #[serde(rename = "ip")] Ip(std::net::IpAddr), ///The rule applies to traffic from/to a specific IP subnet #[serde(rename = "ip_net")] IpNet(IpNet), } impl From<&VpcFirewallRuleHostFilter> for VpcFirewallRuleHostFilter { fn from(value: &VpcFirewallRuleHostFilter) -> Self { value.clone() } } impl From for VpcFirewallRuleHostFilter { fn from(value: std::net::IpAddr) -> Self { Self::Ip(value) } } impl From for VpcFirewallRuleHostFilter { fn from(value: IpNet) -> Self { Self::IpNet(value) } } ///The protocols that may be specified in a firewall rule's filter #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcFirewallRuleProtocol { #[serde(rename = "TCP")] Tcp, #[serde(rename = "UDP")] Udp, #[serde(rename = "ICMP")] Icmp, } impl From<&VpcFirewallRuleProtocol> for VpcFirewallRuleProtocol { fn from(value: &VpcFirewallRuleProtocol) -> Self { value.clone() } } impl ToString for VpcFirewallRuleProtocol { fn to_string(&self) -> String { match *self { Self::Tcp => "TCP".to_string(), Self::Udp => "UDP".to_string(), Self::Icmp => "ICMP".to_string(), } } } impl std::str::FromStr for VpcFirewallRuleProtocol { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "TCP" => Ok(Self::Tcp), "UDP" => Ok(Self::Udp), "ICMP" => Ok(Self::Icmp), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for VpcFirewallRuleProtocol { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for VpcFirewallRuleProtocol { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for VpcFirewallRuleProtocol { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcFirewallRuleStatus { #[serde(rename = "disabled")] Disabled, #[serde(rename = "enabled")] Enabled, } impl From<&VpcFirewallRuleStatus> for VpcFirewallRuleStatus { fn from(value: &VpcFirewallRuleStatus) -> Self { value.clone() } } impl ToString for VpcFirewallRuleStatus { fn to_string(&self) -> String { match *self { Self::Disabled => "disabled".to_string(), Self::Enabled => "enabled".to_string(), } } } impl std::str::FromStr for VpcFirewallRuleStatus { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "disabled" => Ok(Self::Disabled), "enabled" => Ok(Self::Enabled), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for VpcFirewallRuleStatus { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for VpcFirewallRuleStatus { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for VpcFirewallRuleStatus { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///A `VpcFirewallRuleTarget` is used to specify the set of [`Instance`]s to /// which a firewall rule applies. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type", content = "value")] pub enum VpcFirewallRuleTarget { ///The rule applies to all instances in the VPC #[serde(rename = "vpc")] Vpc(Name), ///The rule applies to all instances in the VPC Subnet #[serde(rename = "subnet")] Subnet(Name), ///The rule applies to this specific instance #[serde(rename = "instance")] Instance(Name), ///The rule applies to a specific IP address #[serde(rename = "ip")] Ip(std::net::IpAddr), ///The rule applies to a specific IP subnet #[serde(rename = "ip_net")] IpNet(IpNet), } impl From<&VpcFirewallRuleTarget> for VpcFirewallRuleTarget { fn from(value: &VpcFirewallRuleTarget) -> Self { value.clone() } } impl From for VpcFirewallRuleTarget { fn from(value: std::net::IpAddr) -> Self { Self::Ip(value) } } impl From for VpcFirewallRuleTarget { fn from(value: IpNet) -> Self { Self::IpNet(value) } } ///A single rule in a VPC firewall #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcFirewallRuleUpdate { ///whether traffic matching the rule should be allowed or dropped pub action: VpcFirewallRuleAction, ///human-readable free-form text about a resource pub description: String, ///whether this rule is for incoming or outgoing traffic pub direction: VpcFirewallRuleDirection, ///reductions on the scope of the rule pub filters: VpcFirewallRuleFilter, ///name of the rule, unique to this VPC pub name: Name, ///the relative priority of this rule pub priority: u16, ///whether this rule is in effect pub status: VpcFirewallRuleStatus, ///list of sets of instances that the rule applies to pub targets: Vec, } impl From<&VpcFirewallRuleUpdate> for VpcFirewallRuleUpdate { fn from(value: &VpcFirewallRuleUpdate) -> Self { value.clone() } } 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. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcFirewallRuleUpdateParams { pub rules: Vec, } impl From<&VpcFirewallRuleUpdateParams> for VpcFirewallRuleUpdateParams { fn from(value: &VpcFirewallRuleUpdateParams) -> Self { value.clone() } } impl VpcFirewallRuleUpdateParams { pub fn builder() -> builder::VpcFirewallRuleUpdateParams { builder::VpcFirewallRuleUpdateParams::default() } } ///Collection of a Vpc's firewall rules #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcFirewallRules { pub rules: Vec, } impl From<&VpcFirewallRules> for VpcFirewallRules { fn from(value: &VpcFirewallRules) -> Self { value.clone() } } impl VpcFirewallRules { pub fn builder() -> builder::VpcFirewallRules { builder::VpcFirewallRules::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&VpcResultsPage> for VpcResultsPage { fn from(value: &VpcResultsPage) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct VpcRouter { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, pub kind: VpcRouterKind, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///The VPC to which the router belongs. pub vpc_id: uuid::Uuid, } impl From<&VpcRouter> for VpcRouter { fn from(value: &VpcRouter) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct VpcRouterCreate { pub description: String, pub name: Name, } impl From<&VpcRouterCreate> for VpcRouterCreate { fn from(value: &VpcRouterCreate) -> Self { value.clone() } } impl VpcRouterCreate { pub fn builder() -> builder::VpcRouterCreate { builder::VpcRouterCreate::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcRouterKind { #[serde(rename = "system")] System, #[serde(rename = "custom")] Custom, } impl From<&VpcRouterKind> for VpcRouterKind { fn from(value: &VpcRouterKind) -> Self { value.clone() } } impl ToString for VpcRouterKind { fn to_string(&self) -> String { match *self { Self::System => "system".to_string(), Self::Custom => "custom".to_string(), } } } impl std::str::FromStr for VpcRouterKind { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "system" => Ok(Self::System), "custom" => Ok(Self::Custom), _ => Err("invalid value"), } } } impl std::convert::TryFrom<&str> for VpcRouterKind { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } impl std::convert::TryFrom<&String> for VpcRouterKind { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } impl std::convert::TryFrom for VpcRouterKind { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcRouterResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&VpcRouterResultsPage> for VpcRouterResultsPage { fn from(value: &VpcRouterResultsPage) -> Self { value.clone() } } impl VpcRouterResultsPage { pub fn builder() -> builder::VpcRouterResultsPage { builder::VpcRouterResultsPage::default() } } ///Updateable properties of a /// [`VpcRouter`](crate::external_api::views::VpcRouter) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcRouterUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl From<&VpcRouterUpdate> for VpcRouterUpdate { fn from(value: &VpcRouterUpdate) -> Self { value.clone() } } 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. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcSubnet { ///human-readable free-form text about a resource pub description: String, ///unique, immutable, system-controlled identifier for each resource pub id: uuid::Uuid, ///The IPv4 subnet CIDR block. pub ipv4_block: Ipv4Net, ///The IPv6 subnet CIDR block. pub ipv6_block: Ipv6Net, ///unique, mutable, user-controlled identifier for each resource pub name: Name, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, ///The VPC to which the subnet belongs. pub vpc_id: uuid::Uuid, } impl From<&VpcSubnet> for VpcSubnet { fn from(value: &VpcSubnet) -> Self { value.clone() } } 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, JsonSchema, Serialize)] pub struct VpcSubnetCreate { pub description: String, ///The IPv4 address range for this subnet. /// ///It must be allocated from an RFC 1918 private address range, and /// must not overlap with any other existing subnet in the VPC. pub ipv4_block: Ipv4Net, ///The IPv6 address range for this subnet. /// ///It must be allocated from the RFC 4193 Unique Local Address range, /// with the prefix equal to the parent VPC's prefix. A random `/64` /// block will be assigned if one is not provided. It must not overlap /// with any existing subnet in the VPC. #[serde(default, skip_serializing_if = "Option::is_none")] pub ipv6_block: Option, pub name: Name, } impl From<&VpcSubnetCreate> for VpcSubnetCreate { fn from(value: &VpcSubnetCreate) -> Self { value.clone() } } impl VpcSubnetCreate { pub fn builder() -> builder::VpcSubnetCreate { builder::VpcSubnetCreate::default() } } ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcSubnetResultsPage { ///list of items on this page of results pub items: Vec, ///token used to fetch the next page of results (if any) #[serde(default, skip_serializing_if = "Option::is_none")] pub next_page: Option, } impl From<&VpcSubnetResultsPage> for VpcSubnetResultsPage { fn from(value: &VpcSubnetResultsPage) -> Self { value.clone() } } impl VpcSubnetResultsPage { pub fn builder() -> builder::VpcSubnetResultsPage { builder::VpcSubnetResultsPage::default() } } ///Updateable properties of a /// [`VpcSubnet`](crate::external_api::views::VpcSubnet) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcSubnetUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl From<&VpcSubnetUpdate> for VpcSubnetUpdate { fn from(value: &VpcSubnetUpdate) -> Self { value.clone() } } impl VpcSubnetUpdate { pub fn builder() -> builder::VpcSubnetUpdate { builder::VpcSubnetUpdate::default() } } ///Updateable properties of a [`Vpc`](crate::external_api::views::Vpc) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcUpdate { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub dns_name: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl From<&VpcUpdate> for VpcUpdate { fn from(value: &VpcUpdate) -> Self { value.clone() } } impl VpcUpdate { pub fn builder() -> builder::VpcUpdate { builder::VpcUpdate::default() } } pub mod builder { #[derive(Clone, Debug)] pub struct Baseboard { part: Result, revision: Result, serial: Result, } impl Default for Baseboard { fn default() -> Self { Self { part: Err("no value supplied for part".to_string()), revision: Err("no value supplied for revision".to_string()), serial: Err("no value supplied for serial".to_string()), } } } impl Baseboard { pub fn part(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.part = value .try_into() .map_err(|e| format!("error converting supplied value for part: {}", e)); self } pub fn revision(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.revision = value .try_into() .map_err(|e| format!("error converting supplied value for revision: {}", e)); self } pub fn serial(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.serial = value .try_into() .map_err(|e| format!("error converting supplied value for serial: {}", e)); self } } impl std::convert::TryFrom for super::Baseboard { type Error = String; fn try_from(value: Baseboard) -> Result { Ok(Self { part: value.part?, revision: value.revision?, serial: value.serial?, }) } } impl From for Baseboard { fn from(value: super::Baseboard) -> Self { Self { part: Ok(value.part), revision: Ok(value.revision), serial: Ok(value.serial), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Bindouble { fn from(value: super::Bindouble) -> Self { Self { count: Ok(value.count), range: Ok(value.range), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Binint64 { fn from(value: super::Binint64) -> Self { Self { count: Ok(value.count), range: Ok(value.range), } } } #[derive(Clone, Debug)] pub struct Certificate { description: Result, id: Result, name: Result, service: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Certificate { 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()), service: Err("no value supplied for service".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 Certificate { 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 service(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.service = value .try_into() .map_err(|e| format!("error converting supplied value for service: {}", 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::Certificate { type Error = String; fn try_from(value: Certificate) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, service: value.service?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } impl From for Certificate { fn from(value: super::Certificate) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), service: Ok(value.service), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] pub struct CertificateCreate { cert: Result, String>, description: Result, key: Result, String>, name: Result, service: Result, } impl Default for CertificateCreate { fn default() -> Self { Self { cert: Err("no value supplied for cert".to_string()), description: Err("no value supplied for description".to_string()), key: Err("no value supplied for key".to_string()), name: Err("no value supplied for name".to_string()), service: Err("no value supplied for service".to_string()), } } } impl CertificateCreate { pub fn cert(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.cert = value .try_into() .map_err(|e| format!("error converting supplied value for cert: {}", 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 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 } 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 service(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.service = value .try_into() .map_err(|e| format!("error converting supplied value for service: {}", e)); self } } impl std::convert::TryFrom for super::CertificateCreate { type Error = String; fn try_from(value: CertificateCreate) -> Result { Ok(Self { cert: value.cert?, description: value.description?, key: value.key?, name: value.name?, service: value.service?, }) } } impl From for CertificateCreate { fn from(value: super::CertificateCreate) -> Self { Self { cert: Ok(value.cert), description: Ok(value.description), key: Ok(value.key), name: Ok(value.name), service: Ok(value.service), } } } #[derive(Clone, Debug)] pub struct CertificateResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for CertificateResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl CertificateResultsPage { 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::CertificateResultsPage { type Error = String; fn try_from(value: CertificateResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for CertificateResultsPage { fn from(value: super::CertificateResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct ComponentUpdate { component_type: Result, id: Result, time_created: Result, String>, time_modified: Result, String>, version: Result, } impl Default for ComponentUpdate { fn default() -> Self { Self { component_type: Err("no value supplied for component_type".to_string()), 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()), version: Err("no value supplied for version".to_string()), } } } impl ComponentUpdate { pub fn component_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.component_type = value.try_into().map_err(|e| { format!("error converting supplied value for component_type: {}", 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 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 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::ComponentUpdate { type Error = String; fn try_from(value: ComponentUpdate) -> Result { Ok(Self { component_type: value.component_type?, id: value.id?, time_created: value.time_created?, time_modified: value.time_modified?, version: value.version?, }) } } impl From for ComponentUpdate { fn from(value: super::ComponentUpdate) -> Self { Self { component_type: Ok(value.component_type), id: Ok(value.id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), version: Ok(value.version), } } } #[derive(Clone, Debug)] pub struct ComponentUpdateResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for ComponentUpdateResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl ComponentUpdateResultsPage { 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::ComponentUpdateResultsPage { type Error = String; fn try_from(value: ComponentUpdateResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for ComponentUpdateResultsPage { fn from(value: super::ComponentUpdateResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Cumulativedouble { fn from(value: super::Cumulativedouble) -> Self { Self { start_time: Ok(value.start_time), value: Ok(value.value), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Cumulativeint64 { fn from(value: super::Cumulativeint64) -> Self { Self { start_time: Ok(value.start_time), value: Ok(value.value), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for DerEncodedKeyPair { fn from(value: super::DerEncodedKeyPair) -> Self { Self { private_key: Ok(value.private_key), public_cert: Ok(value.public_cert), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for DeviceAccessTokenRequest { fn from(value: super::DeviceAccessTokenRequest) -> Self { Self { client_id: Ok(value.client_id), device_code: Ok(value.device_code), grant_type: Ok(value.grant_type), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for DeviceAuthRequest { fn from(value: super::DeviceAuthRequest) -> Self { Self { client_id: Ok(value.client_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for DeviceAuthVerify { fn from(value: super::DeviceAuthVerify) -> Self { Self { user_code: Ok(value.user_code), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Disk { fn from(value: super::Disk) -> Self { Self { block_size: Ok(value.block_size), description: Ok(value.description), device_path: Ok(value.device_path), id: Ok(value.id), image_id: Ok(value.image_id), name: Ok(value.name), project_id: Ok(value.project_id), size: Ok(value.size), snapshot_id: Ok(value.snapshot_id), state: Ok(value.state), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for DiskCreate { fn from(value: super::DiskCreate) -> Self { Self { description: Ok(value.description), disk_source: Ok(value.disk_source), name: Ok(value.name), size: Ok(value.size), } } } #[derive(Clone, Debug)] 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? }) } } impl From for DiskIdentifier { fn from(value: super::DiskIdentifier) -> Self { Self { name: Ok(value.name), } } } #[derive(Clone, Debug)] pub struct DiskPath { disk: Result, } impl Default for DiskPath { fn default() -> Self { Self { disk: Err("no value supplied for disk".to_string()), } } } impl DiskPath { 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 } } impl std::convert::TryFrom for super::DiskPath { type Error = String; fn try_from(value: DiskPath) -> Result { Ok(Self { disk: value.disk? }) } } impl From for DiskPath { fn from(value: super::DiskPath) -> Self { Self { disk: Ok(value.disk), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for DiskResultsPage { fn from(value: super::DiskResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Distribution { fn from(value: super::Distribution) -> Self { Self { name: Ok(value.name), version: Ok(value.version), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Error { fn from(value: super::Error) -> Self { Self { error_code: Ok(value.error_code), message: Ok(value.message), request_id: Ok(value.request_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ExternalIp { fn from(value: super::ExternalIp) -> Self { Self { ip: Ok(value.ip), kind: Ok(value.kind), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ExternalIpResultsPage { fn from(value: super::ExternalIpResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for FieldSchema { fn from(value: super::FieldSchema) -> Self { Self { name: Ok(value.name), source: Ok(value.source), ty: Ok(value.ty), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for FleetRolePolicy { fn from(value: super::FleetRolePolicy) -> Self { Self { role_assignments: Ok(value.role_assignments), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for FleetRoleRoleAssignment { fn from(value: super::FleetRoleRoleAssignment) -> Self { Self { identity_id: Ok(value.identity_id), identity_type: Ok(value.identity_type), role_name: Ok(value.role_name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for GlobalImage { fn from(value: super::GlobalImage) -> Self { Self { block_size: Ok(value.block_size), description: Ok(value.description), digest: Ok(value.digest), distribution: Ok(value.distribution), id: Ok(value.id), name: Ok(value.name), size: Ok(value.size), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), url: Ok(value.url), version: Ok(value.version), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for GlobalImageCreate { fn from(value: super::GlobalImageCreate) -> Self { Self { block_size: Ok(value.block_size), description: Ok(value.description), distribution: Ok(value.distribution), name: Ok(value.name), source: Ok(value.source), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for GlobalImageResultsPage { fn from(value: super::GlobalImageResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct Group { display_name: Result, id: Result, silo_id: Result, } impl Default for Group { fn default() -> Self { Self { display_name: Err("no value supplied for display_name".to_string()), id: Err("no value supplied for id".to_string()), silo_id: Err("no value supplied for silo_id".to_string()), } } } impl Group { 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 } pub fn silo_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.silo_id = value .try_into() .map_err(|e| format!("error converting supplied value for silo_id: {}", e)); self } } impl std::convert::TryFrom for super::Group { type Error = String; fn try_from(value: Group) -> Result { Ok(Self { display_name: value.display_name?, id: value.id?, silo_id: value.silo_id?, }) } } impl From for Group { fn from(value: super::Group) -> Self { Self { display_name: Ok(value.display_name), id: Ok(value.id), silo_id: Ok(value.silo_id), } } } #[derive(Clone, Debug)] pub struct GroupResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for GroupResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl GroupResultsPage { 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::GroupResultsPage { type Error = String; fn try_from(value: GroupResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for GroupResultsPage { fn from(value: super::GroupResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Histogramdouble { fn from(value: super::Histogramdouble) -> Self { Self { bins: Ok(value.bins), n_samples: Ok(value.n_samples), start_time: Ok(value.start_time), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Histogramint64 { fn from(value: super::Histogramint64) -> Self { Self { bins: Ok(value.bins), n_samples: Ok(value.n_samples), start_time: Ok(value.start_time), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for IdentityProvider { fn from(value: super::IdentityProvider) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), provider_type: Ok(value.provider_type), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for IdentityProviderResultsPage { fn from(value: super::IdentityProviderResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Image { fn from(value: super::Image) -> Self { Self { block_size: Ok(value.block_size), description: Ok(value.description), digest: Ok(value.digest), id: Ok(value.id), name: Ok(value.name), project_id: Ok(value.project_id), size: Ok(value.size), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), url: Ok(value.url), version: Ok(value.version), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ImageCreate { fn from(value: super::ImageCreate) -> Self { Self { block_size: Ok(value.block_size), description: Ok(value.description), name: Ok(value.name), source: Ok(value.source), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ImageResultsPage { fn from(value: super::ImageResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Instance { fn from(value: super::Instance) -> Self { Self { description: Ok(value.description), hostname: Ok(value.hostname), id: Ok(value.id), memory: Ok(value.memory), name: Ok(value.name), ncpus: Ok(value.ncpus), project_id: Ok(value.project_id), run_state: Ok(value.run_state), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), time_run_state_updated: Ok(value.time_run_state_updated), } } } #[derive(Clone, Debug)] pub struct InstanceCreate { description: Result, disks: Result, String>, external_ips: Result, String>, hostname: Result, memory: Result, name: Result, ncpus: Result, network_interfaces: Result, start: 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()), start: Ok(super::defaults::default_bool::()), 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 start(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.start = value .try_into() .map_err(|e| format!("error converting supplied value for start: {}", 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?, start: value.start?, user_data: value.user_data?, }) } } impl From for InstanceCreate { fn from(value: super::InstanceCreate) -> Self { Self { description: Ok(value.description), disks: Ok(value.disks), external_ips: Ok(value.external_ips), hostname: Ok(value.hostname), memory: Ok(value.memory), name: Ok(value.name), ncpus: Ok(value.ncpus), network_interfaces: Ok(value.network_interfaces), start: Ok(value.start), user_data: Ok(value.user_data), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for InstanceMigrate { fn from(value: super::InstanceMigrate) -> Self { Self { dst_sled_id: Ok(value.dst_sled_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for InstanceResultsPage { fn from(value: super::InstanceResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for InstanceSerialConsoleData { fn from(value: super::InstanceSerialConsoleData) -> Self { Self { data: Ok(value.data), last_byte_offset: Ok(value.last_byte_offset), } } } #[derive(Clone, Debug)] pub struct IpPool { description: Result, id: Result, name: Result, 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()), 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 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?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } impl From for IpPool { fn from(value: super::IpPool) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] pub struct IpPoolCreate { description: Result, name: Result, } 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()), } } } 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 } } impl std::convert::TryFrom for super::IpPoolCreate { type Error = String; fn try_from(value: IpPoolCreate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } impl From for IpPoolCreate { fn from(value: super::IpPoolCreate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for IpPoolRange { fn from(value: super::IpPoolRange) -> Self { Self { id: Ok(value.id), range: Ok(value.range), time_created: Ok(value.time_created), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for IpPoolRangeResultsPage { fn from(value: super::IpPoolRangeResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for IpPoolResultsPage { fn from(value: super::IpPoolResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for IpPoolUpdate { fn from(value: super::IpPoolUpdate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Ipv4Range { fn from(value: super::Ipv4Range) -> Self { Self { first: Ok(value.first), last: Ok(value.last), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Ipv6Range { fn from(value: super::Ipv6Range) -> Self { Self { first: Ok(value.first), last: Ok(value.last), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Measurement { fn from(value: super::Measurement) -> Self { Self { datum: Ok(value.datum), timestamp: Ok(value.timestamp), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for MeasurementResultsPage { fn from(value: super::MeasurementResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for NetworkInterface { fn from(value: super::NetworkInterface) -> Self { Self { description: Ok(value.description), id: Ok(value.id), instance_id: Ok(value.instance_id), ip: Ok(value.ip), mac: Ok(value.mac), name: Ok(value.name), primary: Ok(value.primary), subnet_id: Ok(value.subnet_id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), vpc_id: Ok(value.vpc_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for NetworkInterfaceCreate { fn from(value: super::NetworkInterfaceCreate) -> Self { Self { description: Ok(value.description), ip: Ok(value.ip), name: Ok(value.name), subnet_name: Ok(value.subnet_name), vpc_name: Ok(value.vpc_name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for NetworkInterfaceResultsPage { fn from(value: super::NetworkInterfaceResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct NetworkInterfaceUpdate { description: Result, String>, name: Result, String>, primary: Result, } impl Default for NetworkInterfaceUpdate { fn default() -> Self { Self { description: Ok(Default::default()), name: Ok(Default::default()), primary: 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 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 } } impl std::convert::TryFrom for super::NetworkInterfaceUpdate { type Error = String; fn try_from(value: NetworkInterfaceUpdate) -> Result { Ok(Self { description: value.description?, name: value.name?, primary: value.primary?, }) } } impl From for NetworkInterfaceUpdate { fn from(value: super::NetworkInterfaceUpdate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), primary: Ok(value.primary), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Organization { fn from(value: super::Organization) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for OrganizationCreate { fn from(value: super::OrganizationCreate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for OrganizationResultsPage { fn from(value: super::OrganizationResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for OrganizationRolePolicy { fn from(value: super::OrganizationRolePolicy) -> Self { Self { role_assignments: Ok(value.role_assignments), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for OrganizationRoleRoleAssignment { fn from(value: super::OrganizationRoleRoleAssignment) -> Self { Self { identity_id: Ok(value.identity_id), identity_type: Ok(value.identity_type), role_name: Ok(value.role_name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for OrganizationUpdate { fn from(value: super::OrganizationUpdate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] pub struct PhysicalDisk { disk_type: Result, id: Result, model: Result, serial: Result, sled_id: Result, String>, time_created: Result, String>, time_modified: Result, String>, vendor: Result, } impl Default for PhysicalDisk { fn default() -> Self { Self { disk_type: Err("no value supplied for disk_type".to_string()), id: Err("no value supplied for id".to_string()), model: Err("no value supplied for model".to_string()), serial: Err("no value supplied for serial".to_string()), sled_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()), vendor: Err("no value supplied for vendor".to_string()), } } } impl PhysicalDisk { pub fn disk_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.disk_type = value .try_into() .map_err(|e| format!("error converting supplied value for disk_type: {}", 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 model(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.model = value .try_into() .map_err(|e| format!("error converting supplied value for model: {}", e)); self } pub fn serial(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.serial = value .try_into() .map_err(|e| format!("error converting supplied value for serial: {}", e)); self } pub fn sled_id(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.sled_id = value .try_into() .map_err(|e| format!("error converting supplied value for sled_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 vendor(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vendor = value .try_into() .map_err(|e| format!("error converting supplied value for vendor: {}", e)); self } } impl std::convert::TryFrom for super::PhysicalDisk { type Error = String; fn try_from(value: PhysicalDisk) -> Result { Ok(Self { disk_type: value.disk_type?, id: value.id?, model: value.model?, serial: value.serial?, sled_id: value.sled_id?, time_created: value.time_created?, time_modified: value.time_modified?, vendor: value.vendor?, }) } } impl From for PhysicalDisk { fn from(value: super::PhysicalDisk) -> Self { Self { disk_type: Ok(value.disk_type), id: Ok(value.id), model: Ok(value.model), serial: Ok(value.serial), sled_id: Ok(value.sled_id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), vendor: Ok(value.vendor), } } } #[derive(Clone, Debug)] pub struct PhysicalDiskResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for PhysicalDiskResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl PhysicalDiskResultsPage { 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::PhysicalDiskResultsPage { type Error = String; fn try_from(value: PhysicalDiskResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for PhysicalDiskResultsPage { fn from(value: super::PhysicalDiskResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Project { fn from(value: super::Project) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), organization_id: Ok(value.organization_id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ProjectCreate { fn from(value: super::ProjectCreate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ProjectResultsPage { fn from(value: super::ProjectResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ProjectRolePolicy { fn from(value: super::ProjectRolePolicy) -> Self { Self { role_assignments: Ok(value.role_assignments), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ProjectRoleRoleAssignment { fn from(value: super::ProjectRoleRoleAssignment) -> Self { Self { identity_id: Ok(value.identity_id), identity_type: Ok(value.identity_type), role_name: Ok(value.role_name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for ProjectUpdate { fn from(value: super::ProjectUpdate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Rack { fn from(value: super::Rack) -> Self { Self { id: Ok(value.id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for RackResultsPage { fn from(value: super::RackResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Role { fn from(value: super::Role) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for RoleResultsPage { fn from(value: super::RoleResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for RouterRoute { fn from(value: super::RouterRoute) -> Self { Self { description: Ok(value.description), destination: Ok(value.destination), id: Ok(value.id), kind: Ok(value.kind), name: Ok(value.name), target: Ok(value.target), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), vpc_router_id: Ok(value.vpc_router_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for RouterRouteCreateParams { fn from(value: super::RouterRouteCreateParams) -> Self { Self { description: Ok(value.description), destination: Ok(value.destination), name: Ok(value.name), target: Ok(value.target), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for RouterRouteResultsPage { fn from(value: super::RouterRouteResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for RouterRouteUpdateParams { fn from(value: super::RouterRouteUpdateParams) -> Self { Self { description: Ok(value.description), destination: Ok(value.destination), name: Ok(value.name), target: Ok(value.target), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Saga { fn from(value: super::Saga) -> Self { Self { id: Ok(value.id), state: Ok(value.state), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SagaResultsPage { fn from(value: super::SagaResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SamlIdentityProvider { fn from(value: super::SamlIdentityProvider) -> Self { Self { acs_url: Ok(value.acs_url), description: Ok(value.description), id: Ok(value.id), idp_entity_id: Ok(value.idp_entity_id), name: Ok(value.name), public_cert: Ok(value.public_cert), slo_url: Ok(value.slo_url), sp_client_id: Ok(value.sp_client_id), technical_contact_email: Ok(value.technical_contact_email), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] pub struct SamlIdentityProviderCreate { acs_url: Result, description: Result, group_attribute_name: Result, String>, 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()), group_attribute_name: Ok(Default::default()), 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 group_attribute_name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.group_attribute_name = value.try_into().map_err(|e| { format!( "error converting supplied value for group_attribute_name: {}", 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?, group_attribute_name: value.group_attribute_name?, 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?, }) } } impl From for SamlIdentityProviderCreate { fn from(value: super::SamlIdentityProviderCreate) -> Self { Self { acs_url: Ok(value.acs_url), description: Ok(value.description), group_attribute_name: Ok(value.group_attribute_name), idp_entity_id: Ok(value.idp_entity_id), idp_metadata_source: Ok(value.idp_metadata_source), name: Ok(value.name), signing_keypair: Ok(value.signing_keypair), slo_url: Ok(value.slo_url), sp_client_id: Ok(value.sp_client_id), technical_contact_email: Ok(value.technical_contact_email), } } } #[derive(Clone, Debug)] pub struct Silo { description: Result, discoverable: Result, id: Result, identity_mode: Result, name: Result, time_created: Result, String>, time_modified: Result, String>, } 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()), identity_mode: Err("no value supplied for identity_mode".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 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 identity_mode(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_mode = value.try_into().map_err(|e| { format!("error converting supplied value for identity_mode: {}", 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::Silo { type Error = String; fn try_from(value: Silo) -> Result { Ok(Self { description: value.description?, discoverable: value.discoverable?, id: value.id?, identity_mode: value.identity_mode?, name: value.name?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } impl From for Silo { fn from(value: super::Silo) -> Self { Self { description: Ok(value.description), discoverable: Ok(value.discoverable), id: Ok(value.id), identity_mode: Ok(value.identity_mode), name: Ok(value.name), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] pub struct SiloCreate { admin_group_name: Result, String>, description: Result, discoverable: Result, identity_mode: Result, name: Result, } impl Default for SiloCreate { fn default() -> Self { Self { admin_group_name: Ok(Default::default()), description: Err("no value supplied for description".to_string()), discoverable: Err("no value supplied for discoverable".to_string()), identity_mode: Err("no value supplied for identity_mode".to_string()), name: Err("no value supplied for name".to_string()), } } } impl SiloCreate { pub fn admin_group_name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.admin_group_name = value.try_into().map_err(|e| { format!( "error converting supplied value for admin_group_name: {}", 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 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 identity_mode(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_mode = value.try_into().map_err(|e| { format!("error converting supplied value for identity_mode: {}", 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::SiloCreate { type Error = String; fn try_from(value: SiloCreate) -> Result { Ok(Self { admin_group_name: value.admin_group_name?, description: value.description?, discoverable: value.discoverable?, identity_mode: value.identity_mode?, name: value.name?, }) } } impl From for SiloCreate { fn from(value: super::SiloCreate) -> Self { Self { admin_group_name: Ok(value.admin_group_name), description: Ok(value.description), discoverable: Ok(value.discoverable), identity_mode: Ok(value.identity_mode), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SiloResultsPage { fn from(value: super::SiloResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SiloRolePolicy { fn from(value: super::SiloRolePolicy) -> Self { Self { role_assignments: Ok(value.role_assignments), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SiloRoleRoleAssignment { fn from(value: super::SiloRoleRoleAssignment) -> Self { Self { identity_id: Ok(value.identity_id), identity_type: Ok(value.identity_type), role_name: Ok(value.role_name), } } } #[derive(Clone, Debug)] pub struct Sled { baseboard: Result, id: Result, service_address: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Sled { fn default() -> Self { Self { baseboard: Err("no value supplied for baseboard".to_string()), 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 baseboard(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.baseboard = value .try_into() .map_err(|e| format!("error converting supplied value for baseboard: {}", 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 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 { baseboard: value.baseboard?, id: value.id?, service_address: value.service_address?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } impl From for Sled { fn from(value: super::Sled) -> Self { Self { baseboard: Ok(value.baseboard), id: Ok(value.id), service_address: Ok(value.service_address), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SledResultsPage { fn from(value: super::SledResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct Snapshot { description: Result, disk_id: Result, id: Result, name: Result, project_id: Result, size: Result, state: 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()), 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 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 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::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?, state: value.state?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } impl From for Snapshot { fn from(value: super::Snapshot) -> Self { Self { description: Ok(value.description), disk_id: Ok(value.disk_id), id: Ok(value.id), name: Ok(value.name), project_id: Ok(value.project_id), size: Ok(value.size), state: Ok(value.state), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SnapshotCreate { fn from(value: super::SnapshotCreate) -> Self { Self { description: Ok(value.description), disk: Ok(value.disk), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SnapshotResultsPage { fn from(value: super::SnapshotResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SpoofLoginBody { fn from(value: super::SpoofLoginBody) -> Self { Self { username: Ok(value.username), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SshKey { fn from(value: super::SshKey) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), public_key: Ok(value.public_key), silo_user_id: Ok(value.silo_user_id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SshKeyCreate { fn from(value: super::SshKeyCreate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), public_key: Ok(value.public_key), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for SshKeyResultsPage { fn from(value: super::SshKeyResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct SystemUpdate { id: Result, time_created: Result, String>, time_modified: Result, String>, version: Result, } impl Default for SystemUpdate { 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()), version: Err("no value supplied for version".to_string()), } } } impl SystemUpdate { 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 } 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::SystemUpdate { type Error = String; fn try_from(value: SystemUpdate) -> Result { Ok(Self { id: value.id?, time_created: value.time_created?, time_modified: value.time_modified?, version: value.version?, }) } } impl From for SystemUpdate { fn from(value: super::SystemUpdate) -> Self { Self { id: Ok(value.id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), version: Ok(value.version), } } } #[derive(Clone, Debug)] pub struct SystemUpdateResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for SystemUpdateResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl SystemUpdateResultsPage { 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::SystemUpdateResultsPage { type Error = String; fn try_from(value: SystemUpdateResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for SystemUpdateResultsPage { fn from(value: super::SystemUpdateResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct SystemUpdateStart { version: Result, } impl Default for SystemUpdateStart { fn default() -> Self { Self { version: Err("no value supplied for version".to_string()), } } } impl SystemUpdateStart { 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::SystemUpdateStart { type Error = String; fn try_from(value: SystemUpdateStart) -> Result { Ok(Self { version: value.version?, }) } } impl From for SystemUpdateStart { fn from(value: super::SystemUpdateStart) -> Self { Self { version: Ok(value.version), } } } #[derive(Clone, Debug)] pub struct SystemVersion { status: Result, version_range: Result, } impl Default for SystemVersion { fn default() -> Self { Self { status: Err("no value supplied for status".to_string()), version_range: Err("no value supplied for version_range".to_string()), } } } impl SystemVersion { 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 version_range(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.version_range = value.try_into().map_err(|e| { format!("error converting supplied value for version_range: {}", e) }); self } } impl std::convert::TryFrom for super::SystemVersion { type Error = String; fn try_from(value: SystemVersion) -> Result { Ok(Self { status: value.status?, version_range: value.version_range?, }) } } impl From for SystemVersion { fn from(value: super::SystemVersion) -> Self { Self { status: Ok(value.status), version_range: Ok(value.version_range), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for TimeseriesSchema { fn from(value: super::TimeseriesSchema) -> Self { Self { created: Ok(value.created), datum_type: Ok(value.datum_type), field_schema: Ok(value.field_schema), timeseries_name: Ok(value.timeseries_name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for TimeseriesSchemaResultsPage { fn from(value: super::TimeseriesSchemaResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct UpdateDeployment { id: Result, status: Result, time_created: Result, String>, time_modified: Result, String>, version: Result, } impl Default for UpdateDeployment { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), status: Err("no value supplied for status".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), version: Err("no value supplied for version".to_string()), } } } impl UpdateDeployment { 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 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 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 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::UpdateDeployment { type Error = String; fn try_from(value: UpdateDeployment) -> Result { Ok(Self { id: value.id?, status: value.status?, time_created: value.time_created?, time_modified: value.time_modified?, version: value.version?, }) } } impl From for UpdateDeployment { fn from(value: super::UpdateDeployment) -> Self { Self { id: Ok(value.id), status: Ok(value.status), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), version: Ok(value.version), } } } #[derive(Clone, Debug)] pub struct UpdateDeploymentResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for UpdateDeploymentResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl UpdateDeploymentResultsPage { 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::UpdateDeploymentResultsPage { type Error = String; fn try_from(value: UpdateDeploymentResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for UpdateDeploymentResultsPage { fn from(value: super::UpdateDeploymentResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct UpdateableComponent { component_type: Result, device_id: Result, id: Result, status: Result, system_version: Result, time_created: Result, String>, time_modified: Result, String>, version: Result, } impl Default for UpdateableComponent { fn default() -> Self { Self { component_type: Err("no value supplied for component_type".to_string()), device_id: Err("no value supplied for device_id".to_string()), id: Err("no value supplied for id".to_string()), status: Err("no value supplied for status".to_string()), system_version: Err("no value supplied for system_version".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), version: Err("no value supplied for version".to_string()), } } } impl UpdateableComponent { pub fn component_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.component_type = value.try_into().map_err(|e| { format!("error converting supplied value for component_type: {}", e) }); self } pub fn device_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.device_id = value .try_into() .map_err(|e| format!("error converting supplied value for device_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 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 system_version(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.system_version = value.try_into().map_err(|e| { format!("error converting supplied value for system_version: {}", 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 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::UpdateableComponent { type Error = String; fn try_from(value: UpdateableComponent) -> Result { Ok(Self { component_type: value.component_type?, device_id: value.device_id?, id: value.id?, status: value.status?, system_version: value.system_version?, time_created: value.time_created?, time_modified: value.time_modified?, version: value.version?, }) } } impl From for UpdateableComponent { fn from(value: super::UpdateableComponent) -> Self { Self { component_type: Ok(value.component_type), device_id: Ok(value.device_id), id: Ok(value.id), status: Ok(value.status), system_version: Ok(value.system_version), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), version: Ok(value.version), } } } #[derive(Clone, Debug)] pub struct UpdateableComponentResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for UpdateableComponentResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl UpdateableComponentResultsPage { 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::UpdateableComponentResultsPage { type Error = String; fn try_from(value: UpdateableComponentResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } impl From for UpdateableComponentResultsPage { fn from(value: super::UpdateableComponentResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct User { display_name: Result, id: Result, silo_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()), silo_id: Err("no value supplied for silo_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 } pub fn silo_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.silo_id = value .try_into() .map_err(|e| format!("error converting supplied value for silo_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?, silo_id: value.silo_id?, }) } } impl From for User { fn from(value: super::User) -> Self { Self { display_name: Ok(value.display_name), id: Ok(value.id), silo_id: Ok(value.silo_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for UserBuiltin { fn from(value: super::UserBuiltin) -> Self { Self { description: Ok(value.description), id: Ok(value.id), name: Ok(value.name), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for UserBuiltinResultsPage { fn from(value: super::UserBuiltinResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct UserCreate { external_id: Result, password: Result, } impl Default for UserCreate { fn default() -> Self { Self { external_id: Err("no value supplied for external_id".to_string()), password: Err("no value supplied for password".to_string()), } } } impl UserCreate { pub fn external_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.external_id = value .try_into() .map_err(|e| format!("error converting supplied value for external_id: {}", e)); self } pub fn password(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.password = value .try_into() .map_err(|e| format!("error converting supplied value for password: {}", e)); self } } impl std::convert::TryFrom for super::UserCreate { type Error = String; fn try_from(value: UserCreate) -> Result { Ok(Self { external_id: value.external_id?, password: value.password?, }) } } impl From for UserCreate { fn from(value: super::UserCreate) -> Self { Self { external_id: Ok(value.external_id), password: Ok(value.password), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for UserResultsPage { fn from(value: super::UserResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] pub struct UsernamePasswordCredentials { password: Result, username: Result, } impl Default for UsernamePasswordCredentials { fn default() -> Self { Self { password: Err("no value supplied for password".to_string()), username: Err("no value supplied for username".to_string()), } } } impl UsernamePasswordCredentials { pub fn password(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.password = value .try_into() .map_err(|e| format!("error converting supplied value for password: {}", e)); self } 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::UsernamePasswordCredentials { type Error = String; fn try_from(value: UsernamePasswordCredentials) -> Result { Ok(Self { password: value.password?, username: value.username?, }) } } impl From for UsernamePasswordCredentials { fn from(value: super::UsernamePasswordCredentials) -> Self { Self { password: Ok(value.password), username: Ok(value.username), } } } #[derive(Clone, Debug)] pub struct VersionRange { high: Result, low: Result, } impl Default for VersionRange { fn default() -> Self { Self { high: Err("no value supplied for high".to_string()), low: Err("no value supplied for low".to_string()), } } } impl VersionRange { pub fn high(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.high = value .try_into() .map_err(|e| format!("error converting supplied value for high: {}", e)); self } pub fn low(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.low = value .try_into() .map_err(|e| format!("error converting supplied value for low: {}", e)); self } } impl std::convert::TryFrom for super::VersionRange { type Error = String; fn try_from(value: VersionRange) -> Result { Ok(Self { high: value.high?, low: value.low?, }) } } impl From for VersionRange { fn from(value: super::VersionRange) -> Self { Self { high: Ok(value.high), low: Ok(value.low), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for Vpc { fn from(value: super::Vpc) -> Self { Self { description: Ok(value.description), dns_name: Ok(value.dns_name), id: Ok(value.id), ipv6_prefix: Ok(value.ipv6_prefix), name: Ok(value.name), project_id: Ok(value.project_id), system_router_id: Ok(value.system_router_id), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcCreate { fn from(value: super::VpcCreate) -> Self { Self { description: Ok(value.description), dns_name: Ok(value.dns_name), ipv6_prefix: Ok(value.ipv6_prefix), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcFirewallRule { fn from(value: super::VpcFirewallRule) -> Self { Self { action: Ok(value.action), description: Ok(value.description), direction: Ok(value.direction), filters: Ok(value.filters), id: Ok(value.id), name: Ok(value.name), priority: Ok(value.priority), status: Ok(value.status), targets: Ok(value.targets), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), vpc_id: Ok(value.vpc_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcFirewallRuleFilter { fn from(value: super::VpcFirewallRuleFilter) -> Self { Self { hosts: Ok(value.hosts), ports: Ok(value.ports), protocols: Ok(value.protocols), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcFirewallRuleUpdate { fn from(value: super::VpcFirewallRuleUpdate) -> Self { Self { action: Ok(value.action), description: Ok(value.description), direction: Ok(value.direction), filters: Ok(value.filters), name: Ok(value.name), priority: Ok(value.priority), status: Ok(value.status), targets: Ok(value.targets), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcFirewallRuleUpdateParams { fn from(value: super::VpcFirewallRuleUpdateParams) -> Self { Self { rules: Ok(value.rules), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcFirewallRules { fn from(value: super::VpcFirewallRules) -> Self { Self { rules: Ok(value.rules), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcResultsPage { fn from(value: super::VpcResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcRouter { fn from(value: super::VpcRouter) -> Self { Self { description: Ok(value.description), id: Ok(value.id), kind: Ok(value.kind), name: Ok(value.name), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), vpc_id: Ok(value.vpc_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcRouterCreate { fn from(value: super::VpcRouterCreate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcRouterResultsPage { fn from(value: super::VpcRouterResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcRouterUpdate { fn from(value: super::VpcRouterUpdate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcSubnet { fn from(value: super::VpcSubnet) -> Self { Self { description: Ok(value.description), id: Ok(value.id), ipv4_block: Ok(value.ipv4_block), ipv6_block: Ok(value.ipv6_block), name: Ok(value.name), time_created: Ok(value.time_created), time_modified: Ok(value.time_modified), vpc_id: Ok(value.vpc_id), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcSubnetCreate { fn from(value: super::VpcSubnetCreate) -> Self { Self { description: Ok(value.description), ipv4_block: Ok(value.ipv4_block), ipv6_block: Ok(value.ipv6_block), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcSubnetResultsPage { fn from(value: super::VpcSubnetResultsPage) -> Self { Self { items: Ok(value.items), next_page: Ok(value.next_page), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcSubnetUpdate { fn from(value: super::VpcSubnetUpdate) -> Self { Self { description: Ok(value.description), name: Ok(value.name), } } } #[derive(Clone, Debug)] 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?, }) } } impl From for VpcUpdate { fn from(value: super::VpcUpdate) -> Self { Self { description: Ok(value.description), dns_name: Ok(value.dns_name), name: Ok(value.name), } } } } pub mod defaults { pub(super) fn default_bool() -> bool { V } pub(super) fn instance_create_network_interfaces( ) -> super::InstanceNetworkInterfaceAttachment { super::InstanceNetworkInterfaceAttachment::Default } } } #[derive(Clone, Debug)] ///Client for Oxide Region API /// ///API for interacting with the Oxide control plane /// ///Version: 0.0.1 pub struct Client { pub(crate) baseurl: String, pub(crate) client: reqwest::Client, } impl Client { /// Create a new client. /// /// `baseurl` is the base URL provided to the internal /// `reqwest::Client`, and should include a scheme and hostname, /// as well as port and a path stem if applicable. pub fn new(baseurl: &str) -> Self { #[cfg(not(target_arch = "wasm32"))] let client = { let dur = std::time::Duration::from_secs(15); reqwest::ClientBuilder::new() .connect_timeout(dur) .timeout(dur) }; #[cfg(target_arch = "wasm32")] let client = reqwest::ClientBuilder::new(); Self::new_with_client(baseurl, client.build().unwrap()) } /// Construct a new client with an existing `reqwest::Client`, /// allowing more control over its configuration. /// /// `baseurl` is the base URL provided to the internal /// `reqwest::Client`, and should include a scheme and hostname, /// as well as port and a path stem if applicable. pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self { Self { baseurl: baseurl.to_string(), client, } } /// Get the base URL to which requests are made. pub fn baseurl(&self) -> &String { &self.baseurl } /// Get the internal `reqwest::Client` used to make requests. pub fn client(&self) -> &reqwest::Client { &self.client } /// Get the version of this API. /// /// This string is pulled directly from the source OpenAPI /// document and may be in any format the API selects. pub fn api_version(&self) -> &'static str { "0.0.1" } } impl Client { ///Fetch a disk by id /// ///Use `GET /v1/disks/{disk}` instead /// ///Sends a `GET` request to `/by-id/disks/{id}` /// ///```ignore /// let response = client.disk_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn disk_view_by_id(&self) -> builder::DiskViewById { builder::DiskViewById::new(self) } ///Fetch an image by id /// ///Sends a `GET` request to `/by-id/images/{id}` /// ///```ignore /// let response = client.image_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn image_view_by_id(&self) -> builder::ImageViewById { builder::ImageViewById::new(self) } ///Fetch an instance by id /// ///Sends a `GET` request to `/by-id/instances/{id}` /// ///```ignore /// let response = client.instance_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn instance_view_by_id(&self) -> builder::InstanceViewById { builder::InstanceViewById::new(self) } ///Fetch a network interface by id /// ///Sends a `GET` request to `/by-id/network-interfaces/{id}` /// ///```ignore /// let response = client.instance_network_interface_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn instance_network_interface_view_by_id( &self, ) -> builder::InstanceNetworkInterfaceViewById { builder::InstanceNetworkInterfaceViewById::new(self) } ///Fetch an organization by id /// ///Use `GET /v1/organizations/{organization}` instead /// ///Sends a `GET` request to `/by-id/organizations/{id}` /// ///```ignore /// let response = client.organization_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn organization_view_by_id(&self) -> builder::OrganizationViewById { builder::OrganizationViewById::new(self) } ///Fetch a project by id /// ///Use `GET /v1/projects/{project}` instead /// ///Sends a `GET` request to `/by-id/projects/{id}` /// ///```ignore /// let response = client.project_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn project_view_by_id(&self) -> builder::ProjectViewById { builder::ProjectViewById::new(self) } ///Fetch a snapshot by id /// ///Sends a `GET` request to `/by-id/snapshots/{id}` /// ///```ignore /// let response = client.snapshot_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn snapshot_view_by_id(&self) -> builder::SnapshotViewById { builder::SnapshotViewById::new(self) } ///Fetch a route by id /// ///Sends a `GET` request to `/by-id/vpc-router-routes/{id}` /// ///```ignore /// let response = client.vpc_router_route_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn vpc_router_route_view_by_id(&self) -> builder::VpcRouterRouteViewById { builder::VpcRouterRouteViewById::new(self) } ///Get a router by id /// ///Sends a `GET` request to `/by-id/vpc-routers/{id}` /// ///```ignore /// let response = client.vpc_router_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn vpc_router_view_by_id(&self) -> builder::VpcRouterViewById { builder::VpcRouterViewById::new(self) } ///Fetch a subnet by id /// ///Sends a `GET` request to `/by-id/vpc-subnets/{id}` /// ///```ignore /// let response = client.vpc_subnet_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn vpc_subnet_view_by_id(&self) -> builder::VpcSubnetViewById { builder::VpcSubnetViewById::new(self) } ///Fetch a VPC /// ///Sends a `GET` request to `/by-id/vpcs/{id}` /// ///```ignore /// let response = client.vpc_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn vpc_view_by_id(&self) -> builder::VpcViewById { builder::VpcViewById::new(self) } ///Start an OAuth 2.0 Device Authorization Grant /// ///This endpoint is designed to be accessed from an *unauthenticated* API /// client. It generates and records a `device_code` and `user_code` which /// must be verified and confirmed prior to a token being granted. /// ///Sends a `POST` request to `/device/auth` /// ///```ignore /// let response = client.device_auth_request() /// .body(body) /// .send() /// .await; /// ``` pub fn device_auth_request(&self) -> builder::DeviceAuthRequest { builder::DeviceAuthRequest::new(self) } ///Confirm an OAuth 2.0 Device Authorization Grant /// ///This endpoint is designed to be accessed by the user agent (browser), /// not the client requesting the token. So we do not actually return the /// token here; it will be returned in response to the poll on /// `/device/token`. /// ///Sends a `POST` request to `/device/confirm` /// ///```ignore /// let response = client.device_auth_confirm() /// .body(body) /// .send() /// .await; /// ``` pub fn device_auth_confirm(&self) -> builder::DeviceAuthConfirm { builder::DeviceAuthConfirm::new(self) } ///Request a device access token /// ///This endpoint should be polled by the client until the user code is /// verified and the grant is confirmed. /// ///Sends a `POST` request to `/device/token` /// ///```ignore /// let response = client.device_access_token() /// .body(body) /// .send() /// .await; /// ``` pub fn device_access_token(&self) -> builder::DeviceAccessToken { builder::DeviceAccessToken::new(self) } ///List groups /// ///Sends a `GET` request to `/groups` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.group_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn group_list(&self) -> builder::GroupList { builder::GroupList::new(self) } ///Sends a `POST` request to `/login` /// ///```ignore /// let response = client.login_spoof() /// .body(body) /// .send() /// .await; /// ``` pub fn login_spoof(&self) -> builder::LoginSpoof { builder::LoginSpoof::new(self) } ///Authenticate a user (i.e., log in) via username and password /// ///Sends a `POST` request to `/login/{silo_name}/local` /// ///```ignore /// let response = client.login_local() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` pub fn login_local(&self) -> builder::LoginLocal { builder::LoginLocal::new(self) } ///Prompt user login /// ///Either display a page asking a user for their credentials, or redirect /// them to their identity provider. /// ///Sends a `GET` request to `/login/{silo_name}/saml/{provider_name}` /// ///```ignore /// let response = client.login_saml_begin() /// .silo_name(silo_name) /// .provider_name(provider_name) /// .send() /// .await; /// ``` pub fn login_saml_begin(&self) -> builder::LoginSamlBegin { builder::LoginSamlBegin::new(self) } ///Authenticate a user (i.e., log in) via SAML /// ///Sends a `POST` request to `/login/{silo_name}/saml/{provider_name}` /// ///```ignore /// let response = client.login_saml() /// .silo_name(silo_name) /// .provider_name(provider_name) /// .body(body) /// .send() /// .await; /// ``` pub fn login_saml(&self) -> builder::LoginSaml { builder::LoginSaml::new(self) } ///Sends a `POST` request to `/logout` /// ///```ignore /// let response = client.logout() /// .send() /// .await; /// ``` pub fn logout(&self) -> builder::Logout { builder::Logout::new(self) } ///List organizations /// ///Use `GET /v1/organizations` instead /// ///Sends a `GET` request to `/organizations` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.organization_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn organization_list(&self) -> builder::OrganizationList { builder::OrganizationList::new(self) } ///Create an organization /// ///Use `POST /v1/organizations` instead /// ///Sends a `POST` request to `/organizations` /// ///```ignore /// let response = client.organization_create() /// .body(body) /// .send() /// .await; /// ``` pub fn organization_create(&self) -> builder::OrganizationCreate { builder::OrganizationCreate::new(self) } ///Fetch an organization /// ///Use `GET /v1/organizations/{organization}` instead /// ///Sends a `GET` request to `/organizations/{organization_name}` /// ///Arguments: /// - `organization_name`: The organization's unique name. ///```ignore /// let response = client.organization_view() /// .organization_name(organization_name) /// .send() /// .await; /// ``` pub fn organization_view(&self) -> builder::OrganizationView { builder::OrganizationView::new(self) } ///Update an organization /// ///Use `PUT /v1/organizations/{organization}` instead /// ///Sends a `PUT` request to `/organizations/{organization_name}` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `body` ///```ignore /// let response = client.organization_update() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` pub fn organization_update(&self) -> builder::OrganizationUpdate { builder::OrganizationUpdate::new(self) } ///Delete an organization /// ///Use `DELETE /v1/organizations/{organization}` instead /// ///Sends a `DELETE` request to `/organizations/{organization_name}` /// ///Arguments: /// - `organization_name`: The organization's unique name. ///```ignore /// let response = client.organization_delete() /// .organization_name(organization_name) /// .send() /// .await; /// ``` pub fn organization_delete(&self) -> builder::OrganizationDelete { builder::OrganizationDelete::new(self) } ///Fetch an organization's IAM policy /// ///Use `GET /v1/organizations/{organization}/policy` instead /// ///Sends a `GET` request to `/organizations/{organization_name}/policy` /// ///Arguments: /// - `organization_name`: The organization's unique name. ///```ignore /// let response = client.organization_policy_view() /// .organization_name(organization_name) /// .send() /// .await; /// ``` pub fn organization_policy_view(&self) -> builder::OrganizationPolicyView { builder::OrganizationPolicyView::new(self) } ///Update an organization's IAM policy /// ///Use `PUT /v1/organizations/{organization}/policy` instead /// ///Sends a `PUT` request to `/organizations/{organization_name}/policy` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `body` ///```ignore /// let response = client.organization_policy_update() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` pub fn organization_policy_update(&self) -> builder::OrganizationPolicyUpdate { builder::OrganizationPolicyUpdate::new(self) } ///List projects /// ///Use `GET /v1/projects` instead /// ///Sends a `GET` request to `/organizations/{organization_name}/projects` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.project_list() /// .organization_name(organization_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn project_list(&self) -> builder::ProjectList { builder::ProjectList::new(self) } ///Create a project /// ///Use `POST /v1/projects` instead /// ///Sends a `POST` request to `/organizations/{organization_name}/projects` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `body` ///```ignore /// let response = client.project_create() /// .organization_name(organization_name) /// .body(body) /// .send() /// .await; /// ``` pub fn project_create(&self) -> builder::ProjectCreate { builder::ProjectCreate::new(self) } ///Fetch a project /// ///Use `GET /v1/projects/{project}` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. ///```ignore /// let response = client.project_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` pub fn project_view(&self) -> builder::ProjectView { builder::ProjectView::new(self) } ///Update a project /// ///Use `PUT /v1/projects/{project}` instead /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.project_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn project_update(&self) -> builder::ProjectUpdate { builder::ProjectUpdate::new(self) } ///Delete a project /// ///Use `DELETE /v1/projects/{project}` instead /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. ///```ignore /// let response = client.project_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` pub fn project_delete(&self) -> builder::ProjectDelete { builder::ProjectDelete::new(self) } ///List disks /// ///Use `GET /v1/disks` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.disk_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn disk_list(&self) -> builder::DiskList { builder::DiskList::new(self) } ///Use `POST /v1/disks` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/disks` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.disk_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn disk_create(&self) -> builder::DiskCreate { builder::DiskCreate::new(self) } ///Fetch a disk /// ///Use `GET /v1/disks/{disk}` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` /// ///```ignore /// let response = client.disk_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .send() /// .await; /// ``` pub fn disk_view(&self) -> builder::DiskView { builder::DiskView::new(self) } ///Use `DELETE /v1/disks/{disk}` instead /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` /// ///```ignore /// let response = client.disk_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .send() /// .await; /// ``` pub fn disk_delete(&self) -> builder::DiskDelete { builder::DiskDelete::new(self) } ///Fetch disk metrics /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}/metrics/{metric_name}` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `disk_name` /// - `metric_name` /// - `end_time`: An exclusive end time of metrics. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `start_time`: An inclusive start time of metrics. ///```ignore /// let response = client.disk_metrics_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .disk_name(disk_name) /// .metric_name(metric_name) /// .end_time(end_time) /// .limit(limit) /// .page_token(page_token) /// .start_time(start_time) /// .send() /// .await; /// ``` pub fn disk_metrics_list(&self) -> builder::DiskMetricsList { builder::DiskMetricsList::new(self) } ///List images /// ///List images in a project. The images are returned sorted by creation /// date, with the most recent images appearing first. /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.image_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn image_list(&self) -> builder::ImageList { builder::ImageList::new(self) } ///Create an image /// ///Create a new image in a project. /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/images` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.image_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn image_create(&self) -> builder::ImageCreate { builder::ImageCreate::new(self) } ///Fetch an image /// ///Fetch the details for a specific image in a project. /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` /// ///```ignore /// let response = client.image_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .image_name(image_name) /// .send() /// .await; /// ``` pub fn image_view(&self) -> builder::ImageView { builder::ImageView::new(self) } ///Delete an image /// ///Permanently delete an image from a project. This operation cannot be /// undone. Any instances in the project using the image will continue to /// run, however new instances can not be created with this image. /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` /// ///```ignore /// let response = client.image_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .image_name(image_name) /// .send() /// .await; /// ``` pub fn image_delete(&self) -> builder::ImageDelete { builder::ImageDelete::new(self) } ///List instances /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.instance_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn instance_list(&self) -> builder::InstanceList { builder::InstanceList::new(self) } ///Create an instance /// ///Use `POST /v1/instances` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.instance_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_create(&self) -> builder::InstanceCreate { builder::InstanceCreate::new(self) } ///Fetch an instance /// ///Use `GET /v1/instances/{instance}` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` /// ///```ignore /// let response = client.instance_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_view(&self) -> builder::InstanceView { builder::InstanceView::new(self) } ///Delete an instance /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}` /// ///```ignore /// let response = client.instance_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_delete(&self) -> builder::InstanceDelete { builder::InstanceDelete::new(self) } ///List an instance's disks /// ///Use `GET /v1/instances/{instance}/disks` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.instance_disk_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn instance_disk_list(&self) -> builder::InstanceDiskList { builder::InstanceDiskList::new(self) } ///Attach a disk to an instance /// ///Use `POST /v1/instances/{instance}/disks/attach` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/attach` /// ///```ignore /// let response = client.instance_disk_attach() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_disk_attach(&self) -> builder::InstanceDiskAttach { builder::InstanceDiskAttach::new(self) } ///Detach a disk from an instance /// ///Use `POST /v1/disks/{disk}/detach` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/disks/detach` /// ///```ignore /// let response = client.instance_disk_detach() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_disk_detach(&self) -> builder::InstanceDiskDetach { builder::InstanceDiskDetach::new(self) } ///List external IP addresses /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/external-ips` /// ///```ignore /// let response = client.instance_external_ip_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_external_ip_list(&self) -> builder::InstanceExternalIpList { builder::InstanceExternalIpList::new(self) } ///Migrate an instance /// ///Use `POST /v1/instances/{instance}/migrate` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/migrate` /// ///```ignore /// let response = client.instance_migrate() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_migrate(&self) -> builder::InstanceMigrate { builder::InstanceMigrate::new(self) } ///List network interfaces /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `instance_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.instance_network_interface_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn instance_network_interface_list(&self) -> builder::InstanceNetworkInterfaceList { builder::InstanceNetworkInterfaceList::new(self) } ///Create a network interface /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces` /// ///```ignore /// let response = client.instance_network_interface_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_network_interface_create(&self) -> builder::InstanceNetworkInterfaceCreate { builder::InstanceNetworkInterfaceCreate::new(self) } ///Fetch a network interface /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` /// ///```ignore /// let response = client.instance_network_interface_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .interface_name(interface_name) /// .send() /// .await; /// ``` pub fn instance_network_interface_view(&self) -> builder::InstanceNetworkInterfaceView { builder::InstanceNetworkInterfaceView::new(self) } ///Update a network interface /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` /// ///```ignore /// let response = client.instance_network_interface_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .interface_name(interface_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_network_interface_update(&self) -> builder::InstanceNetworkInterfaceUpdate { builder::InstanceNetworkInterfaceUpdate::new(self) } ///Delete a network interface /// ///Note that the primary interface for an instance cannot be deleted if /// there are any secondary interfaces. A new primary interface must be /// designated first. The primary interface can be deleted if there are no /// secondary interfaces. /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` /// ///```ignore /// let response = client.instance_network_interface_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .interface_name(interface_name) /// .send() /// .await; /// ``` pub fn instance_network_interface_delete(&self) -> builder::InstanceNetworkInterfaceDelete { builder::InstanceNetworkInterfaceDelete::new(self) } ///Reboot an instance /// ///Use `POST /v1/instances/{instance}/reboot` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/reboot` /// ///```ignore /// let response = client.instance_reboot() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_reboot(&self) -> builder::InstanceReboot { builder::InstanceReboot::new(self) } ///Fetch an instance's serial console /// ///Use `GET /v1/instances/{instance}/serial-console` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/serial-console` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `instance_name` /// - `from_start`: Character index in the serial buffer from which to read, /// counting the bytes output since instance start. If this is not /// provided, `most_recent` must be provided, and if this *is* provided, /// `most_recent` must *not* be provided. /// - `max_bytes`: Maximum number of bytes of buffered serial console /// contents to return. If the requested range runs to the end of the /// available buffer, the data returned will be shorter than `max_bytes`. /// - `most_recent`: Character index in the serial buffer from which to /// read, counting *backward* from the most recently buffered data /// retrieved from the instance. (See note on `from_start` about mutual /// exclusivity) ///```ignore /// let response = client.instance_serial_console() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .from_start(from_start) /// .max_bytes(max_bytes) /// .most_recent(most_recent) /// .send() /// .await; /// ``` pub fn instance_serial_console(&self) -> builder::InstanceSerialConsole { builder::InstanceSerialConsole::new(self) } ///Connect to an instance's serial console /// ///Use `GET /v1/instances/{instance}/serial-console/stream` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/serial-console/stream` /// ///```ignore /// let response = client.instance_serial_console_stream() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_serial_console_stream(&self) -> builder::InstanceSerialConsoleStream { builder::InstanceSerialConsoleStream::new(self) } ///Boot an instance /// ///Use `POST /v1/instances/{instance}/start` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/start` /// ///```ignore /// let response = client.instance_start() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_start(&self) -> builder::InstanceStart { builder::InstanceStart::new(self) } ///Halt an instance /// ///Use `POST /v1/instances/{instance}/stop` instead /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/stop` /// ///```ignore /// let response = client.instance_stop() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .send() /// .await; /// ``` pub fn instance_stop(&self) -> builder::InstanceStop { builder::InstanceStop::new(self) } ///Fetch a project's IAM policy /// ///Use `GET /v1/projects/{project}/policy` instead /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/policy` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. ///```ignore /// let response = client.project_policy_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .send() /// .await; /// ``` pub fn project_policy_view(&self) -> builder::ProjectPolicyView { builder::ProjectPolicyView::new(self) } ///Update a project's IAM policy /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/policy` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.project_policy_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn project_policy_update(&self) -> builder::ProjectPolicyUpdate { builder::ProjectPolicyUpdate::new(self) } ///List snapshots /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.snapshot_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn snapshot_list(&self) -> builder::SnapshotList { builder::SnapshotList::new(self) } ///Create a snapshot /// ///Creates a point-in-time snapshot from a disk. /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.snapshot_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn snapshot_create(&self) -> builder::SnapshotCreate { builder::SnapshotCreate::new(self) } ///Fetch a snapshot /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` /// ///```ignore /// let response = client.snapshot_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .snapshot_name(snapshot_name) /// .send() /// .await; /// ``` pub fn snapshot_view(&self) -> builder::SnapshotView { builder::SnapshotView::new(self) } ///Delete a snapshot /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/snapshots/ /// {snapshot_name}` /// ///```ignore /// let response = client.snapshot_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .snapshot_name(snapshot_name) /// .send() /// .await; /// ``` pub fn snapshot_delete(&self) -> builder::SnapshotDelete { builder::SnapshotDelete::new(self) } ///List VPCs /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.vpc_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_list(&self) -> builder::VpcList { builder::VpcList::new(self) } ///Create a VPC /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` /// ///Arguments: /// - `organization_name`: The organization's unique name. /// - `project_name`: The project's unique name within the organization. /// - `body` ///```ignore /// let response = client.vpc_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_create(&self) -> builder::VpcCreate { builder::VpcCreate::new(self) } ///Fetch a VPC /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` /// ///```ignore /// let response = client.vpc_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` pub fn vpc_view(&self) -> builder::VpcView { builder::VpcView::new(self) } ///Update a VPC /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` /// ///```ignore /// let response = client.vpc_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_update(&self) -> builder::VpcUpdate { builder::VpcUpdate::new(self) } ///Delete a VPC /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` /// ///```ignore /// let response = client.vpc_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` pub fn vpc_delete(&self) -> builder::VpcDelete { builder::VpcDelete::new(self) } ///List firewall rules /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` /// ///```ignore /// let response = client.vpc_firewall_rules_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` pub fn vpc_firewall_rules_view(&self) -> builder::VpcFirewallRulesView { builder::VpcFirewallRulesView::new(self) } ///Replace firewall rules /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` /// ///```ignore /// let response = client.vpc_firewall_rules_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_firewall_rules_update(&self) -> builder::VpcFirewallRulesUpdate { builder::VpcFirewallRulesUpdate::new(self) } ///List routers /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.vpc_router_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_router_list(&self) -> builder::VpcRouterList { builder::VpcRouterList::new(self) } ///Create a router /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` /// ///```ignore /// let response = client.vpc_router_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_create(&self) -> builder::VpcRouterCreate { builder::VpcRouterCreate::new(self) } ///Get a router /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` /// ///```ignore /// let response = client.vpc_router_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .send() /// .await; /// ``` pub fn vpc_router_view(&self) -> builder::VpcRouterView { builder::VpcRouterView::new(self) } ///Update a router /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` /// ///```ignore /// let response = client.vpc_router_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_update(&self) -> builder::VpcRouterUpdate { builder::VpcRouterUpdate::new(self) } ///Delete a router /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` /// ///```ignore /// let response = client.vpc_router_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .send() /// .await; /// ``` pub fn vpc_router_delete(&self) -> builder::VpcRouterDelete { builder::VpcRouterDelete::new(self) } ///List routes /// ///List the routes associated with a router in a particular VPC. /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `router_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.vpc_router_route_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_router_route_list(&self) -> builder::VpcRouterRouteList { builder::VpcRouterRouteList::new(self) } ///Create a router /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` /// ///```ignore /// let response = client.vpc_router_route_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_route_create(&self) -> builder::VpcRouterRouteCreate { builder::VpcRouterRouteCreate::new(self) } ///Fetch a route /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` /// ///```ignore /// let response = client.vpc_router_route_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .route_name(route_name) /// .send() /// .await; /// ``` pub fn vpc_router_route_view(&self) -> builder::VpcRouterRouteView { builder::VpcRouterRouteView::new(self) } ///Update a route /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` /// ///```ignore /// let response = client.vpc_router_route_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .route_name(route_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_route_update(&self) -> builder::VpcRouterRouteUpdate { builder::VpcRouterRouteUpdate::new(self) } ///Delete a route /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` /// ///```ignore /// let response = client.vpc_router_route_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .route_name(route_name) /// .send() /// .await; /// ``` pub fn vpc_router_route_delete(&self) -> builder::VpcRouterRouteDelete { builder::VpcRouterRouteDelete::new(self) } ///List subnets /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.vpc_subnet_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_subnet_list(&self) -> builder::VpcSubnetList { builder::VpcSubnetList::new(self) } ///Create a subnet /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` /// ///```ignore /// let response = client.vpc_subnet_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_subnet_create(&self) -> builder::VpcSubnetCreate { builder::VpcSubnetCreate::new(self) } ///Fetch a subnet /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` /// ///```ignore /// let response = client.vpc_subnet_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .send() /// .await; /// ``` pub fn vpc_subnet_view(&self) -> builder::VpcSubnetView { builder::VpcSubnetView::new(self) } ///Update a subnet /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` /// ///```ignore /// let response = client.vpc_subnet_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_subnet_update(&self) -> builder::VpcSubnetUpdate { builder::VpcSubnetUpdate::new(self) } ///Delete a subnet /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` /// ///```ignore /// let response = client.vpc_subnet_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .send() /// .await; /// ``` pub fn vpc_subnet_delete(&self) -> builder::VpcSubnetDelete { builder::VpcSubnetDelete::new(self) } ///List network interfaces /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}/network-interfaces` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `subnet_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.vpc_subnet_list_network_interfaces() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_subnet_list_network_interfaces(&self) -> builder::VpcSubnetListNetworkInterfaces { builder::VpcSubnetListNetworkInterfaces::new(self) } ///Fetch the current silo's IAM policy /// ///Sends a `GET` request to `/policy` /// ///```ignore /// let response = client.policy_view() /// .send() /// .await; /// ``` pub fn policy_view(&self) -> builder::PolicyView { builder::PolicyView::new(self) } ///Update the current silo's IAM policy /// ///Sends a `PUT` request to `/policy` /// ///```ignore /// let response = client.policy_update() /// .body(body) /// .send() /// .await; /// ``` pub fn policy_update(&self) -> builder::PolicyUpdate { builder::PolicyUpdate::new(self) } ///List built-in roles /// ///Sends a `GET` request to `/roles` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page ///```ignore /// let response = client.role_list() /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` pub fn role_list(&self) -> builder::RoleList { builder::RoleList::new(self) } ///Fetch a built-in role /// ///Sends a `GET` request to `/roles/{role_name}` /// ///Arguments: /// - `role_name`: The built-in role's unique name. ///```ignore /// let response = client.role_view() /// .role_name(role_name) /// .send() /// .await; /// ``` pub fn role_view(&self) -> builder::RoleView { builder::RoleView::new(self) } ///Fetch the user associated with the current session /// ///Sends a `GET` request to `/session/me` /// ///```ignore /// let response = client.session_me() /// .send() /// .await; /// ``` pub fn session_me(&self) -> builder::SessionMe { builder::SessionMe::new(self) } ///Fetch the siloย groups the current user belongs to /// ///Sends a `GET` request to `/session/me/groups` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.session_me_groups() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn session_me_groups(&self) -> builder::SessionMeGroups { builder::SessionMeGroups::new(self) } ///List SSH public keys /// ///Lists SSH public keys for the currently authenticated user. /// ///Sends a `GET` request to `/session/me/sshkeys` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.session_sshkey_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn session_sshkey_list(&self) -> builder::SessionSshkeyList { builder::SessionSshkeyList::new(self) } ///Create an SSH public key /// ///Create an SSH public key for the currently authenticated user. /// ///Sends a `POST` request to `/session/me/sshkeys` /// ///```ignore /// let response = client.session_sshkey_create() /// .body(body) /// .send() /// .await; /// ``` pub fn session_sshkey_create(&self) -> builder::SessionSshkeyCreate { builder::SessionSshkeyCreate::new(self) } ///Fetch an SSH public key /// ///Fetch an SSH public key associated with the currently authenticated /// user. /// ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` /// ///```ignore /// let response = client.session_sshkey_view() /// .ssh_key_name(ssh_key_name) /// .send() /// .await; /// ``` pub fn session_sshkey_view(&self) -> builder::SessionSshkeyView { builder::SessionSshkeyView::new(self) } ///Delete an SSH public key /// ///Delete an SSH public key associated with the currently authenticated /// user. /// ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` /// ///```ignore /// let response = client.session_sshkey_delete() /// .ssh_key_name(ssh_key_name) /// .send() /// .await; /// ``` pub fn session_sshkey_delete(&self) -> builder::SessionSshkeyDelete { builder::SessionSshkeyDelete::new(self) } ///Fetch a system-wide image by id /// ///Sends a `GET` request to `/system/by-id/images/{id}` /// ///```ignore /// let response = client.system_image_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn system_image_view_by_id(&self) -> builder::SystemImageViewById { builder::SystemImageViewById::new(self) } ///Fetch an IP pool by id /// ///Sends a `GET` request to `/system/by-id/ip-pools/{id}` /// ///```ignore /// let response = client.ip_pool_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn ip_pool_view_by_id(&self) -> builder::IpPoolViewById { builder::IpPoolViewById::new(self) } ///Fetch a silo by id /// ///Sends a `GET` request to `/system/by-id/silos/{id}` /// ///```ignore /// let response = client.silo_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn silo_view_by_id(&self) -> builder::SiloViewById { builder::SiloViewById::new(self) } ///List system-wide certificates /// ///Returns a list of all the system-wide certificates. System-wide /// certificates are returned sorted by creation date, with the most recent /// certificates appearing first. /// ///Sends a `GET` request to `/system/certificates` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.certificate_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn certificate_list(&self) -> builder::CertificateList { builder::CertificateList::new(self) } ///Create a new system-wide x.509 certificate /// ///This certificate is automatically used by the Oxide Control plane to /// serve external connections. /// ///Sends a `POST` request to `/system/certificates` /// ///```ignore /// let response = client.certificate_create() /// .body(body) /// .send() /// .await; /// ``` pub fn certificate_create(&self) -> builder::CertificateCreate { builder::CertificateCreate::new(self) } ///Fetch a certificate /// ///Returns the details of a specific certificate /// ///Sends a `GET` request to `/system/certificates/{certificate}` /// ///```ignore /// let response = client.certificate_view() /// .certificate(certificate) /// .send() /// .await; /// ``` pub fn certificate_view(&self) -> builder::CertificateView { builder::CertificateView::new(self) } ///Delete a certificate /// ///Permanently delete a certificate. This operation cannot be undone. /// ///Sends a `DELETE` request to `/system/certificates/{certificate}` /// ///```ignore /// let response = client.certificate_delete() /// .certificate(certificate) /// .send() /// .await; /// ``` pub fn certificate_delete(&self) -> builder::CertificateDelete { builder::CertificateDelete::new(self) } ///List physical disks /// ///Sends a `GET` request to `/system/hardware/disks` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.physical_disk_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn physical_disk_list(&self) -> builder::PhysicalDiskList { builder::PhysicalDiskList::new(self) } ///List racks /// ///Sends a `GET` request to `/system/hardware/racks` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.rack_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn rack_list(&self) -> builder::RackList { builder::RackList::new(self) } ///Fetch a rack /// ///Sends a `GET` request to `/system/hardware/racks/{rack_id}` /// ///Arguments: /// - `rack_id`: The rack's unique ID. ///```ignore /// let response = client.rack_view() /// .rack_id(rack_id) /// .send() /// .await; /// ``` pub fn rack_view(&self) -> builder::RackView { builder::RackView::new(self) } ///List sleds /// ///Sends a `GET` request to `/system/hardware/sleds` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.sled_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn sled_list(&self) -> builder::SledList { builder::SledList::new(self) } ///Fetch a sled /// ///Sends a `GET` request to `/system/hardware/sleds/{sled_id}` /// ///Arguments: /// - `sled_id`: The sled's unique ID. ///```ignore /// let response = client.sled_view() /// .sled_id(sled_id) /// .send() /// .await; /// ``` pub fn sled_view(&self) -> builder::SledView { builder::SledView::new(self) } ///List physical disks attached to sleds /// ///Sends a `GET` request to `/system/hardware/sleds/{sled_id}/disks` /// ///Arguments: /// - `sled_id`: The sled's unique ID. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.sled_physical_disk_list() /// .sled_id(sled_id) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn sled_physical_disk_list(&self) -> builder::SledPhysicalDiskList { builder::SledPhysicalDiskList::new(self) } ///List system-wide images /// ///Returns a list of all the system-wide images. System-wide images are /// returned sorted by creation date, with the most recent images appearing /// first. /// ///Sends a `GET` request to `/system/images` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.system_image_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn system_image_list(&self) -> builder::SystemImageList { builder::SystemImageList::new(self) } ///Create a system-wide image /// ///Create a new system-wide image. This image can then be used by any user /// in any silo as a base for instances. /// ///Sends a `POST` request to `/system/images` /// ///```ignore /// let response = client.system_image_create() /// .body(body) /// .send() /// .await; /// ``` pub fn system_image_create(&self) -> builder::SystemImageCreate { builder::SystemImageCreate::new(self) } ///Fetch a system-wide image /// ///Returns the details of a specific system-wide image. /// ///Sends a `GET` request to `/system/images/{image_name}` /// ///```ignore /// let response = client.system_image_view() /// .image_name(image_name) /// .send() /// .await; /// ``` pub fn system_image_view(&self) -> builder::SystemImageView { builder::SystemImageView::new(self) } ///Delete a system-wide image /// ///Permanently delete a system-wide image. This operation cannot be undone. /// Any instances using the system-wide image will continue to run, however /// new instances can not be created with this image. /// ///Sends a `DELETE` request to `/system/images/{image_name}` /// ///```ignore /// let response = client.system_image_delete() /// .image_name(image_name) /// .send() /// .await; /// ``` pub fn system_image_delete(&self) -> builder::SystemImageDelete { builder::SystemImageDelete::new(self) } ///List IP pools /// ///Sends a `GET` request to `/system/ip-pools` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.ip_pool_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn ip_pool_list(&self) -> builder::IpPoolList { builder::IpPoolList::new(self) } ///Create an IP pool /// ///Sends a `POST` request to `/system/ip-pools` /// ///```ignore /// let response = client.ip_pool_create() /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_create(&self) -> builder::IpPoolCreate { builder::IpPoolCreate::new(self) } ///Fetch an IP pool /// ///Sends a `GET` request to `/system/ip-pools/{pool_name}` /// ///```ignore /// let response = client.ip_pool_view() /// .pool_name(pool_name) /// .send() /// .await; /// ``` pub fn ip_pool_view(&self) -> builder::IpPoolView { builder::IpPoolView::new(self) } ///Update an IP Pool /// ///Sends a `PUT` request to `/system/ip-pools/{pool_name}` /// ///```ignore /// let response = client.ip_pool_update() /// .pool_name(pool_name) /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_update(&self) -> builder::IpPoolUpdate { builder::IpPoolUpdate::new(self) } ///Delete an IP Pool /// ///Sends a `DELETE` request to `/system/ip-pools/{pool_name}` /// ///```ignore /// let response = client.ip_pool_delete() /// .pool_name(pool_name) /// .send() /// .await; /// ``` pub fn ip_pool_delete(&self) -> builder::IpPoolDelete { builder::IpPoolDelete::new(self) } ///List ranges for an IP pool /// ///Ranges are ordered by their first address. /// ///Sends a `GET` request to `/system/ip-pools/{pool_name}/ranges` /// ///Arguments: /// - `pool_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page ///```ignore /// let response = client.ip_pool_range_list() /// .pool_name(pool_name) /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` pub fn ip_pool_range_list(&self) -> builder::IpPoolRangeList { builder::IpPoolRangeList::new(self) } ///Add a range to an IP pool /// ///Sends a `POST` request to `/system/ip-pools/{pool_name}/ranges/add` /// ///```ignore /// let response = client.ip_pool_range_add() /// .pool_name(pool_name) /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_range_add(&self) -> builder::IpPoolRangeAdd { builder::IpPoolRangeAdd::new(self) } ///Remove a range from an IP pool /// ///Sends a `POST` request to `/system/ip-pools/{pool_name}/ranges/remove` /// ///```ignore /// let response = client.ip_pool_range_remove() /// .pool_name(pool_name) /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_range_remove(&self) -> builder::IpPoolRangeRemove { builder::IpPoolRangeRemove::new(self) } ///Fetch the IP pool used for Oxide services /// ///Sends a `GET` request to `/system/ip-pools-service` /// ///```ignore /// let response = client.ip_pool_service_view() /// .send() /// .await; /// ``` pub fn ip_pool_service_view(&self) -> builder::IpPoolServiceView { builder::IpPoolServiceView::new(self) } ///List ranges for the IP pool used for Oxide services /// ///Ranges are ordered by their first address. /// ///Sends a `GET` request to `/system/ip-pools-service/ranges` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page ///```ignore /// let response = client.ip_pool_service_range_list() /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` pub fn ip_pool_service_range_list(&self) -> builder::IpPoolServiceRangeList { builder::IpPoolServiceRangeList::new(self) } ///Add a range to an IP pool used for Oxide services /// ///Sends a `POST` request to `/system/ip-pools-service/ranges/add` /// ///```ignore /// let response = client.ip_pool_service_range_add() /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_service_range_add(&self) -> builder::IpPoolServiceRangeAdd { builder::IpPoolServiceRangeAdd::new(self) } ///Remove a range from an IP pool used for Oxide services /// ///Sends a `POST` request to `/system/ip-pools-service/ranges/remove` /// ///```ignore /// let response = client.ip_pool_service_range_remove() /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_service_range_remove(&self) -> builder::IpPoolServiceRangeRemove { builder::IpPoolServiceRangeRemove::new(self) } ///Access metrics data /// ///Sends a `GET` request to `/system/metrics/{metric_name}` /// ///Arguments: /// - `metric_name` /// - `end_time`: An exclusive end time of metrics. /// - `id`: The UUID of the container being queried /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `start_time`: An inclusive start time of metrics. ///```ignore /// let response = client.system_metric() /// .metric_name(metric_name) /// .end_time(end_time) /// .id(id) /// .limit(limit) /// .page_token(page_token) /// .start_time(start_time) /// .send() /// .await; /// ``` pub fn system_metric(&self) -> builder::SystemMetric { builder::SystemMetric::new(self) } ///Fetch the top-level IAM policy /// ///Sends a `GET` request to `/system/policy` /// ///```ignore /// let response = client.system_policy_view() /// .send() /// .await; /// ``` pub fn system_policy_view(&self) -> builder::SystemPolicyView { builder::SystemPolicyView::new(self) } ///Update the top-level IAM policy /// ///Sends a `PUT` request to `/system/policy` /// ///```ignore /// let response = client.system_policy_update() /// .body(body) /// .send() /// .await; /// ``` pub fn system_policy_update(&self) -> builder::SystemPolicyUpdate { builder::SystemPolicyUpdate::new(self) } ///List sagas /// ///Sends a `GET` request to `/system/sagas` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.saga_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn saga_list(&self) -> builder::SagaList { builder::SagaList::new(self) } ///Fetch a saga /// ///Sends a `GET` request to `/system/sagas/{saga_id}` /// ///```ignore /// let response = client.saga_view() /// .saga_id(saga_id) /// .send() /// .await; /// ``` pub fn saga_view(&self) -> builder::SagaView { builder::SagaView::new(self) } ///List silos /// ///Lists silos that are discoverable based on the current permissions. /// ///Sends a `GET` request to `/system/silos` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.silo_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn silo_list(&self) -> builder::SiloList { builder::SiloList::new(self) } ///Create a silo /// ///Sends a `POST` request to `/system/silos` /// ///```ignore /// let response = client.silo_create() /// .body(body) /// .send() /// .await; /// ``` pub fn silo_create(&self) -> builder::SiloCreate { builder::SiloCreate::new(self) } ///Fetch a silo /// ///Fetch a silo by name. /// ///Sends a `GET` request to `/system/silos/{silo_name}` /// ///Arguments: /// - `silo_name`: The silo's unique name. ///```ignore /// let response = client.silo_view() /// .silo_name(silo_name) /// .send() /// .await; /// ``` pub fn silo_view(&self) -> builder::SiloView { builder::SiloView::new(self) } ///Delete a silo /// ///Delete a silo by name. /// ///Sends a `DELETE` request to `/system/silos/{silo_name}` /// ///Arguments: /// - `silo_name`: The silo's unique name. ///```ignore /// let response = client.silo_delete() /// .silo_name(silo_name) /// .send() /// .await; /// ``` pub fn silo_delete(&self) -> builder::SiloDelete { builder::SiloDelete::new(self) } ///List a silo's IDPs /// ///Sends a `GET` request to `/system/silos/{silo_name}/identity-providers` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.silo_identity_provider_list() /// .silo_name(silo_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn silo_identity_provider_list(&self) -> builder::SiloIdentityProviderList { builder::SiloIdentityProviderList::new(self) } ///Create a user /// ///Users can only be created in Silos with `provision_type` == `Fixed`. /// Otherwise, Silo users are just-in-time (JIT) provisioned when a user /// first logs in using an external Identity Provider. /// ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/local/users` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `body` ///```ignore /// let response = client.local_idp_user_create() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` pub fn local_idp_user_create(&self) -> builder::LocalIdpUserCreate { builder::LocalIdpUserCreate::new(self) } ///Delete a user /// ///Sends a `DELETE` request to /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `user_id`: The user's internal id ///```ignore /// let response = client.local_idp_user_delete() /// .silo_name(silo_name) /// .user_id(user_id) /// .send() /// .await; /// ``` pub fn local_idp_user_delete(&self) -> builder::LocalIdpUserDelete { builder::LocalIdpUserDelete::new(self) } ///Set or invalidate a user's password /// ///Passwords can only be updated for users in Silos with identity mode /// `LocalOnly`. /// ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}/ /// set-password` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `user_id`: The user's internal id /// - `body` ///```ignore /// let response = client.local_idp_user_set_password() /// .silo_name(silo_name) /// .user_id(user_id) /// .body(body) /// .send() /// .await; /// ``` pub fn local_idp_user_set_password(&self) -> builder::LocalIdpUserSetPassword { builder::LocalIdpUserSetPassword::new(self) } ///Create a SAML IDP /// ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/saml` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `body` ///```ignore /// let response = client.saml_identity_provider_create() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` pub fn saml_identity_provider_create(&self) -> builder::SamlIdentityProviderCreate { builder::SamlIdentityProviderCreate::new(self) } ///Fetch a SAML IDP /// ///Sends a `GET` request to /// `/system/silos/{silo_name}/identity-providers/saml/{provider_name}` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `provider_name`: The SAML identity provider's name ///```ignore /// let response = client.saml_identity_provider_view() /// .silo_name(silo_name) /// .provider_name(provider_name) /// .send() /// .await; /// ``` pub fn saml_identity_provider_view(&self) -> builder::SamlIdentityProviderView { builder::SamlIdentityProviderView::new(self) } ///Fetch a silo's IAM policy /// ///Sends a `GET` request to `/system/silos/{silo_name}/policy` /// ///Arguments: /// - `silo_name`: The silo's unique name. ///```ignore /// let response = client.silo_policy_view() /// .silo_name(silo_name) /// .send() /// .await; /// ``` pub fn silo_policy_view(&self) -> builder::SiloPolicyView { builder::SiloPolicyView::new(self) } ///Update a silo's IAM policy /// ///Sends a `PUT` request to `/system/silos/{silo_name}/policy` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `body` ///```ignore /// let response = client.silo_policy_update() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` pub fn silo_policy_update(&self) -> builder::SiloPolicyUpdate { builder::SiloPolicyUpdate::new(self) } ///List users in a silo /// ///Sends a `GET` request to `/system/silos/{silo_name}/users/all` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.silo_users_list() /// .silo_name(silo_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn silo_users_list(&self) -> builder::SiloUsersList { builder::SiloUsersList::new(self) } ///Fetch a user /// ///Sends a `GET` request to `/system/silos/{silo_name}/users/id/{user_id}` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `user_id`: The user's internal id ///```ignore /// let response = client.silo_user_view() /// .silo_name(silo_name) /// .user_id(user_id) /// .send() /// .await; /// ``` pub fn silo_user_view(&self) -> builder::SiloUserView { builder::SiloUserView::new(self) } ///List built-in users /// ///Sends a `GET` request to `/system/user` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.system_user_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn system_user_list(&self) -> builder::SystemUserList { builder::SystemUserList::new(self) } ///Fetch a built-in user /// ///Sends a `GET` request to `/system/user/{user_name}` /// ///Arguments: /// - `user_name`: The built-in user's unique name. ///```ignore /// let response = client.system_user_view() /// .user_name(user_name) /// .send() /// .await; /// ``` pub fn system_user_view(&self) -> builder::SystemUserView { builder::SystemUserView::new(self) } ///List timeseries schema /// ///Sends a `GET` request to `/timeseries/schema` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page ///```ignore /// let response = client.timeseries_schema_get() /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` pub fn timeseries_schema_get(&self) -> builder::TimeseriesSchemaGet { builder::TimeseriesSchemaGet::new(self) } ///List users /// ///Sends a `GET` request to `/users` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.user_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn user_list(&self) -> builder::UserList { builder::UserList::new(self) } ///List disks /// ///Sends a `GET` request to `/v1/disks` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `organization` /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `project` /// - `sort_by` ///```ignore /// let response = client.disk_list_v1() /// .limit(limit) /// .organization(organization) /// .page_token(page_token) /// .project(project) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn disk_list_v1(&self) -> builder::DiskListV1 { builder::DiskListV1::new(self) } ///Create a disk /// ///Sends a `POST` request to `/v1/disks` /// ///```ignore /// let response = client.disk_create_v1() /// .organization(organization) /// .project(project) /// .body(body) /// .send() /// .await; /// ``` pub fn disk_create_v1(&self) -> builder::DiskCreateV1 { builder::DiskCreateV1::new(self) } ///Fetch a disk /// ///Sends a `GET` request to `/v1/disks/{disk}` /// ///```ignore /// let response = client.disk_view_v1() /// .disk(disk) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn disk_view_v1(&self) -> builder::DiskViewV1 { builder::DiskViewV1::new(self) } ///Delete a disk /// ///Sends a `DELETE` request to `/v1/disks/{disk}` /// ///```ignore /// let response = client.disk_delete_v1() /// .disk(disk) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn disk_delete_v1(&self) -> builder::DiskDeleteV1 { builder::DiskDeleteV1::new(self) } ///List instances /// ///Sends a `GET` request to `/v1/instances` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `organization` /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `project` /// - `sort_by` ///```ignore /// let response = client.instance_list_v1() /// .limit(limit) /// .organization(organization) /// .page_token(page_token) /// .project(project) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn instance_list_v1(&self) -> builder::InstanceListV1 { builder::InstanceListV1::new(self) } ///Create an instance /// ///Sends a `POST` request to `/v1/instances` /// ///```ignore /// let response = client.instance_create_v1() /// .organization(organization) /// .project(project) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_create_v1(&self) -> builder::InstanceCreateV1 { builder::InstanceCreateV1::new(self) } ///Fetch an instance /// ///Sends a `GET` request to `/v1/instances/{instance}` /// ///```ignore /// let response = client.instance_view_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_view_v1(&self) -> builder::InstanceViewV1 { builder::InstanceViewV1::new(self) } ///Delete an instance /// ///Sends a `DELETE` request to `/v1/instances/{instance}` /// ///```ignore /// let response = client.instance_delete_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_delete_v1(&self) -> builder::InstanceDeleteV1 { builder::InstanceDeleteV1::new(self) } ///List an instance's disks /// ///Sends a `GET` request to `/v1/instances/{instance}/disks` /// ///Arguments: /// - `instance` /// - `limit`: Maximum number of items returned by a single call /// - `organization` /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `project` /// - `sort_by` ///```ignore /// let response = client.instance_disk_list_v1() /// .instance(instance) /// .limit(limit) /// .organization(organization) /// .page_token(page_token) /// .project(project) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn instance_disk_list_v1(&self) -> builder::InstanceDiskListV1 { builder::InstanceDiskListV1::new(self) } ///Attach a disk to an instance /// ///Sends a `POST` request to `/v1/instances/{instance}/disks/attach` /// ///```ignore /// let response = client.instance_disk_attach_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_disk_attach_v1(&self) -> builder::InstanceDiskAttachV1 { builder::InstanceDiskAttachV1::new(self) } ///Detach a disk from an instance /// ///Sends a `POST` request to `/v1/instances/{instance}/disks/detach` /// ///```ignore /// let response = client.instance_disk_detach_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_disk_detach_v1(&self) -> builder::InstanceDiskDetachV1 { builder::InstanceDiskDetachV1::new(self) } ///Migrate an instance /// ///Sends a `POST` request to `/v1/instances/{instance}/migrate` /// ///```ignore /// let response = client.instance_migrate_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_migrate_v1(&self) -> builder::InstanceMigrateV1 { builder::InstanceMigrateV1::new(self) } ///Reboot an instance /// ///Sends a `POST` request to `/v1/instances/{instance}/reboot` /// ///```ignore /// let response = client.instance_reboot_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_reboot_v1(&self) -> builder::InstanceRebootV1 { builder::InstanceRebootV1::new(self) } ///Fetch an instance's serial console /// ///Sends a `GET` request to `/v1/instances/{instance}/serial-console` /// ///Arguments: /// - `instance` /// - `from_start`: Character index in the serial buffer from which to read, /// counting the bytes output since instance start. If this is not /// provided, `most_recent` must be provided, and if this *is* provided, /// `most_recent` must *not* be provided. /// - `max_bytes`: Maximum number of bytes of buffered serial console /// contents to return. If the requested range runs to the end of the /// available buffer, the data returned will be shorter than `max_bytes`. /// - `most_recent`: Character index in the serial buffer from which to /// read, counting *backward* from the most recently buffered data /// retrieved from the instance. (See note on `from_start` about mutual /// exclusivity) /// - `organization` /// - `project` ///```ignore /// let response = client.instance_serial_console_v1() /// .instance(instance) /// .from_start(from_start) /// .max_bytes(max_bytes) /// .most_recent(most_recent) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_serial_console_v1(&self) -> builder::InstanceSerialConsoleV1 { builder::InstanceSerialConsoleV1::new(self) } ///Stream an instance's serial console /// ///Sends a `GET` request to /// `/v1/instances/{instance}/serial-console/stream` /// ///```ignore /// let response = client.instance_serial_console_stream_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_serial_console_stream_v1(&self) -> builder::InstanceSerialConsoleStreamV1 { builder::InstanceSerialConsoleStreamV1::new(self) } ///Boot an instance /// ///Sends a `POST` request to `/v1/instances/{instance}/start` /// ///```ignore /// let response = client.instance_start_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_start_v1(&self) -> builder::InstanceStartV1 { builder::InstanceStartV1::new(self) } ///Stop an instance /// ///Sends a `POST` request to `/v1/instances/{instance}/stop` /// ///```ignore /// let response = client.instance_stop_v1() /// .instance(instance) /// .organization(organization) /// .project(project) /// .send() /// .await; /// ``` pub fn instance_stop_v1(&self) -> builder::InstanceStopV1 { builder::InstanceStopV1::new(self) } ///List organizations /// ///Sends a `GET` request to `/v1/organizations` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.organization_list_v1() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn organization_list_v1(&self) -> builder::OrganizationListV1 { builder::OrganizationListV1::new(self) } ///Create an organization /// ///Sends a `POST` request to `/v1/organizations` /// ///```ignore /// let response = client.organization_create_v1() /// .body(body) /// .send() /// .await; /// ``` pub fn organization_create_v1(&self) -> builder::OrganizationCreateV1 { builder::OrganizationCreateV1::new(self) } ///Fetch an organization /// ///Sends a `GET` request to `/v1/organizations/{organization}` /// ///```ignore /// let response = client.organization_view_v1() /// .organization(organization) /// .send() /// .await; /// ``` pub fn organization_view_v1(&self) -> builder::OrganizationViewV1 { builder::OrganizationViewV1::new(self) } ///Update an organization /// ///Sends a `PUT` request to `/v1/organizations/{organization}` /// ///```ignore /// let response = client.organization_update_v1() /// .organization(organization) /// .body(body) /// .send() /// .await; /// ``` pub fn organization_update_v1(&self) -> builder::OrganizationUpdateV1 { builder::OrganizationUpdateV1::new(self) } ///Delete an organization /// ///Sends a `DELETE` request to `/v1/organizations/{organization}` /// ///```ignore /// let response = client.organization_delete_v1() /// .organization(organization) /// .send() /// .await; /// ``` pub fn organization_delete_v1(&self) -> builder::OrganizationDeleteV1 { builder::OrganizationDeleteV1::new(self) } ///Fetch an organization's IAM policy /// ///Sends a `GET` request to `/v1/organizations/{organization}/policy` /// ///```ignore /// let response = client.organization_policy_view_v1() /// .organization(organization) /// .send() /// .await; /// ``` pub fn organization_policy_view_v1(&self) -> builder::OrganizationPolicyViewV1 { builder::OrganizationPolicyViewV1::new(self) } ///Update an organization's IAM policy /// ///Sends a `PUT` request to `/v1/organizations/{organization}/policy` /// ///```ignore /// let response = client.organization_policy_update_v1() /// .organization(organization) /// .body(body) /// .send() /// .await; /// ``` pub fn organization_policy_update_v1(&self) -> builder::OrganizationPolicyUpdateV1 { builder::OrganizationPolicyUpdateV1::new(self) } ///List projects /// ///Sends a `GET` request to `/v1/projects` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `organization` /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.project_list_v1() /// .limit(limit) /// .organization(organization) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn project_list_v1(&self) -> builder::ProjectListV1 { builder::ProjectListV1::new(self) } ///Create a project /// ///Sends a `POST` request to `/v1/projects` /// ///```ignore /// let response = client.project_create_v1() /// .organization(organization) /// .body(body) /// .send() /// .await; /// ``` pub fn project_create_v1(&self) -> builder::ProjectCreateV1 { builder::ProjectCreateV1::new(self) } ///Fetch a project /// ///Sends a `GET` request to `/v1/projects/{project}` /// ///```ignore /// let response = client.project_view_v1() /// .project(project) /// .organization(organization) /// .send() /// .await; /// ``` pub fn project_view_v1(&self) -> builder::ProjectViewV1 { builder::ProjectViewV1::new(self) } ///Update a project /// ///Sends a `PUT` request to `/v1/projects/{project}` /// ///```ignore /// let response = client.project_update_v1() /// .project(project) /// .organization(organization) /// .body(body) /// .send() /// .await; /// ``` pub fn project_update_v1(&self) -> builder::ProjectUpdateV1 { builder::ProjectUpdateV1::new(self) } ///Delete a project /// ///Sends a `DELETE` request to `/v1/projects/{project}` /// ///```ignore /// let response = client.project_delete_v1() /// .project(project) /// .organization(organization) /// .send() /// .await; /// ``` pub fn project_delete_v1(&self) -> builder::ProjectDeleteV1 { builder::ProjectDeleteV1::new(self) } ///Fetch a project's IAM policy /// ///Sends a `GET` request to `/v1/projects/{project}/policy` /// ///```ignore /// let response = client.project_policy_view_v1() /// .project(project) /// .organization(organization) /// .send() /// .await; /// ``` pub fn project_policy_view_v1(&self) -> builder::ProjectPolicyViewV1 { builder::ProjectPolicyViewV1::new(self) } ///Update a project's IAM policy /// ///Sends a `PUT` request to `/v1/projects/{project}/policy` /// ///```ignore /// let response = client.project_policy_update_v1() /// .project(project) /// .organization(organization) /// .body(body) /// .send() /// .await; /// ``` pub fn project_policy_update_v1(&self) -> builder::ProjectPolicyUpdateV1 { builder::ProjectPolicyUpdateV1::new(self) } ///View version and update status of component tree /// ///Sends a `GET` request to `/v1/system/update/components` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.system_component_version_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn system_component_version_list(&self) -> builder::SystemComponentVersionList { builder::SystemComponentVersionList::new(self) } ///List all update deployments /// ///Sends a `GET` request to `/v1/system/update/deployments` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.update_deployments_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn update_deployments_list(&self) -> builder::UpdateDeploymentsList { builder::UpdateDeploymentsList::new(self) } ///Fetch a system update deployment /// ///Sends a `GET` request to `/v1/system/update/deployments/{id}` /// ///```ignore /// let response = client.update_deployment_view() /// .id(id) /// .send() /// .await; /// ``` pub fn update_deployment_view(&self) -> builder::UpdateDeploymentView { builder::UpdateDeploymentView::new(self) } ///Refresh update data /// ///Sends a `POST` request to `/v1/system/update/refresh` /// ///```ignore /// let response = client.system_update_refresh() /// .send() /// .await; /// ``` pub fn system_update_refresh(&self) -> builder::SystemUpdateRefresh { builder::SystemUpdateRefresh::new(self) } ///Start system update /// ///Sends a `POST` request to `/v1/system/update/start` /// ///```ignore /// let response = client.system_update_start() /// .body(body) /// .send() /// .await; /// ``` pub fn system_update_start(&self) -> builder::SystemUpdateStart { builder::SystemUpdateStart::new(self) } ///Stop system update /// ///If there is no update in progress, do nothing. /// ///Sends a `POST` request to `/v1/system/update/stop` /// ///```ignore /// let response = client.system_update_stop() /// .send() /// .await; /// ``` pub fn system_update_stop(&self) -> builder::SystemUpdateStop { builder::SystemUpdateStop::new(self) } ///List all updates /// ///Sends a `GET` request to `/v1/system/update/updates` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` ///```ignore /// let response = client.system_update_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn system_update_list(&self) -> builder::SystemUpdateList { builder::SystemUpdateList::new(self) } ///View system update /// ///Sends a `GET` request to `/v1/system/update/updates/{version}` /// ///```ignore /// let response = client.system_update_view() /// .version(version) /// .send() /// .await; /// ``` pub fn system_update_view(&self) -> builder::SystemUpdateView { builder::SystemUpdateView::new(self) } ///View system update component tree /// ///Sends a `GET` request to /// `/v1/system/update/updates/{version}/components` /// ///```ignore /// let response = client.system_update_components_list() /// .version(version) /// .send() /// .await; /// ``` pub fn system_update_components_list(&self) -> builder::SystemUpdateComponentsList { builder::SystemUpdateComponentsList::new(self) } ///View system version and update status /// ///Sends a `GET` request to `/v1/system/update/version` /// ///```ignore /// let response = client.system_version() /// .send() /// .await; /// ``` pub fn system_version(&self) -> builder::SystemVersion { builder::SystemVersion::new(self) } } pub mod builder { use super::types; #[allow(unused_imports)] use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; ///Builder for [`Client::disk_view_by_id`] /// ///[`Client::disk_view_by_id`]: super::Client::disk_view_by_id #[derive(Debug, Clone)] pub struct DiskViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> DiskViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/disks/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/disks/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::image_view_by_id`] /// ///[`Client::image_view_by_id`]: super::Client::image_view_by_id #[derive(Debug, Clone)] pub struct ImageViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> ImageViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/images/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/images/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_view_by_id`] /// ///[`Client::instance_view_by_id`]: super::Client::instance_view_by_id #[derive(Debug, Clone)] pub struct InstanceViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> InstanceViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/instances/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/instances/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_network_interface_view_by_id`] /// ///[`Client::instance_network_interface_view_by_id`]: super::Client::instance_network_interface_view_by_id #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> InstanceNetworkInterfaceViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/network-interfaces/{id}` pub async fn send( self, ) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/network-interfaces/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_view_by_id`] /// ///[`Client::organization_view_by_id`]: super::Client::organization_view_by_id #[derive(Debug, Clone)] pub struct OrganizationViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> OrganizationViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/organizations/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/organizations/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_view_by_id`] /// ///[`Client::project_view_by_id`]: super::Client::project_view_by_id #[derive(Debug, Clone)] pub struct ProjectViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> ProjectViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/projects/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/projects/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::snapshot_view_by_id`] /// ///[`Client::snapshot_view_by_id`]: super::Client::snapshot_view_by_id #[derive(Debug, Clone)] pub struct SnapshotViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> SnapshotViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/snapshots/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/snapshots/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_route_view_by_id`] /// ///[`Client::vpc_router_route_view_by_id`]: super::Client::vpc_router_route_view_by_id #[derive(Debug, Clone)] pub struct VpcRouterRouteViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> VpcRouterRouteViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/vpc-router-routes/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/vpc-router-routes/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_view_by_id`] /// ///[`Client::vpc_router_view_by_id`]: super::Client::vpc_router_view_by_id #[derive(Debug, Clone)] pub struct VpcRouterViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> VpcRouterViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/vpc-routers/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/vpc-routers/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_subnet_view_by_id`] /// ///[`Client::vpc_subnet_view_by_id`]: super::Client::vpc_subnet_view_by_id #[derive(Debug, Clone)] pub struct VpcSubnetViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> VpcSubnetViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/vpc-subnets/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/vpc-subnets/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_view_by_id`] /// ///[`Client::vpc_view_by_id`]: super::Client::vpc_view_by_id #[derive(Debug, Clone)] pub struct VpcViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> VpcViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/by-id/vpcs/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/by-id/vpcs/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::device_auth_request`] /// ///[`Client::device_auth_request`]: super::Client::device_auth_request #[derive(Debug, Clone)] pub struct DeviceAuthRequest<'a> { client: &'a super::Client, body: Result, } impl<'a> DeviceAuthRequest<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::DeviceAuthRequest::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DeviceAuthRequest` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::DeviceAuthRequest, ) -> types::builder::DeviceAuthRequest, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/device/auth` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/device/auth", client.baseurl,); let request = client.client.post(url).form_urlencoded(&body)?.build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), } } } ///Builder for [`Client::device_auth_confirm`] /// ///[`Client::device_auth_confirm`]: super::Client::device_auth_confirm #[derive(Debug, Clone)] pub struct DeviceAuthConfirm<'a> { client: &'a super::Client, body: Result, } impl<'a> DeviceAuthConfirm<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::DeviceAuthVerify::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DeviceAuthVerify` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::DeviceAuthVerify, ) -> types::builder::DeviceAuthVerify, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/device/confirm` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/device/confirm", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::device_access_token`] /// ///[`Client::device_access_token`]: super::Client::device_access_token #[derive(Debug, Clone)] pub struct DeviceAccessToken<'a> { client: &'a super::Client, body: Result, } impl<'a> DeviceAccessToken<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::DeviceAccessTokenRequest::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value.try_into().map(From::from).map_err(|_| { "conversion to `DeviceAccessTokenRequest` for body failed".to_string() }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::DeviceAccessTokenRequest, ) -> types::builder::DeviceAccessTokenRequest, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/device/token` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/device/token", client.baseurl,); let request = client.client.post(url).form_urlencoded(&body)?.build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), } } } ///Builder for [`Client::group_list`] /// ///[`Client::group_list`]: super::Client::group_list #[derive(Debug, Clone)] pub struct GroupList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> GroupList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/groups` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/groups", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/groups` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::login_spoof`] /// ///[`Client::login_spoof`]: super::Client::login_spoof #[derive(Debug, Clone)] pub struct LoginSpoof<'a> { client: &'a super::Client, body: Result, } impl<'a> LoginSpoof<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::SpoofLoginBody::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SpoofLoginBody` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::SpoofLoginBody) -> types::builder::SpoofLoginBody, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/login` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/login", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::login_local`] /// ///[`Client::login_local`]: super::Client::login_local #[derive(Debug, Clone)] pub struct LoginLocal<'a> { client: &'a super::Client, silo_name: Result, body: Result, } impl<'a> LoginLocal<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), body: Ok(types::builder::UsernamePasswordCredentials::default()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value.try_into().map(From::from).map_err(|_| { "conversion to `UsernamePasswordCredentials` for body failed".to_string() }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::UsernamePasswordCredentials, ) -> types::builder::UsernamePasswordCredentials, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/login/{silo_name}/local` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/login/{}/local", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::login_saml_begin`] /// ///[`Client::login_saml_begin`]: super::Client::login_saml_begin #[derive(Debug, Clone)] pub struct LoginSamlBegin<'a> { client: &'a super::Client, silo_name: Result, provider_name: Result, } impl<'a> LoginSamlBegin<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), provider_name: Err("provider_name was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn provider_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.provider_name = value .try_into() .map_err(|_| "conversion to `Name` for provider_name failed".to_string()); self } ///Sends a `GET` request to `/login/{silo_name}/saml/{provider_name}` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, provider_name, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/login/{}/saml/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&provider_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::login_saml`] /// ///[`Client::login_saml`]: super::Client::login_saml #[derive(Debug)] pub struct LoginSaml<'a> { client: &'a super::Client, silo_name: Result, provider_name: Result, body: Result, } impl<'a> LoginSaml<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), provider_name: Err("provider_name was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn provider_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.provider_name = value .try_into() .map_err(|_| "conversion to `Name` for provider_name failed".to_string()); self } pub fn body(mut self, value: B) -> Self where B: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `reqwest::Body` for body failed".to_string()); self } ///Sends a `POST` request to `/login/{silo_name}/saml/{provider_name}` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, provider_name, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/login/{}/saml/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&provider_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::CONTENT_TYPE, reqwest::header::HeaderValue::from_static("application/octet-stream"), ) .body(body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::logout`] /// ///[`Client::logout`]: super::Client::logout #[derive(Debug, Clone)] pub struct Logout<'a> { client: &'a super::Client, } impl<'a> Logout<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/logout` pub async fn send(self) -> Result, Error> { let Self { client } = self; let url = format!("{}/logout", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_list`] /// ///[`Client::organization_list`]: super::Client::organization_list #[derive(Debug, Clone)] pub struct OrganizationList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> OrganizationList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/organizations` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/organizations", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/organizations` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::organization_create`] /// ///[`Client::organization_create`]: super::Client::organization_create #[derive(Debug, Clone)] pub struct OrganizationCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> OrganizationCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::OrganizationCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `OrganizationCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::OrganizationCreate, ) -> types::builder::OrganizationCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/organizations` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/organizations", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_view`] /// ///[`Client::organization_view`]: super::Client::organization_view #[derive(Debug, Clone)] pub struct OrganizationView<'a> { client: &'a super::Client, organization_name: Result, } impl<'a> OrganizationView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } ///Sends a `GET` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_update`] /// ///[`Client::organization_update`]: super::Client::organization_update #[derive(Debug, Clone)] pub struct OrganizationUpdate<'a> { client: &'a super::Client, organization_name: Result, body: Result, } impl<'a> OrganizationUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), body: Ok(types::builder::OrganizationUpdate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `OrganizationUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::OrganizationUpdate, ) -> types::builder::OrganizationUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_delete`] /// ///[`Client::organization_delete`]: super::Client::organization_delete #[derive(Debug, Clone)] pub struct OrganizationDelete<'a> { client: &'a super::Client, organization_name: Result, } impl<'a> OrganizationDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } ///Sends a `DELETE` request to `/organizations/{organization_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_policy_view`] /// ///[`Client::organization_policy_view`]: super::Client::organization_policy_view #[derive(Debug, Clone)] pub struct OrganizationPolicyView<'a> { client: &'a super::Client, organization_name: Result, } impl<'a> OrganizationPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } ///Sends a `GET` request to `/organizations/{organization_name}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/policy", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_policy_update`] /// ///[`Client::organization_policy_update`]: super::Client::organization_policy_update #[derive(Debug, Clone)] pub struct OrganizationPolicyUpdate<'a> { client: &'a super::Client, organization_name: Result, body: Result, } impl<'a> OrganizationPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), body: Ok(types::builder::OrganizationRolePolicy::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `OrganizationRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::OrganizationRolePolicy, ) -> types::builder::OrganizationRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/organizations/{organization_name}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/policy", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_list`] /// ///[`Client::project_list`]: super::Client::project_list #[derive(Debug, Clone)] pub struct ProjectList<'a> { client: &'a super::Client, organization_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> ProjectList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects", client.baseurl, encode_path(&organization_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::project_create`] /// ///[`Client::project_create`]: super::Client::project_create #[derive(Debug, Clone)] pub struct ProjectCreate<'a> { client: &'a super::Client, organization_name: Result, body: Result, } impl<'a> ProjectCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), body: Ok(types::builder::ProjectCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ProjectCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::ProjectCreate) -> types::builder::ProjectCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_view`] /// ///[`Client::project_view`]: super::Client::project_view #[derive(Debug, Clone)] pub struct ProjectView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, } impl<'a> ProjectView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_update`] /// ///[`Client::project_update`]: super::Client::project_update #[derive(Debug, Clone)] pub struct ProjectUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> ProjectUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::ProjectUpdate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ProjectUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::ProjectUpdate) -> types::builder::ProjectUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_delete`] /// ///[`Client::project_delete`]: super::Client::project_delete #[derive(Debug, Clone)] pub struct ProjectDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, } impl<'a> ProjectDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::disk_list`] /// ///[`Client::disk_list`]: super::Client::disk_list #[derive(Debug, Clone)] pub struct DiskList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> DiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/disks", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/disks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::disk_create`] /// ///[`Client::disk_create`]: super::Client::disk_create #[derive(Debug, Clone)] pub struct DiskCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> DiskCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::DiskCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DiskCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::DiskCreate) -> types::builder::DiskCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/disks` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/disks", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::disk_view`] /// ///[`Client::disk_view`]: super::Client::disk_view #[derive(Debug, Clone)] pub struct DiskView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, disk_name: Result, } impl<'a> DiskView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), disk_name: Err("disk_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn disk_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.disk_name = value .try_into() .map_err(|_| "conversion to `Name` for disk_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, disk_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/disks/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&disk_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::disk_delete`] /// ///[`Client::disk_delete`]: super::Client::disk_delete #[derive(Debug, Clone)] pub struct DiskDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, disk_name: Result, } impl<'a> DiskDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), disk_name: Err("disk_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn disk_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.disk_name = value .try_into() .map_err(|_| "conversion to `Name` for disk_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, disk_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/disks/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&disk_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::disk_metrics_list`] /// ///[`Client::disk_metrics_list`]: super::Client::disk_metrics_list #[derive(Debug, Clone)] pub struct DiskMetricsList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, disk_name: Result, metric_name: Result, end_time: Result>, String>, limit: Result, String>, page_token: Result, String>, start_time: Result>, String>, } impl<'a> DiskMetricsList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), disk_name: Err("disk_name was not initialized".to_string()), metric_name: Err("metric_name was not initialized".to_string()), end_time: Ok(None), limit: Ok(None), page_token: Ok(None), start_time: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn disk_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.disk_name = value .try_into() .map_err(|_| "conversion to `Name` for disk_name failed".to_string()); self } pub fn metric_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.metric_name = value .try_into() .map_err(|_| "conversion to `DiskMetricName` for metric_name failed".to_string()); self } pub fn end_time(mut self, value: V) -> Self where V: std::convert::TryInto>, { self.end_time = value.try_into().map(Some).map_err(|_| { "conversion to `chrono :: DateTime < chrono :: offset :: Utc >` for end_time failed" .to_string() }); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn start_time(mut self, value: V) -> Self where V: std::convert::TryInto>, { self.start_time = value.try_into().map(Some).map_err(|_| { "conversion to `chrono :: DateTime < chrono :: offset :: Utc >` for start_time \ failed" .to_string() }); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}/metrics/{metric_name}` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, disk_name, metric_name, end_time, limit, page_token, start_time, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let disk_name = disk_name.map_err(Error::InvalidRequest)?; let metric_name = metric_name.map_err(Error::InvalidRequest)?; let end_time = end_time.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let start_time = start_time.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/disks/{}/metrics/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&disk_name.to_string()), encode_path(&metric_name.to_string()), ); let mut query = Vec::with_capacity(4usize); if let Some(v) = &end_time { query.push(("end_time", v.to_string())); } if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &start_time { query.push(("start_time", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/disks/ /// {disk_name}/metrics/{metric_name}` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { end_time: Ok(None), limit: Ok(None), page_token: Ok(None), start_time: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::image_list`] /// ///[`Client::image_list`]: super::Client::image_list #[derive(Debug, Clone)] pub struct ImageList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> ImageList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/images", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/images` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::image_create`] /// ///[`Client::image_create`]: super::Client::image_create #[derive(Debug, Clone)] pub struct ImageCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> ImageCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::ImageCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ImageCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::ImageCreate) -> types::builder::ImageCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/images` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/images", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::image_view`] /// ///[`Client::image_view`]: super::Client::image_view #[derive(Debug, Clone)] pub struct ImageView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, image_name: Result, } impl<'a> ImageView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), image_name: Err("image_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn image_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.image_name = value .try_into() .map_err(|_| "conversion to `Name` for image_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, image_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let image_name = image_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/images/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&image_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::image_delete`] /// ///[`Client::image_delete`]: super::Client::image_delete #[derive(Debug, Clone)] pub struct ImageDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, image_name: Result, } impl<'a> ImageDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), image_name: Err("image_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn image_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.image_name = value .try_into() .map_err(|_| "conversion to `Name` for image_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/images/ /// {image_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, image_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let image_name = image_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/images/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&image_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_list`] /// ///[`Client::instance_list`]: super::Client::instance_list #[derive(Debug, Clone)] pub struct InstanceList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> InstanceList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::instance_create`] /// ///[`Client::instance_create`]: super::Client::instance_create #[derive(Debug, Clone)] pub struct InstanceCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> InstanceCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::InstanceCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `InstanceCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::InstanceCreate) -> types::builder::InstanceCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_view`] /// ///[`Client::instance_view`]: super::Client::instance_view #[derive(Debug, Clone)] pub struct InstanceView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_delete`] /// ///[`Client::instance_delete`]: super::Client::instance_delete #[derive(Debug, Clone)] pub struct InstanceDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_disk_list`] /// ///[`Client::instance_disk_list`]: super::Client::instance_disk_list #[derive(Debug, Clone)] pub struct InstanceDiskList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> InstanceDiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/disks", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::instance_disk_attach`] /// ///[`Client::instance_disk_attach`]: super::Client::instance_disk_attach #[derive(Debug, Clone)] pub struct InstanceDiskAttach<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, body: Result, } impl<'a> InstanceDiskAttach<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), body: Ok(types::builder::DiskIdentifier::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DiskIdentifier` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::DiskIdentifier) -> types::builder::DiskIdentifier, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks/attach` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/disks/attach", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_disk_detach`] /// ///[`Client::instance_disk_detach`]: super::Client::instance_disk_detach #[derive(Debug, Clone)] pub struct InstanceDiskDetach<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, body: Result, } impl<'a> InstanceDiskDetach<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), body: Ok(types::builder::DiskIdentifier::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DiskIdentifier` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::DiskIdentifier) -> types::builder::DiskIdentifier, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/disks/detach` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/disks/detach", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_external_ip_list`] /// ///[`Client::instance_external_ip_list`]: super::Client::instance_external_ip_list #[derive(Debug, Clone)] pub struct InstanceExternalIpList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceExternalIpList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/external-ips` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/external-ips", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_migrate`] /// ///[`Client::instance_migrate`]: super::Client::instance_migrate #[derive(Debug, Clone)] pub struct InstanceMigrate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, body: Result, } impl<'a> InstanceMigrate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), body: Ok(types::builder::InstanceMigrate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `InstanceMigrate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::InstanceMigrate) -> types::builder::InstanceMigrate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/migrate` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/migrate", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_network_interface_list`] /// ///[`Client::instance_network_interface_list`]: super::Client::instance_network_interface_list #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> InstanceNetworkInterfaceList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::instance_network_interface_create`] /// ///[`Client::instance_network_interface_create`]: super::Client::instance_network_interface_create #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, body: Result, } impl<'a> InstanceNetworkInterfaceCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), body: Ok(types::builder::NetworkInterfaceCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `NetworkInterfaceCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::NetworkInterfaceCreate, ) -> types::builder::NetworkInterfaceCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/network-interfaces", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_network_interface_view`] /// ///[`Client::instance_network_interface_view`]: super::Client::instance_network_interface_view #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, interface_name: Result, } impl<'a> InstanceNetworkInterfaceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), interface_name: Err("interface_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn interface_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.interface_name = value .try_into() .map_err(|_| "conversion to `Name` for interface_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces/{interface_name}` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, interface_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), encode_path(&interface_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_network_interface_update`] /// ///[`Client::instance_network_interface_update`]: super::Client::instance_network_interface_update #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, interface_name: Result, body: Result, } impl<'a> InstanceNetworkInterfaceUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), interface_name: Err("interface_name was not initialized".to_string()), body: Ok(types::builder::NetworkInterfaceUpdate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn interface_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.interface_name = value .try_into() .map_err(|_| "conversion to `Name` for interface_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `NetworkInterfaceUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::NetworkInterfaceUpdate, ) -> types::builder::NetworkInterfaceUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces/{interface_name}` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, interface_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), encode_path(&interface_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_network_interface_delete`] /// ///[`Client::instance_network_interface_delete`]: super::Client::instance_network_interface_delete #[derive(Debug, Clone)] pub struct InstanceNetworkInterfaceDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, interface_name: Result, } impl<'a> InstanceNetworkInterfaceDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), interface_name: Err("interface_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn interface_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.interface_name = value .try_into() .map_err(|_| "conversion to `Name` for interface_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/network-interfaces/{interface_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, interface_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let interface_name = interface_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/network-interfaces/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), encode_path(&interface_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_reboot`] /// ///[`Client::instance_reboot`]: super::Client::instance_reboot #[derive(Debug, Clone)] pub struct InstanceReboot<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceReboot<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/reboot` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/reboot", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_serial_console`] /// ///[`Client::instance_serial_console`]: super::Client::instance_serial_console #[derive(Debug, Clone)] pub struct InstanceSerialConsole<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, from_start: Result, String>, max_bytes: Result, String>, most_recent: Result, String>, } impl<'a> InstanceSerialConsole<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), from_start: Ok(None), max_bytes: Ok(None), most_recent: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } pub fn from_start(mut self, value: V) -> Self where V: std::convert::TryInto, { self.from_start = value .try_into() .map(Some) .map_err(|_| "conversion to `u64` for from_start failed".to_string()); self } pub fn max_bytes(mut self, value: V) -> Self where V: std::convert::TryInto, { self.max_bytes = value .try_into() .map(Some) .map_err(|_| "conversion to `u64` for max_bytes failed".to_string()); self } pub fn most_recent(mut self, value: V) -> Self where V: std::convert::TryInto, { self.most_recent = value .try_into() .map(Some) .map_err(|_| "conversion to `u64` for most_recent failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/serial-console` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, from_start, max_bytes, most_recent, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let from_start = from_start.map_err(Error::InvalidRequest)?; let max_bytes = max_bytes.map_err(Error::InvalidRequest)?; let most_recent = most_recent.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/serial-console", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &from_start { query.push(("from_start", v.to_string())); } if let Some(v) = &max_bytes { query.push(("max_bytes", v.to_string())); } if let Some(v) = &most_recent { query.push(("most_recent", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_serial_console_stream`] /// ///[`Client::instance_serial_console_stream`]: super::Client::instance_serial_console_stream #[derive(Debug, Clone)] pub struct InstanceSerialConsoleStream<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceSerialConsoleStream<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/serial-console/stream` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/serial-console/stream", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .get(url) .header(reqwest::header::CONNECTION, "Upgrade") .header(reqwest::header::UPGRADE, "websocket") .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") .header( reqwest::header::SEC_WEBSOCKET_KEY, base64::Engine::encode( &base64::engine::general_purpose::STANDARD, rand::random::<[u8; 16]>(), ), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 101u16 => ResponseValue::upgrade(response).await, 200..=299 => ResponseValue::upgrade(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_start`] /// ///[`Client::instance_start`]: super::Client::instance_start #[derive(Debug, Clone)] pub struct InstanceStart<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceStart<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/start` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/start", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_stop`] /// ///[`Client::instance_stop`]: super::Client::instance_stop #[derive(Debug, Clone)] pub struct InstanceStop<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, instance_name: Result, } impl<'a> InstanceStop<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), instance_name: Err("instance_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn instance_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance_name = value .try_into() .map_err(|_| "conversion to `Name` for instance_name failed".to_string()); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// instances/{instance_name}/stop` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, instance_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let instance_name = instance_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/instances/{}/stop", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&instance_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_policy_view`] /// ///[`Client::project_policy_view`]: super::Client::project_policy_view #[derive(Debug, Clone)] pub struct ProjectPolicyView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, } impl<'a> ProjectPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/policy", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_policy_update`] /// ///[`Client::project_policy_update`]: super::Client::project_policy_update #[derive(Debug, Clone)] pub struct ProjectPolicyUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> ProjectPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::ProjectRolePolicy::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ProjectRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::ProjectRolePolicy, ) -> types::builder::ProjectRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/policy", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::snapshot_list`] /// ///[`Client::snapshot_list`]: super::Client::snapshot_list #[derive(Debug, Clone)] pub struct SnapshotList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SnapshotList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/snapshots", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::snapshot_create`] /// ///[`Client::snapshot_create`]: super::Client::snapshot_create #[derive(Debug, Clone)] pub struct SnapshotCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> SnapshotCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::SnapshotCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SnapshotCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::SnapshotCreate) -> types::builder::SnapshotCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/snapshots", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::snapshot_view`] /// ///[`Client::snapshot_view`]: super::Client::snapshot_view #[derive(Debug, Clone)] pub struct SnapshotView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, snapshot_name: Result, } impl<'a> SnapshotView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), snapshot_name: Err("snapshot_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn snapshot_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.snapshot_name = value .try_into() .map_err(|_| "conversion to `Name` for snapshot_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots/{snapshot_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, snapshot_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let snapshot_name = snapshot_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/snapshots/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&snapshot_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::snapshot_delete`] /// ///[`Client::snapshot_delete`]: super::Client::snapshot_delete #[derive(Debug, Clone)] pub struct SnapshotDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, snapshot_name: Result, } impl<'a> SnapshotDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), snapshot_name: Err("snapshot_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn snapshot_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.snapshot_name = value .try_into() .map_err(|_| "conversion to `Name` for snapshot_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/ /// snapshots/{snapshot_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, snapshot_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let snapshot_name = snapshot_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/snapshots/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&snapshot_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_list`] /// ///[`Client::vpc_list`]: super::Client::vpc_list #[derive(Debug, Clone)] pub struct VpcList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> VpcList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::vpc_create`] /// ///[`Client::vpc_create`]: super::Client::vpc_create #[derive(Debug, Clone)] pub struct VpcCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, body: Result, } impl<'a> VpcCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), body: Ok(types::builder::VpcCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `VpcCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::VpcCreate) -> types::builder::VpcCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_view`] /// ///[`Client::vpc_view`]: super::Client::vpc_view #[derive(Debug, Clone)] pub struct VpcView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, } impl<'a> VpcView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_update`] /// ///[`Client::vpc_update`]: super::Client::vpc_update #[derive(Debug, Clone)] pub struct VpcUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, body: Result, } impl<'a> VpcUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), body: Ok(types::builder::VpcUpdate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `VpcUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::VpcUpdate) -> types::builder::VpcUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_delete`] /// ///[`Client::vpc_delete`]: super::Client::vpc_delete #[derive(Debug, Clone)] pub struct VpcDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, } impl<'a> VpcDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_firewall_rules_view`] /// ///[`Client::vpc_firewall_rules_view`]: super::Client::vpc_firewall_rules_view #[derive(Debug, Clone)] pub struct VpcFirewallRulesView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, } impl<'a> VpcFirewallRulesView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_firewall_rules_update`] /// ///[`Client::vpc_firewall_rules_update`]: super::Client::vpc_firewall_rules_update #[derive(Debug, Clone)] pub struct VpcFirewallRulesUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, body: Result, } impl<'a> VpcFirewallRulesUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), body: Ok(types::builder::VpcFirewallRuleUpdateParams::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value.try_into().map(From::from).map_err(|_| { "conversion to `VpcFirewallRuleUpdateParams` for body failed".to_string() }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::VpcFirewallRuleUpdateParams, ) -> types::builder::VpcFirewallRuleUpdateParams, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/firewall/rules", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_list`] /// ///[`Client::vpc_router_list`]: super::Client::vpc_router_list #[derive(Debug, Clone)] pub struct VpcRouterList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> VpcRouterList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::vpc_router_create`] /// ///[`Client::vpc_router_create`]: super::Client::vpc_router_create #[derive(Debug, Clone)] pub struct VpcRouterCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, body: Result, } impl<'a> VpcRouterCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), body: Ok(types::builder::VpcRouterCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `VpcRouterCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::VpcRouterCreate) -> types::builder::VpcRouterCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_view`] /// ///[`Client::vpc_router_view`]: super::Client::vpc_router_view #[derive(Debug, Clone)] pub struct VpcRouterView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, } impl<'a> VpcRouterView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_update`] /// ///[`Client::vpc_router_update`]: super::Client::vpc_router_update #[derive(Debug, Clone)] pub struct VpcRouterUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, body: Result, } impl<'a> VpcRouterUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), body: Ok(types::builder::VpcRouterUpdate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `VpcRouterUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::VpcRouterUpdate) -> types::builder::VpcRouterUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_delete`] /// ///[`Client::vpc_router_delete`]: super::Client::vpc_router_delete #[derive(Debug, Clone)] pub struct VpcRouterDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, } impl<'a> VpcRouterDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_route_list`] /// ///[`Client::vpc_router_route_list`]: super::Client::vpc_router_route_list #[derive(Debug, Clone)] pub struct VpcRouterRouteList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> VpcRouterRouteList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::vpc_router_route_create`] /// ///[`Client::vpc_router_route_create`]: super::Client::vpc_router_route_create #[derive(Debug, Clone)] pub struct VpcRouterRouteCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, body: Result, } impl<'a> VpcRouterRouteCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), body: Ok(types::builder::RouterRouteCreateParams::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `RouterRouteCreateParams` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::RouterRouteCreateParams, ) -> types::builder::RouterRouteCreateParams, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_route_view`] /// ///[`Client::vpc_router_route_view`]: super::Client::vpc_router_route_view #[derive(Debug, Clone)] pub struct VpcRouterRouteView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, route_name: Result, } impl<'a> VpcRouterRouteView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), route_name: Err("route_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } pub fn route_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.route_name = value .try_into() .map_err(|_| "conversion to `Name` for route_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, route_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), encode_path(&route_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_route_update`] /// ///[`Client::vpc_router_route_update`]: super::Client::vpc_router_route_update #[derive(Debug, Clone)] pub struct VpcRouterRouteUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, route_name: Result, body: Result, } impl<'a> VpcRouterRouteUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), route_name: Err("route_name was not initialized".to_string()), body: Ok(types::builder::RouterRouteUpdateParams::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } pub fn route_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.route_name = value .try_into() .map_err(|_| "conversion to `Name` for route_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `RouterRouteUpdateParams` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::RouterRouteUpdateParams, ) -> types::builder::RouterRouteUpdateParams, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, route_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), encode_path(&route_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_router_route_delete`] /// ///[`Client::vpc_router_route_delete`]: super::Client::vpc_router_route_delete #[derive(Debug, Clone)] pub struct VpcRouterRouteDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, router_name: Result, route_name: Result, } impl<'a> VpcRouterRouteDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), router_name: Err("router_name was not initialized".to_string()), route_name: Err("route_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn router_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.router_name = value .try_into() .map_err(|_| "conversion to `Name` for router_name failed".to_string()); self } pub fn route_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.route_name = value .try_into() .map_err(|_| "conversion to `Name` for route_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, router_name, route_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let router_name = router_name.map_err(Error::InvalidRequest)?; let route_name = route_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/routers/{}/routes/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&router_name.to_string()), encode_path(&route_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_subnet_list`] /// ///[`Client::vpc_subnet_list`]: super::Client::vpc_subnet_list #[derive(Debug, Clone)] pub struct VpcSubnetList<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> VpcSubnetList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/subnets", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::vpc_subnet_create`] /// ///[`Client::vpc_subnet_create`]: super::Client::vpc_subnet_create #[derive(Debug, Clone)] pub struct VpcSubnetCreate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, body: Result, } impl<'a> VpcSubnetCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), body: Ok(types::builder::VpcSubnetCreate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `VpcSubnetCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::VpcSubnetCreate) -> types::builder::VpcSubnetCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/subnets", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_subnet_view`] /// ///[`Client::vpc_subnet_view`]: super::Client::vpc_subnet_view #[derive(Debug, Clone)] pub struct VpcSubnetView<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, subnet_name: Result, } impl<'a> VpcSubnetView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), subnet_name: Err("subnet_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn subnet_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.subnet_name = value .try_into() .map_err(|_| "conversion to `Name` for subnet_name failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, subnet_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&subnet_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_subnet_update`] /// ///[`Client::vpc_subnet_update`]: super::Client::vpc_subnet_update #[derive(Debug, Clone)] pub struct VpcSubnetUpdate<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, subnet_name: Result, body: Result, } impl<'a> VpcSubnetUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), subnet_name: Err("subnet_name was not initialized".to_string()), body: Ok(types::builder::VpcSubnetUpdate::default()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn subnet_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.subnet_name = value .try_into() .map_err(|_| "conversion to `Name` for subnet_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `VpcSubnetUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::VpcSubnetUpdate) -> types::builder::VpcSubnetUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, subnet_name, body, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&subnet_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_subnet_delete`] /// ///[`Client::vpc_subnet_delete`]: super::Client::vpc_subnet_delete #[derive(Debug, Clone)] pub struct VpcSubnetDelete<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, subnet_name: Result, } impl<'a> VpcSubnetDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), subnet_name: Err("subnet_name was not initialized".to_string()), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn subnet_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.subnet_name = value .try_into() .map_err(|_| "conversion to `Name` for subnet_name failed".to_string()); self } ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` pub async fn send(self) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, subnet_name, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&subnet_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::vpc_subnet_list_network_interfaces`] /// ///[`Client::vpc_subnet_list_network_interfaces`]: super::Client::vpc_subnet_list_network_interfaces #[derive(Debug, Clone)] pub struct VpcSubnetListNetworkInterfaces<'a> { client: &'a super::Client, organization_name: Result, project_name: Result, vpc_name: Result, subnet_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> VpcSubnetListNetworkInterfaces<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization_name: Err("organization_name was not initialized".to_string()), project_name: Err("project_name was not initialized".to_string()), vpc_name: Err("vpc_name was not initialized".to_string()), subnet_name: Err("subnet_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn organization_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization_name = value .try_into() .map_err(|_| "conversion to `Name` for organization_name failed".to_string()); self } pub fn project_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project_name = value .try_into() .map_err(|_| "conversion to `Name` for project_name failed".to_string()); self } pub fn vpc_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.vpc_name = value .try_into() .map_err(|_| "conversion to `Name` for vpc_name failed".to_string()); self } pub fn subnet_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.subnet_name = value .try_into() .map_err(|_| "conversion to `Name` for subnet_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}/network-interfaces` pub async fn send( self, ) -> Result, Error> { let Self { client, organization_name, project_name, vpc_name, subnet_name, limit, page_token, sort_by, } = self; let organization_name = organization_name.map_err(Error::InvalidRequest)?; let project_name = project_name.map_err(Error::InvalidRequest)?; let vpc_name = vpc_name.map_err(Error::InvalidRequest)?; let subnet_name = subnet_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects/{}/vpcs/{}/subnets/{}/network-interfaces", client.baseurl, encode_path(&organization_name.to_string()), encode_path(&project_name.to_string()), encode_path(&vpc_name.to_string()), encode_path(&subnet_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}/network-interfaces` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::policy_view`] /// ///[`Client::policy_view`]: super::Client::policy_view #[derive(Debug, Clone)] pub struct PolicyView<'a> { client: &'a super::Client, } impl<'a> PolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/policy` pub async fn send( self, ) -> Result, Error> { let Self { client } = self; let url = format!("{}/policy", client.baseurl,); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::policy_update`] /// ///[`Client::policy_update`]: super::Client::policy_update #[derive(Debug, Clone)] pub struct PolicyUpdate<'a> { client: &'a super::Client, body: Result, } impl<'a> PolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::SiloRolePolicy::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SiloRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::SiloRolePolicy) -> types::builder::SiloRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/policy", client.baseurl,); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::role_list`] /// ///[`Client::role_list`]: super::Client::role_list #[derive(Debug, Clone)] pub struct RoleList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, } impl<'a> RoleList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } ///Sends a `GET` request to `/roles` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let url = format!("{}/roles", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/roles` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::role_view`] /// ///[`Client::role_view`]: super::Client::role_view #[derive(Debug, Clone)] pub struct RoleView<'a> { client: &'a super::Client, role_name: Result, } impl<'a> RoleView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, role_name: Err("role_name was not initialized".to_string()), } } pub fn role_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.role_name = value .try_into() .map_err(|_| "conversion to `String` for role_name failed".to_string()); self } ///Sends a `GET` request to `/roles/{role_name}` pub async fn send(self) -> Result, Error> { let Self { client, role_name } = self; let role_name = role_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/roles/{}", client.baseurl, encode_path(&role_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::session_me`] /// ///[`Client::session_me`]: super::Client::session_me #[derive(Debug, Clone)] pub struct SessionMe<'a> { client: &'a super::Client, } impl<'a> SessionMe<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/session/me` pub async fn send(self) -> Result, Error> { let Self { client } = self; let url = format!("{}/session/me", client.baseurl,); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::session_me_groups`] /// ///[`Client::session_me_groups`]: super::Client::session_me_groups #[derive(Debug, Clone)] pub struct SessionMeGroups<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SessionMeGroups<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/session/me/groups` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/session/me/groups", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/session/me/groups` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::session_sshkey_list`] /// ///[`Client::session_sshkey_list`]: super::Client::session_sshkey_list #[derive(Debug, Clone)] pub struct SessionSshkeyList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SessionSshkeyList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/session/me/sshkeys` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/session/me/sshkeys", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/session/me/sshkeys` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::session_sshkey_create`] /// ///[`Client::session_sshkey_create`]: super::Client::session_sshkey_create #[derive(Debug, Clone)] pub struct SessionSshkeyCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> SessionSshkeyCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::SshKeyCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SshKeyCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::SshKeyCreate) -> types::builder::SshKeyCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/session/me/sshkeys` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/session/me/sshkeys", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::session_sshkey_view`] /// ///[`Client::session_sshkey_view`]: super::Client::session_sshkey_view #[derive(Debug, Clone)] pub struct SessionSshkeyView<'a> { client: &'a super::Client, ssh_key_name: Result, } impl<'a> SessionSshkeyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, ssh_key_name: Err("ssh_key_name was not initialized".to_string()), } } pub fn ssh_key_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.ssh_key_name = value .try_into() .map_err(|_| "conversion to `Name` for ssh_key_name failed".to_string()); self } ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` pub async fn send(self) -> Result, Error> { let Self { client, ssh_key_name, } = self; let ssh_key_name = ssh_key_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/session/me/sshkeys/{}", client.baseurl, encode_path(&ssh_key_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::session_sshkey_delete`] /// ///[`Client::session_sshkey_delete`]: super::Client::session_sshkey_delete #[derive(Debug, Clone)] pub struct SessionSshkeyDelete<'a> { client: &'a super::Client, ssh_key_name: Result, } impl<'a> SessionSshkeyDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, ssh_key_name: Err("ssh_key_name was not initialized".to_string()), } } pub fn ssh_key_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.ssh_key_name = value .try_into() .map_err(|_| "conversion to `Name` for ssh_key_name failed".to_string()); self } ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` pub async fn send(self) -> Result, Error> { let Self { client, ssh_key_name, } = self; let ssh_key_name = ssh_key_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/session/me/sshkeys/{}", client.baseurl, encode_path(&ssh_key_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_image_view_by_id`] /// ///[`Client::system_image_view_by_id`]: super::Client::system_image_view_by_id #[derive(Debug, Clone)] pub struct SystemImageViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> SystemImageViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/system/by-id/images/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/by-id/images/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_view_by_id`] /// ///[`Client::ip_pool_view_by_id`]: super::Client::ip_pool_view_by_id #[derive(Debug, Clone)] pub struct IpPoolViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> IpPoolViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/system/by-id/ip-pools/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/by-id/ip-pools/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_view_by_id`] /// ///[`Client::silo_view_by_id`]: super::Client::silo_view_by_id #[derive(Debug, Clone)] pub struct SiloViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> SiloViewById<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/system/by-id/silos/{id}` pub async fn send(self) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/by-id/silos/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::certificate_list`] /// ///[`Client::certificate_list`]: super::Client::certificate_list #[derive(Debug, Clone)] pub struct CertificateList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> CertificateList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/certificates` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/certificates", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/certificates` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::certificate_create`] /// ///[`Client::certificate_create`]: super::Client::certificate_create #[derive(Debug, Clone)] pub struct CertificateCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> CertificateCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::CertificateCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `CertificateCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::CertificateCreate, ) -> types::builder::CertificateCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/system/certificates` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/system/certificates", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::certificate_view`] /// ///[`Client::certificate_view`]: super::Client::certificate_view #[derive(Debug, Clone)] pub struct CertificateView<'a> { client: &'a super::Client, certificate: Result, } impl<'a> CertificateView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, certificate: Err("certificate was not initialized".to_string()), } } pub fn certificate(mut self, value: V) -> Self where V: std::convert::TryInto, { self.certificate = value .try_into() .map_err(|_| "conversion to `NameOrId` for certificate failed".to_string()); self } ///Sends a `GET` request to `/system/certificates/{certificate}` pub async fn send(self) -> Result, Error> { let Self { client, certificate, } = self; let certificate = certificate.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/certificates/{}", client.baseurl, encode_path(&certificate.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::certificate_delete`] /// ///[`Client::certificate_delete`]: super::Client::certificate_delete #[derive(Debug, Clone)] pub struct CertificateDelete<'a> { client: &'a super::Client, certificate: Result, } impl<'a> CertificateDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, certificate: Err("certificate was not initialized".to_string()), } } pub fn certificate(mut self, value: V) -> Self where V: std::convert::TryInto, { self.certificate = value .try_into() .map_err(|_| "conversion to `NameOrId` for certificate failed".to_string()); self } ///Sends a `DELETE` request to `/system/certificates/{certificate}` pub async fn send(self) -> Result, Error> { let Self { client, certificate, } = self; let certificate = certificate.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/certificates/{}", client.baseurl, encode_path(&certificate.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::physical_disk_list`] /// ///[`Client::physical_disk_list`]: super::Client::physical_disk_list #[derive(Debug, Clone)] pub struct PhysicalDiskList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> PhysicalDiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/hardware/disks` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/hardware/disks", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/hardware/disks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::rack_list`] /// ///[`Client::rack_list`]: super::Client::rack_list #[derive(Debug, Clone)] pub struct RackList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> RackList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/hardware/racks` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/hardware/racks", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/hardware/racks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::rack_view`] /// ///[`Client::rack_view`]: super::Client::rack_view #[derive(Debug, Clone)] pub struct RackView<'a> { client: &'a super::Client, rack_id: Result, } impl<'a> RackView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, rack_id: Err("rack_id was not initialized".to_string()), } } pub fn rack_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.rack_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for rack_id failed".to_string()); self } ///Sends a `GET` request to `/system/hardware/racks/{rack_id}` pub async fn send(self) -> Result, Error> { let Self { client, rack_id } = self; let rack_id = rack_id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/hardware/racks/{}", client.baseurl, encode_path(&rack_id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::sled_list`] /// ///[`Client::sled_list`]: super::Client::sled_list #[derive(Debug, Clone)] pub struct SledList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SledList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/hardware/sleds` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/hardware/sleds", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/hardware/sleds` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::sled_view`] /// ///[`Client::sled_view`]: super::Client::sled_view #[derive(Debug, Clone)] pub struct SledView<'a> { client: &'a super::Client, sled_id: Result, } impl<'a> SledView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, sled_id: Err("sled_id was not initialized".to_string()), } } pub fn sled_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sled_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for sled_id failed".to_string()); self } ///Sends a `GET` request to `/system/hardware/sleds/{sled_id}` pub async fn send(self) -> Result, Error> { let Self { client, sled_id } = self; let sled_id = sled_id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/hardware/sleds/{}", client.baseurl, encode_path(&sled_id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::sled_physical_disk_list`] /// ///[`Client::sled_physical_disk_list`]: super::Client::sled_physical_disk_list #[derive(Debug, Clone)] pub struct SledPhysicalDiskList<'a> { client: &'a super::Client, sled_id: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SledPhysicalDiskList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, sled_id: Err("sled_id was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn sled_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sled_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for sled_id failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/hardware/sleds/{sled_id}/disks` pub async fn send( self, ) -> Result, Error> { let Self { client, sled_id, limit, page_token, sort_by, } = self; let sled_id = sled_id.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/hardware/sleds/{}/disks", client.baseurl, encode_path(&sled_id.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/hardware/sleds/{sled_id}/disks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::system_image_list`] /// ///[`Client::system_image_list`]: super::Client::system_image_list #[derive(Debug, Clone)] pub struct SystemImageList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SystemImageList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/images` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/images", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/images` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::system_image_create`] /// ///[`Client::system_image_create`]: super::Client::system_image_create #[derive(Debug, Clone)] pub struct SystemImageCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> SystemImageCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::GlobalImageCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `GlobalImageCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::GlobalImageCreate, ) -> types::builder::GlobalImageCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/system/images` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/system/images", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_image_view`] /// ///[`Client::system_image_view`]: super::Client::system_image_view #[derive(Debug, Clone)] pub struct SystemImageView<'a> { client: &'a super::Client, image_name: Result, } impl<'a> SystemImageView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, image_name: Err("image_name was not initialized".to_string()), } } pub fn image_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.image_name = value .try_into() .map_err(|_| "conversion to `Name` for image_name failed".to_string()); self } ///Sends a `GET` request to `/system/images/{image_name}` pub async fn send(self) -> Result, Error> { let Self { client, image_name } = self; let image_name = image_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/images/{}", client.baseurl, encode_path(&image_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_image_delete`] /// ///[`Client::system_image_delete`]: super::Client::system_image_delete #[derive(Debug, Clone)] pub struct SystemImageDelete<'a> { client: &'a super::Client, image_name: Result, } impl<'a> SystemImageDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, image_name: Err("image_name was not initialized".to_string()), } } pub fn image_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.image_name = value .try_into() .map_err(|_| "conversion to `Name` for image_name failed".to_string()); self } ///Sends a `DELETE` request to `/system/images/{image_name}` pub async fn send(self) -> Result, Error> { let Self { client, image_name } = self; let image_name = image_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/images/{}", client.baseurl, encode_path(&image_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_list`] /// ///[`Client::ip_pool_list`]: super::Client::ip_pool_list #[derive(Debug, Clone)] pub struct IpPoolList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> IpPoolList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/ip-pools` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/ip-pools", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/ip-pools` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::ip_pool_create`] /// ///[`Client::ip_pool_create`]: super::Client::ip_pool_create #[derive(Debug, Clone)] pub struct IpPoolCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> IpPoolCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::IpPoolCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `IpPoolCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::IpPoolCreate) -> types::builder::IpPoolCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/system/ip-pools` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/system/ip-pools", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_view`] /// ///[`Client::ip_pool_view`]: super::Client::ip_pool_view #[derive(Debug, Clone)] pub struct IpPoolView<'a> { client: &'a super::Client, pool_name: Result, } impl<'a> IpPoolView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, pool_name: Err("pool_name was not initialized".to_string()), } } pub fn pool_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.pool_name = value .try_into() .map_err(|_| "conversion to `Name` for pool_name failed".to_string()); self } ///Sends a `GET` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { let Self { client, pool_name } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/ip-pools/{}", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_update`] /// ///[`Client::ip_pool_update`]: super::Client::ip_pool_update #[derive(Debug, Clone)] pub struct IpPoolUpdate<'a> { client: &'a super::Client, pool_name: Result, body: Result, } impl<'a> IpPoolUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, pool_name: Err("pool_name was not initialized".to_string()), body: Ok(types::builder::IpPoolUpdate::default()), } } pub fn pool_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.pool_name = value .try_into() .map_err(|_| "conversion to `Name` for pool_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `IpPoolUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::IpPoolUpdate) -> types::builder::IpPoolUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { let Self { client, pool_name, body, } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/system/ip-pools/{}", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_delete`] /// ///[`Client::ip_pool_delete`]: super::Client::ip_pool_delete #[derive(Debug, Clone)] pub struct IpPoolDelete<'a> { client: &'a super::Client, pool_name: Result, } impl<'a> IpPoolDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, pool_name: Err("pool_name was not initialized".to_string()), } } pub fn pool_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.pool_name = value .try_into() .map_err(|_| "conversion to `Name` for pool_name failed".to_string()); self } ///Sends a `DELETE` request to `/system/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { let Self { client, pool_name } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/ip-pools/{}", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_range_list`] /// ///[`Client::ip_pool_range_list`]: super::Client::ip_pool_range_list #[derive(Debug, Clone)] pub struct IpPoolRangeList<'a> { client: &'a super::Client, pool_name: Result, limit: Result, String>, page_token: Result, String>, } impl<'a> IpPoolRangeList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, pool_name: Err("pool_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), } } pub fn pool_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.pool_name = value .try_into() .map_err(|_| "conversion to `Name` for pool_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } ///Sends a `GET` request to `/system/ip-pools/{pool_name}/ranges` pub async fn send( self, ) -> Result, Error> { let Self { client, pool_name, limit, page_token, } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/ip-pools/{}/ranges", client.baseurl, encode_path(&pool_name.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/ip-pools/{pool_name}/ranges` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::ip_pool_range_add`] /// ///[`Client::ip_pool_range_add`]: super::Client::ip_pool_range_add #[derive(Debug, Clone)] pub struct IpPoolRangeAdd<'a> { client: &'a super::Client, pool_name: Result, body: Result, } impl<'a> IpPoolRangeAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, pool_name: Err("pool_name was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn pool_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.pool_name = value .try_into() .map_err(|_| "conversion to `Name` for pool_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `IpRange` for body failed".to_string()); self } ///Sends a `POST` request to `/system/ip-pools/{pool_name}/ranges/add` pub async fn send(self) -> Result, Error> { let Self { client, pool_name, body, } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/ip-pools/{}/ranges/add", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_range_remove`] /// ///[`Client::ip_pool_range_remove`]: super::Client::ip_pool_range_remove #[derive(Debug, Clone)] pub struct IpPoolRangeRemove<'a> { client: &'a super::Client, pool_name: Result, body: Result, } impl<'a> IpPoolRangeRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, pool_name: Err("pool_name was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn pool_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.pool_name = value .try_into() .map_err(|_| "conversion to `Name` for pool_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `IpRange` for body failed".to_string()); self } ///Sends a `POST` request to /// `/system/ip-pools/{pool_name}/ranges/remove` pub async fn send(self) -> Result, Error> { let Self { client, pool_name, body, } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/ip-pools/{}/ranges/remove", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_service_view`] /// ///[`Client::ip_pool_service_view`]: super::Client::ip_pool_service_view #[derive(Debug, Clone)] pub struct IpPoolServiceView<'a> { client: &'a super::Client, } impl<'a> IpPoolServiceView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/system/ip-pools-service` pub async fn send(self) -> Result, Error> { let Self { client } = self; let url = format!("{}/system/ip-pools-service", client.baseurl,); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_service_range_list`] /// ///[`Client::ip_pool_service_range_list`]: super::Client::ip_pool_service_range_list #[derive(Debug, Clone)] pub struct IpPoolServiceRangeList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, } impl<'a> IpPoolServiceRangeList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } ///Sends a `GET` request to `/system/ip-pools-service/ranges` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let url = format!("{}/system/ip-pools-service/ranges", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/ip-pools-service/ranges` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::ip_pool_service_range_add`] /// ///[`Client::ip_pool_service_range_add`]: super::Client::ip_pool_service_range_add #[derive(Debug, Clone)] pub struct IpPoolServiceRangeAdd<'a> { client: &'a super::Client, body: Result, } impl<'a> IpPoolServiceRangeAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Err("body was not initialized".to_string()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `IpRange` for body failed".to_string()); self } ///Sends a `POST` request to `/system/ip-pools-service/ranges/add` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/system/ip-pools-service/ranges/add", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_service_range_remove`] /// ///[`Client::ip_pool_service_range_remove`]: super::Client::ip_pool_service_range_remove #[derive(Debug, Clone)] pub struct IpPoolServiceRangeRemove<'a> { client: &'a super::Client, body: Result, } impl<'a> IpPoolServiceRangeRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Err("body was not initialized".to_string()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `IpRange` for body failed".to_string()); self } ///Sends a `POST` request to `/system/ip-pools-service/ranges/remove` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/system/ip-pools-service/ranges/remove", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_metric`] /// ///[`Client::system_metric`]: super::Client::system_metric #[derive(Debug, Clone)] pub struct SystemMetric<'a> { client: &'a super::Client, metric_name: Result, end_time: Result>, String>, id: Result, limit: Result, String>, page_token: Result, String>, start_time: Result>, String>, } impl<'a> SystemMetric<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, metric_name: Err("metric_name was not initialized".to_string()), end_time: Ok(None), id: Err("id was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), start_time: Ok(None), } } pub fn metric_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.metric_name = value .try_into() .map_err(|_| "conversion to `SystemMetricName` for metric_name failed".to_string()); self } pub fn end_time(mut self, value: V) -> Self where V: std::convert::TryInto>, { self.end_time = value.try_into().map(Some).map_err(|_| { "conversion to `chrono :: DateTime < chrono :: offset :: Utc >` for end_time failed" .to_string() }); self } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn start_time(mut self, value: V) -> Self where V: std::convert::TryInto>, { self.start_time = value.try_into().map(Some).map_err(|_| { "conversion to `chrono :: DateTime < chrono :: offset :: Utc >` for start_time \ failed" .to_string() }); self } ///Sends a `GET` request to `/system/metrics/{metric_name}` pub async fn send( self, ) -> Result, Error> { let Self { client, metric_name, end_time, id, limit, page_token, start_time, } = self; let metric_name = metric_name.map_err(Error::InvalidRequest)?; let end_time = end_time.map_err(Error::InvalidRequest)?; let id = id.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let start_time = start_time.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/metrics/{}", client.baseurl, encode_path(&metric_name.to_string()), ); let mut query = Vec::with_capacity(5usize); if let Some(v) = &end_time { query.push(("end_time", v.to_string())); } query.push(("id", id.to_string())); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &start_time { query.push(("start_time", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_policy_view`] /// ///[`Client::system_policy_view`]: super::Client::system_policy_view #[derive(Debug, Clone)] pub struct SystemPolicyView<'a> { client: &'a super::Client, } impl<'a> SystemPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/system/policy` pub async fn send( self, ) -> Result, Error> { let Self { client } = self; let url = format!("{}/system/policy", client.baseurl,); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_policy_update`] /// ///[`Client::system_policy_update`]: super::Client::system_policy_update #[derive(Debug, Clone)] pub struct SystemPolicyUpdate<'a> { client: &'a super::Client, body: Result, } impl<'a> SystemPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::FleetRolePolicy::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `FleetRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::FleetRolePolicy) -> types::builder::FleetRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/system/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/system/policy", client.baseurl,); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::saga_list`] /// ///[`Client::saga_list`]: super::Client::saga_list #[derive(Debug, Clone)] pub struct SagaList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SagaList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/sagas` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/sagas", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/sagas` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::saga_view`] /// ///[`Client::saga_view`]: super::Client::saga_view #[derive(Debug, Clone)] pub struct SagaView<'a> { client: &'a super::Client, saga_id: Result, } impl<'a> SagaView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, saga_id: Err("saga_id was not initialized".to_string()), } } pub fn saga_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.saga_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for saga_id failed".to_string()); self } ///Sends a `GET` request to `/system/sagas/{saga_id}` pub async fn send(self) -> Result, Error> { let Self { client, saga_id } = self; let saga_id = saga_id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/sagas/{}", client.baseurl, encode_path(&saga_id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_list`] /// ///[`Client::silo_list`]: super::Client::silo_list #[derive(Debug, Clone)] pub struct SiloList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SiloList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/silos` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/silos", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/silos` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::silo_create`] /// ///[`Client::silo_create`]: super::Client::silo_create #[derive(Debug, Clone)] pub struct SiloCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> SiloCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::SiloCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SiloCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::SiloCreate) -> types::builder::SiloCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/system/silos` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/system/silos", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_view`] /// ///[`Client::silo_view`]: super::Client::silo_view #[derive(Debug, Clone)] pub struct SiloView<'a> { client: &'a super::Client, silo_name: Result, } impl<'a> SiloView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } ///Sends a `GET` request to `/system/silos/{silo_name}` pub async fn send(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_delete`] /// ///[`Client::silo_delete`]: super::Client::silo_delete #[derive(Debug, Clone)] pub struct SiloDelete<'a> { client: &'a super::Client, silo_name: Result, } impl<'a> SiloDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } ///Sends a `DELETE` request to `/system/silos/{silo_name}` pub async fn send(self) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_identity_provider_list`] /// ///[`Client::silo_identity_provider_list`]: super::Client::silo_identity_provider_list #[derive(Debug, Clone)] pub struct SiloIdentityProviderList<'a> { client: &'a super::Client, silo_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SiloIdentityProviderList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to /// `/system/silos/{silo_name}/identity-providers` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, limit, page_token, sort_by, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/identity-providers", client.baseurl, encode_path(&silo_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to /// `/system/silos/{silo_name}/identity-providers` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::local_idp_user_create`] /// ///[`Client::local_idp_user_create`]: super::Client::local_idp_user_create #[derive(Debug, Clone)] pub struct LocalIdpUserCreate<'a> { client: &'a super::Client, silo_name: Result, body: Result, } impl<'a> LocalIdpUserCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), body: Ok(types::builder::UserCreate::default()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `UserCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::UserCreate) -> types::builder::UserCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/local/users` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/identity-providers/local/users", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::local_idp_user_delete`] /// ///[`Client::local_idp_user_delete`]: super::Client::local_idp_user_delete #[derive(Debug, Clone)] pub struct LocalIdpUserDelete<'a> { client: &'a super::Client, silo_name: Result, user_id: Result, } impl<'a> LocalIdpUserDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), user_id: Err("user_id was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn user_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.user_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for user_id failed".to_string()); self } ///Sends a `DELETE` request to /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, user_id, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/identity-providers/local/users/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&user_id.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::local_idp_user_set_password`] /// ///[`Client::local_idp_user_set_password`]: super::Client::local_idp_user_set_password #[derive(Debug, Clone)] pub struct LocalIdpUserSetPassword<'a> { client: &'a super::Client, silo_name: Result, user_id: Result, body: Result, } impl<'a> LocalIdpUserSetPassword<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), user_id: Err("user_id was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn user_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.user_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for user_id failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `UserPassword` for body failed".to_string()); self } ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/local/users/{user_id}/ /// set-password` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, user_id, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/identity-providers/local/users/{}/set-password", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&user_id.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::saml_identity_provider_create`] /// ///[`Client::saml_identity_provider_create`]: super::Client::saml_identity_provider_create #[derive(Debug, Clone)] pub struct SamlIdentityProviderCreate<'a> { client: &'a super::Client, silo_name: Result, body: Result, } impl<'a> SamlIdentityProviderCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), body: Ok(types::builder::SamlIdentityProviderCreate::default()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value.try_into().map(From::from).map_err(|_| { "conversion to `SamlIdentityProviderCreate` for body failed".to_string() }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::SamlIdentityProviderCreate, ) -> types::builder::SamlIdentityProviderCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to /// `/system/silos/{silo_name}/identity-providers/saml` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/identity-providers/saml", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::saml_identity_provider_view`] /// ///[`Client::saml_identity_provider_view`]: super::Client::saml_identity_provider_view #[derive(Debug, Clone)] pub struct SamlIdentityProviderView<'a> { client: &'a super::Client, silo_name: Result, provider_name: Result, } impl<'a> SamlIdentityProviderView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), provider_name: Err("provider_name was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn provider_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.provider_name = value .try_into() .map_err(|_| "conversion to `Name` for provider_name failed".to_string()); self } ///Sends a `GET` request to /// `/system/silos/{silo_name}/identity-providers/saml/{provider_name}` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, provider_name, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/identity-providers/saml/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&provider_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_policy_view`] /// ///[`Client::silo_policy_view`]: super::Client::silo_policy_view #[derive(Debug, Clone)] pub struct SiloPolicyView<'a> { client: &'a super::Client, silo_name: Result, } impl<'a> SiloPolicyView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } ///Sends a `GET` request to `/system/silos/{silo_name}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/policy", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_policy_update`] /// ///[`Client::silo_policy_update`]: super::Client::silo_policy_update #[derive(Debug, Clone)] pub struct SiloPolicyUpdate<'a> { client: &'a super::Client, silo_name: Result, body: Result, } impl<'a> SiloPolicyUpdate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), body: Ok(types::builder::SiloRolePolicy::default()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SiloRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::SiloRolePolicy) -> types::builder::SiloRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/system/silos/{silo_name}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/policy", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_users_list`] /// ///[`Client::silo_users_list`]: super::Client::silo_users_list #[derive(Debug, Clone)] pub struct SiloUsersList<'a> { client: &'a super::Client, silo_name: Result, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SiloUsersList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/silos/{silo_name}/users/all` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, limit, page_token, sort_by, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/users/all", client.baseurl, encode_path(&silo_name.to_string()), ); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/silos/{silo_name}/users/all` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::silo_user_view`] /// ///[`Client::silo_user_view`]: super::Client::silo_user_view #[derive(Debug, Clone)] pub struct SiloUserView<'a> { client: &'a super::Client, silo_name: Result, user_id: Result, } impl<'a> SiloUserView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_name was not initialized".to_string()), user_id: Err("user_id was not initialized".to_string()), } } pub fn silo_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.silo_name = value .try_into() .map_err(|_| "conversion to `Name` for silo_name failed".to_string()); self } pub fn user_id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.user_id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for user_id failed".to_string()); self } ///Sends a `GET` request to /// `/system/silos/{silo_name}/users/id/{user_id}` pub async fn send(self) -> Result, Error> { let Self { client, silo_name, user_id, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let user_id = user_id.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/silos/{}/users/id/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&user_id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_user_list`] /// ///[`Client::system_user_list`]: super::Client::system_user_list #[derive(Debug, Clone)] pub struct SystemUserList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SystemUserList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/system/user` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/system/user", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/system/user` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::system_user_view`] /// ///[`Client::system_user_view`]: super::Client::system_user_view #[derive(Debug, Clone)] pub struct SystemUserView<'a> { client: &'a super::Client, user_name: Result, } impl<'a> SystemUserView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, user_name: Err("user_name was not initialized".to_string()), } } pub fn user_name(mut self, value: V) -> Self where V: std::convert::TryInto, { self.user_name = value .try_into() .map_err(|_| "conversion to `Name` for user_name failed".to_string()); self } ///Sends a `GET` request to `/system/user/{user_name}` pub async fn send(self) -> Result, Error> { let Self { client, user_name } = self; let user_name = user_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/system/user/{}", client.baseurl, encode_path(&user_name.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::timeseries_schema_get`] /// ///[`Client::timeseries_schema_get`]: super::Client::timeseries_schema_get #[derive(Debug, Clone)] pub struct TimeseriesSchemaGet<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, } impl<'a> TimeseriesSchemaGet<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } ///Sends a `GET` request to `/timeseries/schema` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let url = format!("{}/timeseries/schema", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/timeseries/schema` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::user_list`] /// ///[`Client::user_list`]: super::Client::user_list #[derive(Debug, Clone)] pub struct UserList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> UserList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/users` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/users", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/users` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::disk_list_v1`] /// ///[`Client::disk_list_v1`]: super::Client::disk_list_v1 #[derive(Debug, Clone)] pub struct DiskListV1<'a> { client: &'a super::Client, limit: Result, String>, organization: Result, String>, page_token: Result, String>, project: Result, String>, sort_by: Result, String>, } impl<'a> DiskListV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), organization: Ok(None), page_token: Ok(None), project: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/disks` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, organization, page_token, project, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/disks", client.baseurl,); let mut query = Vec::with_capacity(5usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/disks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), organization: Ok(None), page_token: Ok(None), project: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::disk_create_v1`] /// ///[`Client::disk_create_v1`]: super::Client::disk_create_v1 #[derive(Debug, Clone)] pub struct DiskCreateV1<'a> { client: &'a super::Client, organization: Result, String>, project: Result, body: Result, } impl<'a> DiskCreateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Ok(None), project: Err("project was not initialized".to_string()), body: Ok(types::builder::DiskCreate::default()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DiskCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::DiskCreate) -> types::builder::DiskCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/disks` pub async fn send(self) -> Result, Error> { let Self { client, organization, project, body, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/v1/disks", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } query.push(("project", project.to_string())); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::disk_view_v1`] /// ///[`Client::disk_view_v1`]: super::Client::disk_view_v1 #[derive(Debug, Clone)] pub struct DiskViewV1<'a> { client: &'a super::Client, disk: Result, organization: Result, String>, project: Result, String>, } impl<'a> DiskViewV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, disk: Err("disk was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn disk(mut self, value: V) -> Self where V: std::convert::TryInto, { self.disk = value .try_into() .map_err(|_| "conversion to `NameOrId` for disk failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `GET` request to `/v1/disks/{disk}` pub async fn send(self) -> Result, Error> { let Self { client, disk, organization, project, } = self; let disk = disk.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/disks/{}", client.baseurl, encode_path(&disk.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::disk_delete_v1`] /// ///[`Client::disk_delete_v1`]: super::Client::disk_delete_v1 #[derive(Debug, Clone)] pub struct DiskDeleteV1<'a> { client: &'a super::Client, disk: Result, organization: Result, String>, project: Result, String>, } impl<'a> DiskDeleteV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, disk: Err("disk was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn disk(mut self, value: V) -> Self where V: std::convert::TryInto, { self.disk = value .try_into() .map_err(|_| "conversion to `NameOrId` for disk failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `DELETE` request to `/v1/disks/{disk}` pub async fn send(self) -> Result, Error> { let Self { client, disk, organization, project, } = self; let disk = disk.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/disks/{}", client.baseurl, encode_path(&disk.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_list_v1`] /// ///[`Client::instance_list_v1`]: super::Client::instance_list_v1 #[derive(Debug, Clone)] pub struct InstanceListV1<'a> { client: &'a super::Client, limit: Result, String>, organization: Result, String>, page_token: Result, String>, project: Result, String>, sort_by: Result, String>, } impl<'a> InstanceListV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), organization: Ok(None), page_token: Ok(None), project: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/instances` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, organization, page_token, project, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/instances", client.baseurl,); let mut query = Vec::with_capacity(5usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/instances` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), organization: Ok(None), page_token: Ok(None), project: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::instance_create_v1`] /// ///[`Client::instance_create_v1`]: super::Client::instance_create_v1 #[derive(Debug, Clone)] pub struct InstanceCreateV1<'a> { client: &'a super::Client, organization: Result, String>, project: Result, body: Result, } impl<'a> InstanceCreateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Ok(None), project: Err("project was not initialized".to_string()), body: Ok(types::builder::InstanceCreate::default()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `InstanceCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::InstanceCreate) -> types::builder::InstanceCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/instances` pub async fn send(self) -> Result, Error> { let Self { client, organization, project, body, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/v1/instances", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } query.push(("project", project.to_string())); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_view_v1`] /// ///[`Client::instance_view_v1`]: super::Client::instance_view_v1 #[derive(Debug, Clone)] pub struct InstanceViewV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, } impl<'a> InstanceViewV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `GET` request to `/v1/instances/{instance}` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_delete_v1`] /// ///[`Client::instance_delete_v1`]: super::Client::instance_delete_v1 #[derive(Debug, Clone)] pub struct InstanceDeleteV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, } impl<'a> InstanceDeleteV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `DELETE` request to `/v1/instances/{instance}` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_disk_list_v1`] /// ///[`Client::instance_disk_list_v1`]: super::Client::instance_disk_list_v1 #[derive(Debug, Clone)] pub struct InstanceDiskListV1<'a> { client: &'a super::Client, instance: Result, limit: Result, String>, organization: Result, String>, page_token: Result, String>, project: Result, String>, sort_by: Result, String>, } impl<'a> InstanceDiskListV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), limit: Ok(None), organization: Ok(None), page_token: Ok(None), project: Ok(None), sort_by: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/instances/{instance}/disks` pub async fn send( self, ) -> Result, Error> { let Self { client, instance, limit, organization, page_token, project, sort_by, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/disks", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(5usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/instances/{instance}/disks` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), organization: Ok(None), page_token: Ok(None), project: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::instance_disk_attach_v1`] /// ///[`Client::instance_disk_attach_v1`]: super::Client::instance_disk_attach_v1 #[derive(Debug, Clone)] pub struct InstanceDiskAttachV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, body: Result, } impl<'a> InstanceDiskAttachV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), body: Ok(types::builder::DiskPath::default()), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DiskPath` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::DiskPath) -> types::builder::DiskPath, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/instances/{instance}/disks/attach` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, body, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/disks/attach", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_disk_detach_v1`] /// ///[`Client::instance_disk_detach_v1`]: super::Client::instance_disk_detach_v1 #[derive(Debug, Clone)] pub struct InstanceDiskDetachV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, body: Result, } impl<'a> InstanceDiskDetachV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), body: Ok(types::builder::DiskPath::default()), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `DiskPath` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::DiskPath) -> types::builder::DiskPath, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/instances/{instance}/disks/detach` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, body, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/disks/detach", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_migrate_v1`] /// ///[`Client::instance_migrate_v1`]: super::Client::instance_migrate_v1 #[derive(Debug, Clone)] pub struct InstanceMigrateV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, body: Result, } impl<'a> InstanceMigrateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), body: Ok(types::builder::InstanceMigrate::default()), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `InstanceMigrate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::InstanceMigrate) -> types::builder::InstanceMigrate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/instances/{instance}/migrate` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, body, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/migrate", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_reboot_v1`] /// ///[`Client::instance_reboot_v1`]: super::Client::instance_reboot_v1 #[derive(Debug, Clone)] pub struct InstanceRebootV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, } impl<'a> InstanceRebootV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `POST` request to `/v1/instances/{instance}/reboot` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/reboot", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_serial_console_v1`] /// ///[`Client::instance_serial_console_v1`]: super::Client::instance_serial_console_v1 #[derive(Debug, Clone)] pub struct InstanceSerialConsoleV1<'a> { client: &'a super::Client, instance: Result, from_start: Result, String>, max_bytes: Result, String>, most_recent: Result, String>, organization: Result, String>, project: Result, String>, } impl<'a> InstanceSerialConsoleV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), from_start: Ok(None), max_bytes: Ok(None), most_recent: Ok(None), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn from_start(mut self, value: V) -> Self where V: std::convert::TryInto, { self.from_start = value .try_into() .map(Some) .map_err(|_| "conversion to `u64` for from_start failed".to_string()); self } pub fn max_bytes(mut self, value: V) -> Self where V: std::convert::TryInto, { self.max_bytes = value .try_into() .map(Some) .map_err(|_| "conversion to `u64` for max_bytes failed".to_string()); self } pub fn most_recent(mut self, value: V) -> Self where V: std::convert::TryInto, { self.most_recent = value .try_into() .map(Some) .map_err(|_| "conversion to `u64` for most_recent failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `GET` request to `/v1/instances/{instance}/serial-console` pub async fn send( self, ) -> Result, Error> { let Self { client, instance, from_start, max_bytes, most_recent, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let from_start = from_start.map_err(Error::InvalidRequest)?; let max_bytes = max_bytes.map_err(Error::InvalidRequest)?; let most_recent = most_recent.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/serial-console", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(5usize); if let Some(v) = &from_start { query.push(("from_start", v.to_string())); } if let Some(v) = &max_bytes { query.push(("max_bytes", v.to_string())); } if let Some(v) = &most_recent { query.push(("most_recent", v.to_string())); } if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_serial_console_stream_v1`] /// ///[`Client::instance_serial_console_stream_v1`]: super::Client::instance_serial_console_stream_v1 #[derive(Debug, Clone)] pub struct InstanceSerialConsoleStreamV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, } impl<'a> InstanceSerialConsoleStreamV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `GET` request to /// `/v1/instances/{instance}/serial-console/stream` pub async fn send( self, ) -> Result, Error> { let Self { client, instance, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/serial-console/stream", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .get(url) .query(&query) .header(reqwest::header::CONNECTION, "Upgrade") .header(reqwest::header::UPGRADE, "websocket") .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") .header( reqwest::header::SEC_WEBSOCKET_KEY, base64::Engine::encode( &base64::engine::general_purpose::STANDARD, rand::random::<[u8; 16]>(), ), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 101u16 => ResponseValue::upgrade(response).await, 200..=299 => ResponseValue::upgrade(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_start_v1`] /// ///[`Client::instance_start_v1`]: super::Client::instance_start_v1 #[derive(Debug, Clone)] pub struct InstanceStartV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, } impl<'a> InstanceStartV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `POST` request to `/v1/instances/{instance}/start` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/start", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_stop_v1`] /// ///[`Client::instance_stop_v1`]: super::Client::instance_stop_v1 #[derive(Debug, Clone)] pub struct InstanceStopV1<'a> { client: &'a super::Client, instance: Result, organization: Result, String>, project: Result, String>, } impl<'a> InstanceStopV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, instance: Err("instance was not initialized".to_string()), organization: Ok(None), project: Ok(None), } } pub fn instance(mut self, value: V) -> Self where V: std::convert::TryInto, { self.instance = value .try_into() .map_err(|_| "conversion to `NameOrId` for instance failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } ///Sends a `POST` request to `/v1/instances/{instance}/stop` pub async fn send(self) -> Result, Error> { let Self { client, instance, organization, project, } = self; let instance = instance.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let project = project.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/instances/{}/stop", client.baseurl, encode_path(&instance.to_string()), ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &project { query.push(("project", v.to_string())); } let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_list_v1`] /// ///[`Client::organization_list_v1`]: super::Client::organization_list_v1 #[derive(Debug, Clone)] pub struct OrganizationListV1<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> OrganizationListV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/organizations` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/organizations", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/organizations` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::organization_create_v1`] /// ///[`Client::organization_create_v1`]: super::Client::organization_create_v1 #[derive(Debug, Clone)] pub struct OrganizationCreateV1<'a> { client: &'a super::Client, body: Result, } impl<'a> OrganizationCreateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::OrganizationCreate::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `OrganizationCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::OrganizationCreate, ) -> types::builder::OrganizationCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/organizations` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/v1/organizations", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_view_v1`] /// ///[`Client::organization_view_v1`]: super::Client::organization_view_v1 #[derive(Debug, Clone)] pub struct OrganizationViewV1<'a> { client: &'a super::Client, organization: Result, } impl<'a> OrganizationViewV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Err("organization was not initialized".to_string()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } ///Sends a `GET` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/organizations/{}", client.baseurl, encode_path(&organization.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_update_v1`] /// ///[`Client::organization_update_v1`]: super::Client::organization_update_v1 #[derive(Debug, Clone)] pub struct OrganizationUpdateV1<'a> { client: &'a super::Client, organization: Result, body: Result, } impl<'a> OrganizationUpdateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Err("organization was not initialized".to_string()), body: Ok(types::builder::OrganizationUpdate::default()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `OrganizationUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::OrganizationUpdate, ) -> types::builder::OrganizationUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { let Self { client, organization, body, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/organizations/{}", client.baseurl, encode_path(&organization.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_delete_v1`] /// ///[`Client::organization_delete_v1`]: super::Client::organization_delete_v1 #[derive(Debug, Clone)] pub struct OrganizationDeleteV1<'a> { client: &'a super::Client, organization: Result, } impl<'a> OrganizationDeleteV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Err("organization was not initialized".to_string()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } ///Sends a `DELETE` request to `/v1/organizations/{organization}` pub async fn send(self) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/organizations/{}", client.baseurl, encode_path(&organization.to_string()), ); let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_policy_view_v1`] /// ///[`Client::organization_policy_view_v1`]: super::Client::organization_policy_view_v1 #[derive(Debug, Clone)] pub struct OrganizationPolicyViewV1<'a> { client: &'a super::Client, organization: Result, } impl<'a> OrganizationPolicyViewV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Err("organization was not initialized".to_string()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } ///Sends a `GET` request to `/v1/organizations/{organization}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, organization, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/organizations/{}/policy", client.baseurl, encode_path(&organization.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::organization_policy_update_v1`] /// ///[`Client::organization_policy_update_v1`]: super::Client::organization_policy_update_v1 #[derive(Debug, Clone)] pub struct OrganizationPolicyUpdateV1<'a> { client: &'a super::Client, organization: Result, body: Result, } impl<'a> OrganizationPolicyUpdateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Err("organization was not initialized".to_string()), body: Ok(types::builder::OrganizationRolePolicy::default()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `OrganizationRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::OrganizationRolePolicy, ) -> types::builder::OrganizationRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/v1/organizations/{organization}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, organization, body, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/organizations/{}/policy", client.baseurl, encode_path(&organization.to_string()), ); let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_list_v1`] /// ///[`Client::project_list_v1`]: super::Client::project_list_v1 #[derive(Debug, Clone)] pub struct ProjectListV1<'a> { client: &'a super::Client, limit: Result, String>, organization: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> ProjectListV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), organization: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrIdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/projects` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, organization, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/projects", client.baseurl,); let mut query = Vec::with_capacity(4usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &organization { query.push(("organization", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/projects` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), organization: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::project_create_v1`] /// ///[`Client::project_create_v1`]: super::Client::project_create_v1 #[derive(Debug, Clone)] pub struct ProjectCreateV1<'a> { client: &'a super::Client, organization: Result, body: Result, } impl<'a> ProjectCreateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, organization: Err("organization was not initialized".to_string()), body: Ok(types::builder::ProjectCreate::default()), } } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ProjectCreate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::ProjectCreate) -> types::builder::ProjectCreate, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/projects` pub async fn send(self) -> Result, Error> { let Self { client, organization, body, } = self; let organization = organization.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/v1/projects", client.baseurl,); let mut query = Vec::with_capacity(1usize); query.push(("organization", organization.to_string())); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_view_v1`] /// ///[`Client::project_view_v1`]: super::Client::project_view_v1 #[derive(Debug, Clone)] pub struct ProjectViewV1<'a> { client: &'a super::Client, project: Result, organization: Result, String>, } impl<'a> ProjectViewV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, project: Err("project was not initialized".to_string()), organization: Ok(None), } } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } ///Sends a `GET` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { let Self { client, project, organization, } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/projects/{}", client.baseurl, encode_path(&project.to_string()), ); let mut query = Vec::with_capacity(1usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_update_v1`] /// ///[`Client::project_update_v1`]: super::Client::project_update_v1 #[derive(Debug, Clone)] pub struct ProjectUpdateV1<'a> { client: &'a super::Client, project: Result, organization: Result, String>, body: Result, } impl<'a> ProjectUpdateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, project: Err("project was not initialized".to_string()), organization: Ok(None), body: Ok(types::builder::ProjectUpdate::default()), } } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ProjectUpdate` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce(types::builder::ProjectUpdate) -> types::builder::ProjectUpdate, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { let Self { client, project, organization, body, } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/projects/{}", client.baseurl, encode_path(&project.to_string()), ); let mut query = Vec::with_capacity(1usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_delete_v1`] /// ///[`Client::project_delete_v1`]: super::Client::project_delete_v1 #[derive(Debug, Clone)] pub struct ProjectDeleteV1<'a> { client: &'a super::Client, project: Result, organization: Result, String>, } impl<'a> ProjectDeleteV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, project: Err("project was not initialized".to_string()), organization: Ok(None), } } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } ///Sends a `DELETE` request to `/v1/projects/{project}` pub async fn send(self) -> Result, Error> { let Self { client, project, organization, } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/projects/{}", client.baseurl, encode_path(&project.to_string()), ); let mut query = Vec::with_capacity(1usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } let request = client .client .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_policy_view_v1`] /// ///[`Client::project_policy_view_v1`]: super::Client::project_policy_view_v1 #[derive(Debug, Clone)] pub struct ProjectPolicyViewV1<'a> { client: &'a super::Client, project: Result, organization: Result, String>, } impl<'a> ProjectPolicyViewV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, project: Err("project was not initialized".to_string()), organization: Ok(None), } } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } ///Sends a `GET` request to `/v1/projects/{project}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, project, organization, } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/projects/{}/policy", client.baseurl, encode_path(&project.to_string()), ); let mut query = Vec::with_capacity(1usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::project_policy_update_v1`] /// ///[`Client::project_policy_update_v1`]: super::Client::project_policy_update_v1 #[derive(Debug, Clone)] pub struct ProjectPolicyUpdateV1<'a> { client: &'a super::Client, project: Result, organization: Result, String>, body: Result, } impl<'a> ProjectPolicyUpdateV1<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, project: Err("project was not initialized".to_string()), organization: Ok(None), body: Ok(types::builder::ProjectRolePolicy::default()), } } pub fn project(mut self, value: V) -> Self where V: std::convert::TryInto, { self.project = value .try_into() .map_err(|_| "conversion to `NameOrId` for project failed".to_string()); self } pub fn organization(mut self, value: V) -> Self where V: std::convert::TryInto, { self.organization = value .try_into() .map(Some) .map_err(|_| "conversion to `NameOrId` for organization failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `ProjectRolePolicy` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::ProjectRolePolicy, ) -> types::builder::ProjectRolePolicy, { self.body = self.body.map(f); self } ///Sends a `PUT` request to `/v1/projects/{project}/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, project, organization, body, } = self; let project = project.map_err(Error::InvalidRequest)?; let organization = organization.map_err(Error::InvalidRequest)?; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/projects/{}/policy", client.baseurl, encode_path(&project.to_string()), ); let mut query = Vec::with_capacity(1usize); if let Some(v) = &organization { query.push(("organization", v.to_string())); } let request = client .client .put(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_component_version_list`] /// ///[`Client::system_component_version_list`]: super::Client::system_component_version_list #[derive(Debug, Clone)] pub struct SystemComponentVersionList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SystemComponentVersionList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/system/update/components` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/system/update/components", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/system/update/components` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::update_deployments_list`] /// ///[`Client::update_deployments_list`]: super::Client::update_deployments_list #[derive(Debug, Clone)] pub struct UpdateDeploymentsList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> UpdateDeploymentsList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/system/update/deployments` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/system/update/deployments", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/system/update/deployments` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::update_deployment_view`] /// ///[`Client::update_deployment_view`]: super::Client::update_deployment_view #[derive(Debug, Clone)] pub struct UpdateDeploymentView<'a> { client: &'a super::Client, id: Result, } impl<'a> UpdateDeploymentView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, id: Err("id was not initialized".to_string()), } } pub fn id(mut self, value: V) -> Self where V: std::convert::TryInto, { self.id = value .try_into() .map_err(|_| "conversion to `uuid :: Uuid` for id failed".to_string()); self } ///Sends a `GET` request to `/v1/system/update/deployments/{id}` pub async fn send( self, ) -> Result, Error> { let Self { client, id } = self; let id = id.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/system/update/deployments/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_update_refresh`] /// ///[`Client::system_update_refresh`]: super::Client::system_update_refresh #[derive(Debug, Clone)] pub struct SystemUpdateRefresh<'a> { client: &'a super::Client, } impl<'a> SystemUpdateRefresh<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/v1/system/update/refresh` pub async fn send(self) -> Result, Error> { let Self { client } = self; let url = format!("{}/v1/system/update/refresh", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_update_start`] /// ///[`Client::system_update_start`]: super::Client::system_update_start #[derive(Debug, Clone)] pub struct SystemUpdateStart<'a> { client: &'a super::Client, body: Result, } impl<'a> SystemUpdateStart<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Ok(types::builder::SystemUpdateStart::default()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map(From::from) .map_err(|_| "conversion to `SystemUpdateStart` for body failed".to_string()); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( types::builder::SystemUpdateStart, ) -> types::builder::SystemUpdateStart, { self.body = self.body.map(f); self } ///Sends a `POST` request to `/v1/system/update/start` pub async fn send( self, ) -> Result, Error> { let Self { client, body } = self; let body = body .and_then(std::convert::TryInto::::try_into) .map_err(Error::InvalidRequest)?; let url = format!("{}/v1/system/update/start", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 202u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_update_stop`] /// ///[`Client::system_update_stop`]: super::Client::system_update_stop #[derive(Debug, Clone)] pub struct SystemUpdateStop<'a> { client: &'a super::Client, } impl<'a> SystemUpdateStop<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/v1/system/update/stop` pub async fn send(self) -> Result, Error> { let Self { client } = self; let url = format!("{}/v1/system/update/stop", client.baseurl,); let request = client .client .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_update_list`] /// ///[`Client::system_update_list`]: super::Client::system_update_list #[derive(Debug, Clone)] pub struct SystemUpdateList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> SystemUpdateList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), } } pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, { self.limit = value.try_into().map(Some).map_err(|_| { "conversion to `std :: num :: NonZeroU32` for limit failed".to_string() }); self } pub fn page_token(mut self, value: V) -> Self where V: std::convert::TryInto, { self.page_token = value .try_into() .map(Some) .map_err(|_| "conversion to `String` for page_token failed".to_string()); self } pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, { self.sort_by = value .try_into() .map(Some) .map_err(|_| "conversion to `IdSortMode` for sort_by failed".to_string()); self } ///Sends a `GET` request to `/v1/system/update/updates` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/system/update/updates", client.baseurl,); let mut query = Vec::with_capacity(3usize); if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/v1/system/update/updates` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: Ok(None), page_token: Ok(None), sort_by: Ok(None), ..self.clone() }; self.send() .map_ok(move |page| { let page = page.into_inner(); let first = futures::stream::iter(page.items.into_iter().map(Ok)); let rest = futures::stream::try_unfold( (page.next_page, next), |(next_page, next)| async { if next_page.is_none() { Ok(None) } else { Self { page_token: Ok(next_page), ..next.clone() } .send() .map_ok(|page| { let page = page.into_inner(); Some(( futures::stream::iter(page.items.into_iter().map(Ok)), (page.next_page, next), )) }) .await } }, ) .try_flatten(); first.chain(rest) }) .try_flatten_stream() .boxed() } } ///Builder for [`Client::system_update_view`] /// ///[`Client::system_update_view`]: super::Client::system_update_view #[derive(Debug, Clone)] pub struct SystemUpdateView<'a> { client: &'a super::Client, version: Result, } impl<'a> SystemUpdateView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, version: Err("version was not initialized".to_string()), } } pub fn version(mut self, value: V) -> Self where V: std::convert::TryInto, { self.version = value .try_into() .map_err(|_| "conversion to `SemverVersion` for version failed".to_string()); self } ///Sends a `GET` request to `/v1/system/update/updates/{version}` pub async fn send(self) -> Result, Error> { let Self { client, version } = self; let version = version.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/system/update/updates/{}", client.baseurl, encode_path(&version.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_update_components_list`] /// ///[`Client::system_update_components_list`]: super::Client::system_update_components_list #[derive(Debug, Clone)] pub struct SystemUpdateComponentsList<'a> { client: &'a super::Client, version: Result, } impl<'a> SystemUpdateComponentsList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, version: Err("version was not initialized".to_string()), } } pub fn version(mut self, value: V) -> Self where V: std::convert::TryInto, { self.version = value .try_into() .map_err(|_| "conversion to `SemverVersion` for version failed".to_string()); self } ///Sends a `GET` request to /// `/v1/system/update/updates/{version}/components` pub async fn send( self, ) -> Result, Error> { let Self { client, version } = self; let version = version.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/system/update/updates/{}/components", client.baseurl, encode_path(&version.to_string()), ); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_version`] /// ///[`Client::system_version`]: super::Client::system_version #[derive(Debug, Clone)] pub struct SystemVersion<'a> { client: &'a super::Client, } impl<'a> SystemVersion<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/v1/system/update/version` pub async fn send( self, ) -> Result, Error> { let Self { client } = self; let url = format!("{}/v1/system/update/version", client.baseurl,); let request = client .client .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } } pub mod prelude { pub use self::super::Client; }