#[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; ///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 }, } ///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 }, } ///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 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 Binint64 { pub fn builder() -> builder::Binint64 { builder::Binint64::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct BlockSize(i64); impl std::ops::Deref for BlockSize { type Target = i64; fn deref(&self) -> &Self::Target { &self.0 } } 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)) } } } ///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) -> &Self::Target { &self.0 } } ///A cumulative or counter data type. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Cumulativedouble { pub start_time: chrono::DateTime, pub value: f64, } 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 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), } ///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 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"), } } } #[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 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 DeviceAccessTokenRequest { pub fn builder() -> builder::DeviceAccessTokenRequest { builder::DeviceAccessTokenRequest::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DeviceAuthRequest { pub client_id: uuid::Uuid, } impl DeviceAuthRequest { pub fn builder() -> builder::DeviceAuthRequest { builder::DeviceAuthRequest::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DeviceAuthVerify { pub user_code: String, } 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), } ///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 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 DiskCreate { pub fn builder() -> builder::DiskCreate { builder::DiskCreate::default() } } ///Parameters for the [`Disk`](omicron_common::api::external::Disk) to be /// attached or detached to an instance #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DiskIdentifier { pub name: Name, } 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 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"), } } } ///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 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 }, } ///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, } ///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 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 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 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, }, } ///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 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 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 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"), } } } ///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 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"), } } } #[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 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"), } } } ///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 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 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 GlobalImage { pub fn builder() -> builder::GlobalImage { builder::GlobalImage::default() } } ///Create-time parameters for an /// [`GlobalImage`](omicron_common::api::external::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 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 GlobalImageResultsPage { pub fn builder() -> builder::GlobalImageResultsPage { builder::GlobalImageResultsPage::default() } } ///A simple type for managing a histogram metric. /// ///A histogram maintains the count of any number of samples, over a set of /// 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 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 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 { #[serde(rename = "id_ascending")] IdAscending, } 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"), } } } ///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 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 IdentityProviderResultsPage { pub fn builder() -> builder::IdentityProviderResultsPage { builder::IdentityProviderResultsPage::default() } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum IdentityProviderType { #[serde(rename = "saml")] Saml, } 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"), } } } ///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, } impl ToString for IdentityType { fn to_string(&self) -> String { match *self { Self::SiloUser => "silo_user".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), _ => Err("invalid value"), } } } #[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 }, } ///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 Image { pub fn builder() -> builder::Image { builder::Image::default() } } ///Create-time parameters for an /// [`Image`](omicron_common::api::external::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 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 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, } ///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 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) -> &Self::Target { &self.0 } } ///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, ///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 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, }, } ///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 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, } ///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 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 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 { #[serde(rename = "creating")] Creating, #[serde(rename = "starting")] Starting, #[serde(rename = "running")] Running, #[serde(rename = "stopping")] Stopping, #[serde(rename = "stopped")] Stopped, #[serde(rename = "rebooting")] Rebooting, #[serde(rename = "migrating")] Migrating, #[serde(rename = "repairing")] Repairing, #[serde(rename = "failed")] Failed, #[serde(rename = "destroyed")] Destroyed, } 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"), } } } ///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 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"), } } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(untagged)] pub enum IpNet { V4(Ipv4Net), V6(Ipv6Net), } impl std::convert::TryFrom<&str> for IpNet { type Error = &'static str; fn try_from(value: &str) -> Result { Err("") .or_else(|_: Self::Error| Ok(Self::V4(Ipv4Net::try_from(value)?))) .or_else(|_: Self::Error| Ok(Self::V6(Ipv6Net::try_from(value)?))) .map_err(|_: Self::Error| "string conversion failed for all variants") } } impl std::convert::TryFrom<&String> for IpNet { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for IpNet { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl ToString for IpNet { fn to_string(&self) -> String { match self { Self::V4(x) => x.to_string(), Self::V6(x) => x.to_string(), } } } ///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, #[serde(default, skip_serializing_if = "Option::is_none")] pub project_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, } impl IpPool { pub fn builder() -> builder::IpPool { builder::IpPool::default() } } ///Create-time parameters for an IP Pool. /// ///See [`IpPool`](omicron_nexus::external_api::views::IpPool) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IpPoolCreate { pub description: String, pub name: Name, #[serde(default, skip_serializing_if = "Option::is_none")] pub organization: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub project: Option, } 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 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 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 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 IpPoolUpdate { pub fn builder() -> builder::IpPoolUpdate { builder::IpPoolUpdate::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(untagged)] pub enum IpRange { V4(Ipv4Range), V6(Ipv6Range), } ///An IPv4 subnet, including prefix and subnet mask #[derive(Clone, Debug, JsonSchema, Serialize)] pub struct Ipv4Net(String); impl std::ops::Deref for Ipv4Net { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for Ipv4Net { type Error = &'static str; fn try_from(value: &str) -> Result { if regress :: Regex :: new ("^(10\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([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])|172\\.(1[6-9]|2[0-9]|3[0-1])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\/(1[2-9]|2[0-9]|3[0-2])|192\\.168\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\/(1[6-9]|2[0-9]|3[0-2]))$") . unwrap () . find (value) . is_none () { return Err ("doesn't match pattern \"^(10\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([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])|172\\.(1[6-9]|2[0-9]|3[0-1])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\/(1[2-9]|2[0-9]|3[0-2])|192\\.168\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\/(1[6-9]|2[0-9]|3[0-2]))$\"") ; } Ok(Self(value.to_string())) } } impl std::convert::TryFrom<&String> for Ipv4Net { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for Ipv4Net { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for Ipv4Net { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::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 Ipv4Range { pub fn builder() -> builder::Ipv4Range { builder::Ipv4Range::default() } } ///An IPv6 subnet, including prefix and subnet mask #[derive(Clone, Debug, JsonSchema, Serialize)] pub struct Ipv6Net(String); impl std::ops::Deref for Ipv6Net { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for Ipv6Net { type Error = &'static str; fn try_from(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<&String> for Ipv6Net { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for Ipv6Net { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for Ipv6Net { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::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 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, JsonSchema, Serialize)] pub struct L4PortRange(String); impl std::ops::Deref for L4PortRange { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for L4PortRange { type Error = &'static str; fn try_from(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<&String> for L4PortRange { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for L4PortRange { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for L4PortRange { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::custom(e.to_string())) } } ///A Media Access Control address, in EUI-48 format #[derive(Clone, Debug, JsonSchema, Serialize)] pub struct MacAddr(String); impl std::ops::Deref for MacAddr { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for MacAddr { type Error = &'static str; fn try_from(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<&String> for MacAddr { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for MacAddr { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for MacAddr { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::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 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 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, Hash, JsonSchema, Serialize)] pub struct Name(String); impl std::ops::Deref for Name { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for Name { type Error = &'static str; fn try_from(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<&String> for Name { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for Name { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for Name { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::custom(e.to_string())) } } ///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 { #[serde(rename = "name_ascending")] NameAscending, #[serde(rename = "name_descending")] NameDescending, #[serde(rename = "id_ascending")] IdAscending, } 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"), } } } ///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 { #[serde(rename = "name_ascending")] NameAscending, } 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"), } } } ///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 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 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 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, ///Make a secondary interface the instance's primary interface. /// ///If applied to a secondary interface, that interface will become the /// primary on the next reboot of the instance. Note that this may have /// implications for routing between instances, as the new primary /// interface will be on a distinct subnet from the previous primary /// interface. /// ///Note that this can only be used to select a new primary interface /// for an instance. Requests to change the primary interface into a /// secondary will return an error. #[serde(default)] pub make_primary: bool, #[serde(default, skip_serializing_if = "Option::is_none")] pub name: Option, } impl NetworkInterfaceUpdate { pub fn builder() -> builder::NetworkInterfaceUpdate { builder::NetworkInterfaceUpdate::default() } } ///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 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 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 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 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"), } } } ///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 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 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 OrganizationUpdate { pub fn builder() -> builder::OrganizationUpdate { builder::OrganizationUpdate::default() } } ///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 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 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 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 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"), } } } ///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 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 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 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 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 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 Role { pub fn builder() -> builder::Role { builder::Role::default() } } ///Role names consist of two string components separated by dot ("."). #[derive(Clone, Debug, JsonSchema, Serialize)] pub struct RoleName(String); impl std::ops::Deref for RoleName { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for RoleName { type Error = &'static str; fn try_from(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<&String> for RoleName { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for RoleName { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for RoleName { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::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 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), } ///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), } ///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 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 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 { #[serde(rename = "default")] Default, #[serde(rename = "vpc_subnet")] VpcSubnet, #[serde(rename = "vpc_peering")] VpcPeering, #[serde(rename = "custom")] Custom, } 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"), } } } ///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 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 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 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 }, } ///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 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: String, }, } ///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 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, ///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 SamlIdentityProviderCreate { pub fn builder() -> builder::SamlIdentityProviderCreate { builder::SamlIdentityProviderCreate::default() } } ///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, ///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, ///User provision type pub user_provision_type: UserProvisionType, } impl Silo { pub fn builder() -> builder::Silo { builder::Silo::default() } } ///Create-time parameters for a [`Silo`](crate::external_api::views::Silo) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SiloCreate { pub description: String, pub discoverable: bool, pub name: Name, pub user_provision_type: UserProvisionType, } impl SiloCreate { pub fn builder() -> builder::SiloCreate { builder::SiloCreate::default() } } ///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 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 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"), } } } ///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 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 SiloRoleRoleAssignment { pub fn builder() -> builder::SiloRoleRoleAssignment { builder::SiloRoleRoleAssignment::default() } } ///Client view of an [`Sled`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Sled { ///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 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 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, ///timestamp when this resource was created pub time_created: chrono::DateTime, ///timestamp when this resource was last modified pub time_modified: chrono::DateTime, } impl Snapshot { pub fn builder() -> builder::Snapshot { builder::Snapshot::default() } } ///Create-time parameters for a /// [`Snapshot`](omicron_common::api::external::Snapshot) #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SnapshotCreate { pub description: String, ///The name of the disk to be snapshotted pub disk: Name, pub name: Name, } 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 SnapshotResultsPage { pub fn builder() -> builder::SnapshotResultsPage { builder::SnapshotResultsPage::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct SpoofLoginBody { pub username: String, } impl SpoofLoginBody { pub fn builder() -> builder::SpoofLoginBody { builder::SpoofLoginBody::default() } } ///Client view of a [`SshKey`] #[derive(Clone, Debug, Deserialize, 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 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 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 SshKeyResultsPage { pub fn builder() -> builder::SshKeyResultsPage { builder::SshKeyResultsPage::default() } } ///Names are constructed by concatenating the target and metric names with /// ':'. Target and metric names must be lowercase alphanumeric characters /// with '_' separating words. #[derive(Clone, Debug, JsonSchema, Serialize)] pub struct TimeseriesName(String); impl std::ops::Deref for TimeseriesName { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl std::convert::TryFrom<&str> for TimeseriesName { type Error = &'static str; fn try_from(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<&String> for TimeseriesName { type Error = &'static str; fn try_from(value: &String) -> Result { Self::try_from(value.as_str()) } } impl std::convert::TryFrom for TimeseriesName { type Error = &'static str; fn try_from(value: String) -> Result { Self::try_from(value.as_str()) } } impl<'de> serde::Deserialize<'de> for TimeseriesName { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { Self::try_from(String::deserialize(deserializer)?) .map_err(|e| ::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 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 TimeseriesSchemaResultsPage { pub fn builder() -> builder::TimeseriesSchemaResultsPage { builder::TimeseriesSchemaResultsPage::default() } } ///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, } 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 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 UserBuiltinResultsPage { pub fn builder() -> builder::UserBuiltinResultsPage { builder::UserBuiltinResultsPage::default() } } ///How users will be provisioned in a silo during authentication. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum UserProvisionType { #[serde(rename = "fixed")] Fixed, #[serde(rename = "jit")] Jit, } impl ToString for UserProvisionType { fn to_string(&self) -> String { match *self { Self::Fixed => "fixed".to_string(), Self::Jit => "jit".to_string(), } } } impl std::str::FromStr for UserProvisionType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { "fixed" => Ok(Self::Fixed), "jit" => Ok(Self::Jit), _ => Err("invalid 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 UserResultsPage { pub fn builder() -> builder::UserResultsPage { builder::UserResultsPage::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 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 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 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 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"), } } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcFirewallRuleDirection { #[serde(rename = "inbound")] Inbound, #[serde(rename = "outbound")] Outbound, } 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"), } } } ///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 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), } ///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 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"), } } } #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] pub enum VpcFirewallRuleStatus { #[serde(rename = "disabled")] Disabled, #[serde(rename = "enabled")] Enabled, } 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"), } } } ///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), } ///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 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 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 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 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 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 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 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"), } } } ///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 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 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 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 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 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 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 VpcUpdate { pub fn builder() -> builder::VpcUpdate { builder::VpcUpdate::default() } } mod builder { pub struct Bindouble { count: Result, range: Result, } impl Default for Bindouble { fn default() -> Self { Self { count: Err("no value supplied for count".to_string()), range: Err("no value supplied for range".to_string()), } } } impl Bindouble { pub fn count(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.count = value .try_into() .map_err(|e| format!("error converting supplied value for count: {}", e)); self } pub fn range(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.range = value .try_into() .map_err(|e| format!("error converting supplied value for range: {}", e)); self } } impl std::convert::TryFrom for super::Bindouble { type Error = String; fn try_from(value: Bindouble) -> Result { Ok(Self { count: value.count?, range: value.range?, }) } } pub struct Binint64 { count: Result, range: Result, } impl Default for Binint64 { fn default() -> Self { Self { count: Err("no value supplied for count".to_string()), range: Err("no value supplied for range".to_string()), } } } impl Binint64 { pub fn count(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.count = value .try_into() .map_err(|e| format!("error converting supplied value for count: {}", e)); self } pub fn range(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.range = value .try_into() .map_err(|e| format!("error converting supplied value for range: {}", e)); self } } impl std::convert::TryFrom for super::Binint64 { type Error = String; fn try_from(value: Binint64) -> Result { Ok(Self { count: value.count?, range: value.range?, }) } } pub struct Cumulativedouble { start_time: Result, String>, value: Result, } impl Default for Cumulativedouble { fn default() -> Self { Self { start_time: Err("no value supplied for start_time".to_string()), value: Err("no value supplied for value".to_string()), } } } impl Cumulativedouble { pub fn start_time(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.start_time = value .try_into() .map_err(|e| format!("error converting supplied value for start_time: {}", e)); self } pub fn value(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.value = value .try_into() .map_err(|e| format!("error converting supplied value for value: {}", e)); self } } impl std::convert::TryFrom for super::Cumulativedouble { type Error = String; fn try_from(value: Cumulativedouble) -> Result { Ok(Self { start_time: value.start_time?, value: value.value?, }) } } pub struct Cumulativeint64 { start_time: Result, String>, value: Result, } impl Default for Cumulativeint64 { fn default() -> Self { Self { start_time: Err("no value supplied for start_time".to_string()), value: Err("no value supplied for value".to_string()), } } } impl Cumulativeint64 { pub fn start_time(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.start_time = value .try_into() .map_err(|e| format!("error converting supplied value for start_time: {}", e)); self } pub fn value(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.value = value .try_into() .map_err(|e| format!("error converting supplied value for value: {}", e)); self } } impl std::convert::TryFrom for super::Cumulativeint64 { type Error = String; fn try_from(value: Cumulativeint64) -> Result { Ok(Self { start_time: value.start_time?, value: value.value?, }) } } pub struct DerEncodedKeyPair { private_key: Result, public_cert: Result, } impl Default for DerEncodedKeyPair { fn default() -> Self { Self { private_key: Err("no value supplied for private_key".to_string()), public_cert: Err("no value supplied for public_cert".to_string()), } } } impl DerEncodedKeyPair { pub fn private_key(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.private_key = value .try_into() .map_err(|e| format!("error converting supplied value for private_key: {}", e)); self } pub fn public_cert(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.public_cert = value .try_into() .map_err(|e| format!("error converting supplied value for public_cert: {}", e)); self } } impl std::convert::TryFrom for super::DerEncodedKeyPair { type Error = String; fn try_from(value: DerEncodedKeyPair) -> Result { Ok(Self { private_key: value.private_key?, public_cert: value.public_cert?, }) } } pub struct DeviceAccessTokenRequest { client_id: Result, device_code: Result, grant_type: Result, } impl Default for DeviceAccessTokenRequest { fn default() -> Self { Self { client_id: Err("no value supplied for client_id".to_string()), device_code: Err("no value supplied for device_code".to_string()), grant_type: Err("no value supplied for grant_type".to_string()), } } } impl DeviceAccessTokenRequest { pub fn client_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.client_id = value .try_into() .map_err(|e| format!("error converting supplied value for client_id: {}", e)); self } pub fn device_code(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.device_code = value .try_into() .map_err(|e| format!("error converting supplied value for device_code: {}", e)); self } pub fn grant_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.grant_type = value .try_into() .map_err(|e| format!("error converting supplied value for grant_type: {}", e)); self } } impl std::convert::TryFrom for super::DeviceAccessTokenRequest { type Error = String; fn try_from(value: DeviceAccessTokenRequest) -> Result { Ok(Self { client_id: value.client_id?, device_code: value.device_code?, grant_type: value.grant_type?, }) } } pub struct DeviceAuthRequest { client_id: Result, } impl Default for DeviceAuthRequest { fn default() -> Self { Self { client_id: Err("no value supplied for client_id".to_string()), } } } impl DeviceAuthRequest { pub fn client_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.client_id = value .try_into() .map_err(|e| format!("error converting supplied value for client_id: {}", e)); self } } impl std::convert::TryFrom for super::DeviceAuthRequest { type Error = String; fn try_from(value: DeviceAuthRequest) -> Result { Ok(Self { client_id: value.client_id?, }) } } pub struct DeviceAuthVerify { user_code: Result, } impl Default for DeviceAuthVerify { fn default() -> Self { Self { user_code: Err("no value supplied for user_code".to_string()), } } } impl DeviceAuthVerify { pub fn user_code(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.user_code = value .try_into() .map_err(|e| format!("error converting supplied value for user_code: {}", e)); self } } impl std::convert::TryFrom for super::DeviceAuthVerify { type Error = String; fn try_from(value: DeviceAuthVerify) -> Result { Ok(Self { user_code: value.user_code?, }) } } pub struct Disk { block_size: Result, description: Result, device_path: Result, id: Result, image_id: Result, String>, name: Result, project_id: Result, size: Result, snapshot_id: Result, String>, state: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Disk { fn default() -> Self { Self { block_size: Err("no value supplied for block_size".to_string()), description: Err("no value supplied for description".to_string()), device_path: Err("no value supplied for device_path".to_string()), id: Err("no value supplied for id".to_string()), image_id: Ok(Default::default()), name: Err("no value supplied for name".to_string()), project_id: Err("no value supplied for project_id".to_string()), size: Err("no value supplied for size".to_string()), snapshot_id: Ok(Default::default()), state: Err("no value supplied for state".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Disk { pub fn block_size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.block_size = value .try_into() .map_err(|e| format!("error converting supplied value for block_size: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn device_path(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.device_path = value .try_into() .map_err(|e| format!("error converting supplied value for device_path: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn image_id(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.image_id = value .try_into() .map_err(|e| format!("error converting supplied value for image_id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn project_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.project_id = value .try_into() .map_err(|e| format!("error converting supplied value for project_id: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } pub fn snapshot_id(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.snapshot_id = value .try_into() .map_err(|e| format!("error converting supplied value for snapshot_id: {}", e)); self } pub fn state(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.state = value .try_into() .map_err(|e| format!("error converting supplied value for state: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Disk { type Error = String; fn try_from(value: Disk) -> Result { Ok(Self { block_size: value.block_size?, description: value.description?, device_path: value.device_path?, id: value.id?, image_id: value.image_id?, name: value.name?, project_id: value.project_id?, size: value.size?, snapshot_id: value.snapshot_id?, state: value.state?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct DiskCreate { description: Result, disk_source: Result, name: Result, size: Result, } impl Default for DiskCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), disk_source: Err("no value supplied for disk_source".to_string()), name: Err("no value supplied for name".to_string()), size: Err("no value supplied for size".to_string()), } } } impl DiskCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn disk_source(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.disk_source = value .try_into() .map_err(|e| format!("error converting supplied value for disk_source: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } } impl std::convert::TryFrom for super::DiskCreate { type Error = String; fn try_from(value: DiskCreate) -> Result { Ok(Self { description: value.description?, disk_source: value.disk_source?, name: value.name?, size: value.size?, }) } } pub struct DiskIdentifier { name: Result, } impl Default for DiskIdentifier { fn default() -> Self { Self { name: Err("no value supplied for name".to_string()), } } } impl DiskIdentifier { pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::DiskIdentifier { type Error = String; fn try_from(value: DiskIdentifier) -> Result { Ok(Self { name: value.name? }) } } pub struct DiskResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for DiskResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl DiskResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::DiskResultsPage { type Error = String; fn try_from(value: DiskResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Distribution { name: Result, version: Result, } impl Default for Distribution { fn default() -> Self { Self { name: Err("no value supplied for name".to_string()), version: Err("no value supplied for version".to_string()), } } } impl Distribution { pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn version(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.version = value .try_into() .map_err(|e| format!("error converting supplied value for version: {}", e)); self } } impl std::convert::TryFrom for super::Distribution { type Error = String; fn try_from(value: Distribution) -> Result { Ok(Self { name: value.name?, version: value.version?, }) } } pub struct Error { error_code: Result, String>, message: Result, request_id: Result, } impl Default for Error { fn default() -> Self { Self { error_code: Ok(Default::default()), message: Err("no value supplied for message".to_string()), request_id: Err("no value supplied for request_id".to_string()), } } } impl Error { pub fn error_code(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.error_code = value .try_into() .map_err(|e| format!("error converting supplied value for error_code: {}", e)); self } pub fn message(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.message = value .try_into() .map_err(|e| format!("error converting supplied value for message: {}", e)); self } pub fn request_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.request_id = value .try_into() .map_err(|e| format!("error converting supplied value for request_id: {}", e)); self } } impl std::convert::TryFrom for super::Error { type Error = String; fn try_from(value: Error) -> Result { Ok(Self { error_code: value.error_code?, message: value.message?, request_id: value.request_id?, }) } } pub struct ExternalIp { ip: Result, kind: Result, } impl Default for ExternalIp { fn default() -> Self { Self { ip: Err("no value supplied for ip".to_string()), kind: Err("no value supplied for kind".to_string()), } } } impl ExternalIp { pub fn ip(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ip = value .try_into() .map_err(|e| format!("error converting supplied value for ip: {}", e)); self } pub fn kind(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.kind = value .try_into() .map_err(|e| format!("error converting supplied value for kind: {}", e)); self } } impl std::convert::TryFrom for super::ExternalIp { type Error = String; fn try_from(value: ExternalIp) -> Result { Ok(Self { ip: value.ip?, kind: value.kind?, }) } } pub struct ExternalIpResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for ExternalIpResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl ExternalIpResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::ExternalIpResultsPage { type Error = String; fn try_from(value: ExternalIpResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct FieldSchema { name: Result, source: Result, ty: Result, } impl Default for FieldSchema { fn default() -> Self { Self { name: Err("no value supplied for name".to_string()), source: Err("no value supplied for source".to_string()), ty: Err("no value supplied for ty".to_string()), } } } impl FieldSchema { pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn source(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.source = value .try_into() .map_err(|e| format!("error converting supplied value for source: {}", e)); self } pub fn ty(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ty = value .try_into() .map_err(|e| format!("error converting supplied value for ty: {}", e)); self } } impl std::convert::TryFrom for super::FieldSchema { type Error = String; fn try_from(value: FieldSchema) -> Result { Ok(Self { name: value.name?, source: value.source?, ty: value.ty?, }) } } pub struct FleetRolePolicy { role_assignments: Result, String>, } impl Default for FleetRolePolicy { fn default() -> Self { Self { role_assignments: Err("no value supplied for role_assignments".to_string()), } } } impl FleetRolePolicy { pub fn role_assignments(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.role_assignments = value.try_into().map_err(|e| { format!( "error converting supplied value for role_assignments: {}", e ) }); self } } impl std::convert::TryFrom for super::FleetRolePolicy { type Error = String; fn try_from(value: FleetRolePolicy) -> Result { Ok(Self { role_assignments: value.role_assignments?, }) } } pub struct FleetRoleRoleAssignment { identity_id: Result, identity_type: Result, role_name: Result, } impl Default for FleetRoleRoleAssignment { fn default() -> Self { Self { identity_id: Err("no value supplied for identity_id".to_string()), identity_type: Err("no value supplied for identity_type".to_string()), role_name: Err("no value supplied for role_name".to_string()), } } } impl FleetRoleRoleAssignment { pub fn identity_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_id = value .try_into() .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); self } pub fn identity_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_type = value.try_into().map_err(|e| { format!("error converting supplied value for identity_type: {}", e) }); self } pub fn role_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.role_name = value .try_into() .map_err(|e| format!("error converting supplied value for role_name: {}", e)); self } } impl std::convert::TryFrom for super::FleetRoleRoleAssignment { type Error = String; fn try_from(value: FleetRoleRoleAssignment) -> Result { Ok(Self { identity_id: value.identity_id?, identity_type: value.identity_type?, role_name: value.role_name?, }) } } pub struct GlobalImage { block_size: Result, description: Result, digest: Result, String>, distribution: Result, id: Result, name: Result, size: Result, time_created: Result, String>, time_modified: Result, String>, url: Result, String>, version: Result, } impl Default for GlobalImage { fn default() -> Self { Self { block_size: Err("no value supplied for block_size".to_string()), description: Err("no value supplied for description".to_string()), digest: Ok(Default::default()), distribution: Err("no value supplied for distribution".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), size: Err("no value supplied for size".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), url: Ok(Default::default()), version: Err("no value supplied for version".to_string()), } } } impl GlobalImage { pub fn block_size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.block_size = value .try_into() .map_err(|e| format!("error converting supplied value for block_size: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn digest(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.digest = value .try_into() .map_err(|e| format!("error converting supplied value for digest: {}", e)); self } pub fn distribution(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.distribution = value.try_into().map_err(|e| { format!("error converting supplied value for distribution: {}", e) }); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn url(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.url = value .try_into() .map_err(|e| format!("error converting supplied value for url: {}", e)); self } pub fn version(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.version = value .try_into() .map_err(|e| format!("error converting supplied value for version: {}", e)); self } } impl std::convert::TryFrom for super::GlobalImage { type Error = String; fn try_from(value: GlobalImage) -> Result { Ok(Self { block_size: value.block_size?, description: value.description?, digest: value.digest?, distribution: value.distribution?, id: value.id?, name: value.name?, size: value.size?, time_created: value.time_created?, time_modified: value.time_modified?, url: value.url?, version: value.version?, }) } } pub struct GlobalImageCreate { block_size: Result, description: Result, distribution: Result, name: Result, source: Result, } impl Default for GlobalImageCreate { fn default() -> Self { Self { block_size: Err("no value supplied for block_size".to_string()), description: Err("no value supplied for description".to_string()), distribution: Err("no value supplied for distribution".to_string()), name: Err("no value supplied for name".to_string()), source: Err("no value supplied for source".to_string()), } } } impl GlobalImageCreate { pub fn block_size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.block_size = value .try_into() .map_err(|e| format!("error converting supplied value for block_size: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn distribution(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.distribution = value.try_into().map_err(|e| { format!("error converting supplied value for distribution: {}", e) }); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn source(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.source = value .try_into() .map_err(|e| format!("error converting supplied value for source: {}", e)); self } } impl std::convert::TryFrom for super::GlobalImageCreate { type Error = String; fn try_from(value: GlobalImageCreate) -> Result { Ok(Self { block_size: value.block_size?, description: value.description?, distribution: value.distribution?, name: value.name?, source: value.source?, }) } } pub struct GlobalImageResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for GlobalImageResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl GlobalImageResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::GlobalImageResultsPage { type Error = String; fn try_from(value: GlobalImageResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Histogramdouble { bins: Result, String>, n_samples: Result, start_time: Result, String>, } impl Default for Histogramdouble { fn default() -> Self { Self { bins: Err("no value supplied for bins".to_string()), n_samples: Err("no value supplied for n_samples".to_string()), start_time: Err("no value supplied for start_time".to_string()), } } } impl Histogramdouble { pub fn bins(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.bins = value .try_into() .map_err(|e| format!("error converting supplied value for bins: {}", e)); self } pub fn n_samples(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.n_samples = value .try_into() .map_err(|e| format!("error converting supplied value for n_samples: {}", e)); self } pub fn start_time(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.start_time = value .try_into() .map_err(|e| format!("error converting supplied value for start_time: {}", e)); self } } impl std::convert::TryFrom for super::Histogramdouble { type Error = String; fn try_from(value: Histogramdouble) -> Result { Ok(Self { bins: value.bins?, n_samples: value.n_samples?, start_time: value.start_time?, }) } } pub struct Histogramint64 { bins: Result, String>, n_samples: Result, start_time: Result, String>, } impl Default for Histogramint64 { fn default() -> Self { Self { bins: Err("no value supplied for bins".to_string()), n_samples: Err("no value supplied for n_samples".to_string()), start_time: Err("no value supplied for start_time".to_string()), } } } impl Histogramint64 { pub fn bins(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.bins = value .try_into() .map_err(|e| format!("error converting supplied value for bins: {}", e)); self } pub fn n_samples(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.n_samples = value .try_into() .map_err(|e| format!("error converting supplied value for n_samples: {}", e)); self } pub fn start_time(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.start_time = value .try_into() .map_err(|e| format!("error converting supplied value for start_time: {}", e)); self } } impl std::convert::TryFrom for super::Histogramint64 { type Error = String; fn try_from(value: Histogramint64) -> Result { Ok(Self { bins: value.bins?, n_samples: value.n_samples?, start_time: value.start_time?, }) } } pub struct IdentityProvider { description: Result, id: Result, name: Result, provider_type: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for IdentityProvider { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), provider_type: Err("no value supplied for provider_type".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl IdentityProvider { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn provider_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.provider_type = value.try_into().map_err(|e| { format!("error converting supplied value for provider_type: {}", e) }); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::IdentityProvider { type Error = String; fn try_from(value: IdentityProvider) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, provider_type: value.provider_type?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct IdentityProviderResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for IdentityProviderResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl IdentityProviderResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::IdentityProviderResultsPage { type Error = String; fn try_from(value: IdentityProviderResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Image { block_size: Result, description: Result, digest: Result, String>, id: Result, name: Result, project_id: Result, size: Result, time_created: Result, String>, time_modified: Result, String>, url: Result, String>, version: Result, String>, } impl Default for Image { fn default() -> Self { Self { block_size: Err("no value supplied for block_size".to_string()), description: Err("no value supplied for description".to_string()), digest: Ok(Default::default()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), project_id: Err("no value supplied for project_id".to_string()), size: Err("no value supplied for size".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), url: Ok(Default::default()), version: Ok(Default::default()), } } } impl Image { pub fn block_size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.block_size = value .try_into() .map_err(|e| format!("error converting supplied value for block_size: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn digest(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.digest = value .try_into() .map_err(|e| format!("error converting supplied value for digest: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn project_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.project_id = value .try_into() .map_err(|e| format!("error converting supplied value for project_id: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn url(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.url = value .try_into() .map_err(|e| format!("error converting supplied value for url: {}", e)); self } pub fn version(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.version = value .try_into() .map_err(|e| format!("error converting supplied value for version: {}", e)); self } } impl std::convert::TryFrom for super::Image { type Error = String; fn try_from(value: Image) -> Result { Ok(Self { block_size: value.block_size?, description: value.description?, digest: value.digest?, id: value.id?, name: value.name?, project_id: value.project_id?, size: value.size?, time_created: value.time_created?, time_modified: value.time_modified?, url: value.url?, version: value.version?, }) } } pub struct ImageCreate { block_size: Result, description: Result, name: Result, source: Result, } impl Default for ImageCreate { fn default() -> Self { Self { block_size: Err("no value supplied for block_size".to_string()), description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), source: Err("no value supplied for source".to_string()), } } } impl ImageCreate { pub fn block_size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.block_size = value .try_into() .map_err(|e| format!("error converting supplied value for block_size: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn source(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.source = value .try_into() .map_err(|e| format!("error converting supplied value for source: {}", e)); self } } impl std::convert::TryFrom for super::ImageCreate { type Error = String; fn try_from(value: ImageCreate) -> Result { Ok(Self { block_size: value.block_size?, description: value.description?, name: value.name?, source: value.source?, }) } } pub struct ImageResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for ImageResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl ImageResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::ImageResultsPage { type Error = String; fn try_from(value: ImageResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Instance { description: Result, hostname: Result, id: Result, memory: Result, name: Result, ncpus: Result, project_id: Result, run_state: Result, time_created: Result, String>, time_modified: Result, String>, time_run_state_updated: Result, String>, } impl Default for Instance { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), hostname: Err("no value supplied for hostname".to_string()), id: Err("no value supplied for id".to_string()), memory: Err("no value supplied for memory".to_string()), name: Err("no value supplied for name".to_string()), ncpus: Err("no value supplied for ncpus".to_string()), project_id: Err("no value supplied for project_id".to_string()), run_state: Err("no value supplied for run_state".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), time_run_state_updated: Err( "no value supplied for time_run_state_updated".to_string() ), } } } impl Instance { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn hostname(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.hostname = value .try_into() .map_err(|e| format!("error converting supplied value for hostname: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn memory(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.memory = value .try_into() .map_err(|e| format!("error converting supplied value for memory: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn ncpus(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ncpus = value .try_into() .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); self } pub fn project_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.project_id = value .try_into() .map_err(|e| format!("error converting supplied value for project_id: {}", e)); self } pub fn run_state(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.run_state = value .try_into() .map_err(|e| format!("error converting supplied value for run_state: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn time_run_state_updated(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_run_state_updated = value.try_into().map_err(|e| { format!( "error converting supplied value for time_run_state_updated: {}", e ) }); self } } impl std::convert::TryFrom for super::Instance { type Error = String; fn try_from(value: Instance) -> Result { Ok(Self { description: value.description?, hostname: value.hostname?, id: value.id?, memory: value.memory?, name: value.name?, ncpus: value.ncpus?, project_id: value.project_id?, run_state: value.run_state?, time_created: value.time_created?, time_modified: value.time_modified?, time_run_state_updated: value.time_run_state_updated?, }) } } pub struct InstanceCreate { description: Result, disks: Result, String>, external_ips: Result, String>, hostname: Result, memory: Result, name: Result, ncpus: Result, network_interfaces: Result, user_data: Result, } impl Default for InstanceCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), disks: Ok(Default::default()), external_ips: Ok(Default::default()), hostname: Err("no value supplied for hostname".to_string()), memory: Err("no value supplied for memory".to_string()), name: Err("no value supplied for name".to_string()), ncpus: Err("no value supplied for ncpus".to_string()), network_interfaces: Ok(super::defaults::instance_create_network_interfaces()), user_data: Ok(Default::default()), } } } impl InstanceCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn disks(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.disks = value .try_into() .map_err(|e| format!("error converting supplied value for disks: {}", e)); self } pub fn external_ips(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.external_ips = value.try_into().map_err(|e| { format!("error converting supplied value for external_ips: {}", e) }); self } pub fn hostname(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.hostname = value .try_into() .map_err(|e| format!("error converting supplied value for hostname: {}", e)); self } pub fn memory(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.memory = value .try_into() .map_err(|e| format!("error converting supplied value for memory: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn ncpus(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ncpus = value .try_into() .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); self } pub fn network_interfaces(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.network_interfaces = value.try_into().map_err(|e| { format!( "error converting supplied value for network_interfaces: {}", e ) }); self } pub fn user_data(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.user_data = value .try_into() .map_err(|e| format!("error converting supplied value for user_data: {}", e)); self } } impl std::convert::TryFrom for super::InstanceCreate { type Error = String; fn try_from(value: InstanceCreate) -> Result { Ok(Self { description: value.description?, disks: value.disks?, external_ips: value.external_ips?, hostname: value.hostname?, memory: value.memory?, name: value.name?, ncpus: value.ncpus?, network_interfaces: value.network_interfaces?, user_data: value.user_data?, }) } } pub struct InstanceMigrate { dst_sled_id: Result, } impl Default for InstanceMigrate { fn default() -> Self { Self { dst_sled_id: Err("no value supplied for dst_sled_id".to_string()), } } } impl InstanceMigrate { pub fn dst_sled_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.dst_sled_id = value .try_into() .map_err(|e| format!("error converting supplied value for dst_sled_id: {}", e)); self } } impl std::convert::TryFrom for super::InstanceMigrate { type Error = String; fn try_from(value: InstanceMigrate) -> Result { Ok(Self { dst_sled_id: value.dst_sled_id?, }) } } pub struct InstanceResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for InstanceResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl InstanceResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::InstanceResultsPage { type Error = String; fn try_from(value: InstanceResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct InstanceSerialConsoleData { data: Result, String>, last_byte_offset: Result, } impl Default for InstanceSerialConsoleData { fn default() -> Self { Self { data: Err("no value supplied for data".to_string()), last_byte_offset: Err("no value supplied for last_byte_offset".to_string()), } } } impl InstanceSerialConsoleData { pub fn data(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.data = value .try_into() .map_err(|e| format!("error converting supplied value for data: {}", e)); self } pub fn last_byte_offset(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.last_byte_offset = value.try_into().map_err(|e| { format!( "error converting supplied value for last_byte_offset: {}", e ) }); self } } impl std::convert::TryFrom for super::InstanceSerialConsoleData { type Error = String; fn try_from(value: InstanceSerialConsoleData) -> Result { Ok(Self { data: value.data?, last_byte_offset: value.last_byte_offset?, }) } } pub struct IpPool { description: Result, id: Result, name: Result, project_id: Result, String>, time_created: Result, String>, time_modified: Result, String>, } impl Default for IpPool { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), project_id: Ok(Default::default()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl IpPool { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn project_id(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.project_id = value .try_into() .map_err(|e| format!("error converting supplied value for project_id: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::IpPool { type Error = String; fn try_from(value: IpPool) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, project_id: value.project_id?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct IpPoolCreate { description: Result, name: Result, organization: Result, String>, project: Result, String>, } impl Default for IpPoolCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), organization: Ok(Default::default()), project: Ok(Default::default()), } } } impl IpPoolCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn organization(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.organization = value.try_into().map_err(|e| { format!("error converting supplied value for organization: {}", e) }); self } pub fn project(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.project = value .try_into() .map_err(|e| format!("error converting supplied value for project: {}", e)); self } } impl std::convert::TryFrom for super::IpPoolCreate { type Error = String; fn try_from(value: IpPoolCreate) -> Result { Ok(Self { description: value.description?, name: value.name?, organization: value.organization?, project: value.project?, }) } } pub struct IpPoolRange { id: Result, range: Result, time_created: Result, String>, } impl Default for IpPoolRange { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), range: Err("no value supplied for range".to_string()), time_created: Err("no value supplied for time_created".to_string()), } } } impl IpPoolRange { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn range(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.range = value .try_into() .map_err(|e| format!("error converting supplied value for range: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } } impl std::convert::TryFrom for super::IpPoolRange { type Error = String; fn try_from(value: IpPoolRange) -> Result { Ok(Self { id: value.id?, range: value.range?, time_created: value.time_created?, }) } } pub struct IpPoolRangeResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for IpPoolRangeResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl IpPoolRangeResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::IpPoolRangeResultsPage { type Error = String; fn try_from(value: IpPoolRangeResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct IpPoolResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for IpPoolResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl IpPoolResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::IpPoolResultsPage { type Error = String; fn try_from(value: IpPoolResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct IpPoolUpdate { description: Result, String>, name: Result, String>, } impl Default for IpPoolUpdate { fn default() -> Self { Self { description: Ok(Default::default()), name: Ok(Default::default()), } } } impl IpPoolUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::IpPoolUpdate { type Error = String; fn try_from(value: IpPoolUpdate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct Ipv4Range { first: Result, last: Result, } impl Default for Ipv4Range { fn default() -> Self { Self { first: Err("no value supplied for first".to_string()), last: Err("no value supplied for last".to_string()), } } } impl Ipv4Range { pub fn first(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.first = value .try_into() .map_err(|e| format!("error converting supplied value for first: {}", e)); self } pub fn last(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.last = value .try_into() .map_err(|e| format!("error converting supplied value for last: {}", e)); self } } impl std::convert::TryFrom for super::Ipv4Range { type Error = String; fn try_from(value: Ipv4Range) -> Result { Ok(Self { first: value.first?, last: value.last?, }) } } pub struct Ipv6Range { first: Result, last: Result, } impl Default for Ipv6Range { fn default() -> Self { Self { first: Err("no value supplied for first".to_string()), last: Err("no value supplied for last".to_string()), } } } impl Ipv6Range { pub fn first(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.first = value .try_into() .map_err(|e| format!("error converting supplied value for first: {}", e)); self } pub fn last(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.last = value .try_into() .map_err(|e| format!("error converting supplied value for last: {}", e)); self } } impl std::convert::TryFrom for super::Ipv6Range { type Error = String; fn try_from(value: Ipv6Range) -> Result { Ok(Self { first: value.first?, last: value.last?, }) } } pub struct Measurement { datum: Result, timestamp: Result, String>, } impl Default for Measurement { fn default() -> Self { Self { datum: Err("no value supplied for datum".to_string()), timestamp: Err("no value supplied for timestamp".to_string()), } } } impl Measurement { pub fn datum(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.datum = value .try_into() .map_err(|e| format!("error converting supplied value for datum: {}", e)); self } pub fn timestamp(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.timestamp = value .try_into() .map_err(|e| format!("error converting supplied value for timestamp: {}", e)); self } } impl std::convert::TryFrom for super::Measurement { type Error = String; fn try_from(value: Measurement) -> Result { Ok(Self { datum: value.datum?, timestamp: value.timestamp?, }) } } pub struct MeasurementResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for MeasurementResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl MeasurementResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::MeasurementResultsPage { type Error = String; fn try_from(value: MeasurementResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct NetworkInterface { description: Result, id: Result, instance_id: Result, ip: Result, mac: Result, name: Result, primary: Result, subnet_id: Result, time_created: Result, String>, time_modified: Result, String>, vpc_id: Result, } impl Default for NetworkInterface { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), instance_id: Err("no value supplied for instance_id".to_string()), ip: Err("no value supplied for ip".to_string()), mac: Err("no value supplied for mac".to_string()), name: Err("no value supplied for name".to_string()), primary: Err("no value supplied for primary".to_string()), subnet_id: Err("no value supplied for subnet_id".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), vpc_id: Err("no value supplied for vpc_id".to_string()), } } } impl NetworkInterface { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn instance_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.instance_id = value .try_into() .map_err(|e| format!("error converting supplied value for instance_id: {}", e)); self } pub fn ip(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ip = value .try_into() .map_err(|e| format!("error converting supplied value for ip: {}", e)); self } pub fn mac(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.mac = value .try_into() .map_err(|e| format!("error converting supplied value for mac: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn primary(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.primary = value .try_into() .map_err(|e| format!("error converting supplied value for primary: {}", e)); self } pub fn subnet_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.subnet_id = value .try_into() .map_err(|e| format!("error converting supplied value for subnet_id: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn vpc_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vpc_id = value .try_into() .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); self } } impl std::convert::TryFrom for super::NetworkInterface { type Error = String; fn try_from(value: NetworkInterface) -> Result { Ok(Self { description: value.description?, id: value.id?, instance_id: value.instance_id?, ip: value.ip?, mac: value.mac?, name: value.name?, primary: value.primary?, subnet_id: value.subnet_id?, time_created: value.time_created?, time_modified: value.time_modified?, vpc_id: value.vpc_id?, }) } } pub struct NetworkInterfaceCreate { description: Result, ip: Result, String>, name: Result, subnet_name: Result, vpc_name: Result, } impl Default for NetworkInterfaceCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), ip: Ok(Default::default()), name: Err("no value supplied for name".to_string()), subnet_name: Err("no value supplied for subnet_name".to_string()), vpc_name: Err("no value supplied for vpc_name".to_string()), } } } impl NetworkInterfaceCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn ip(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.ip = value .try_into() .map_err(|e| format!("error converting supplied value for ip: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn subnet_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.subnet_name = value .try_into() .map_err(|e| format!("error converting supplied value for subnet_name: {}", e)); self } pub fn vpc_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vpc_name = value .try_into() .map_err(|e| format!("error converting supplied value for vpc_name: {}", e)); self } } impl std::convert::TryFrom for super::NetworkInterfaceCreate { type Error = String; fn try_from(value: NetworkInterfaceCreate) -> Result { Ok(Self { description: value.description?, ip: value.ip?, name: value.name?, subnet_name: value.subnet_name?, vpc_name: value.vpc_name?, }) } } pub struct NetworkInterfaceResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for NetworkInterfaceResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl NetworkInterfaceResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::NetworkInterfaceResultsPage { type Error = String; fn try_from(value: NetworkInterfaceResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct NetworkInterfaceUpdate { description: Result, String>, make_primary: Result, name: Result, String>, } impl Default for NetworkInterfaceUpdate { fn default() -> Self { Self { description: Ok(Default::default()), make_primary: Ok(Default::default()), name: Ok(Default::default()), } } } impl NetworkInterfaceUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn make_primary(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.make_primary = value.try_into().map_err(|e| { format!("error converting supplied value for make_primary: {}", e) }); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::NetworkInterfaceUpdate { type Error = String; fn try_from(value: NetworkInterfaceUpdate) -> Result { Ok(Self { description: value.description?, make_primary: value.make_primary?, name: value.name?, }) } } pub struct Organization { description: Result, id: Result, name: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Organization { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Organization { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Organization { type Error = String; fn try_from(value: Organization) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct OrganizationCreate { description: Result, name: Result, } impl Default for OrganizationCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), } } } impl OrganizationCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::OrganizationCreate { type Error = String; fn try_from(value: OrganizationCreate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct OrganizationResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for OrganizationResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl OrganizationResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::OrganizationResultsPage { type Error = String; fn try_from(value: OrganizationResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct OrganizationRolePolicy { role_assignments: Result, String>, } impl Default for OrganizationRolePolicy { fn default() -> Self { Self { role_assignments: Err("no value supplied for role_assignments".to_string()), } } } impl OrganizationRolePolicy { pub fn role_assignments(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.role_assignments = value.try_into().map_err(|e| { format!( "error converting supplied value for role_assignments: {}", e ) }); self } } impl std::convert::TryFrom for super::OrganizationRolePolicy { type Error = String; fn try_from(value: OrganizationRolePolicy) -> Result { Ok(Self { role_assignments: value.role_assignments?, }) } } pub struct OrganizationRoleRoleAssignment { identity_id: Result, identity_type: Result, role_name: Result, } impl Default for OrganizationRoleRoleAssignment { fn default() -> Self { Self { identity_id: Err("no value supplied for identity_id".to_string()), identity_type: Err("no value supplied for identity_type".to_string()), role_name: Err("no value supplied for role_name".to_string()), } } } impl OrganizationRoleRoleAssignment { pub fn identity_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_id = value .try_into() .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); self } pub fn identity_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_type = value.try_into().map_err(|e| { format!("error converting supplied value for identity_type: {}", e) }); self } pub fn role_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.role_name = value .try_into() .map_err(|e| format!("error converting supplied value for role_name: {}", e)); self } } impl std::convert::TryFrom for super::OrganizationRoleRoleAssignment { type Error = String; fn try_from(value: OrganizationRoleRoleAssignment) -> Result { Ok(Self { identity_id: value.identity_id?, identity_type: value.identity_type?, role_name: value.role_name?, }) } } pub struct OrganizationUpdate { description: Result, String>, name: Result, String>, } impl Default for OrganizationUpdate { fn default() -> Self { Self { description: Ok(Default::default()), name: Ok(Default::default()), } } } impl OrganizationUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::OrganizationUpdate { type Error = String; fn try_from(value: OrganizationUpdate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct Project { description: Result, id: Result, name: Result, organization_id: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Project { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), organization_id: Err("no value supplied for organization_id".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Project { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn organization_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.organization_id = value.try_into().map_err(|e| { format!("error converting supplied value for organization_id: {}", e) }); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Project { type Error = String; fn try_from(value: Project) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, organization_id: value.organization_id?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct ProjectCreate { description: Result, name: Result, } impl Default for ProjectCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), } } } impl ProjectCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::ProjectCreate { type Error = String; fn try_from(value: ProjectCreate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct ProjectResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for ProjectResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl ProjectResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::ProjectResultsPage { type Error = String; fn try_from(value: ProjectResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct ProjectRolePolicy { role_assignments: Result, String>, } impl Default for ProjectRolePolicy { fn default() -> Self { Self { role_assignments: Err("no value supplied for role_assignments".to_string()), } } } impl ProjectRolePolicy { pub fn role_assignments(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.role_assignments = value.try_into().map_err(|e| { format!( "error converting supplied value for role_assignments: {}", e ) }); self } } impl std::convert::TryFrom for super::ProjectRolePolicy { type Error = String; fn try_from(value: ProjectRolePolicy) -> Result { Ok(Self { role_assignments: value.role_assignments?, }) } } pub struct ProjectRoleRoleAssignment { identity_id: Result, identity_type: Result, role_name: Result, } impl Default for ProjectRoleRoleAssignment { fn default() -> Self { Self { identity_id: Err("no value supplied for identity_id".to_string()), identity_type: Err("no value supplied for identity_type".to_string()), role_name: Err("no value supplied for role_name".to_string()), } } } impl ProjectRoleRoleAssignment { pub fn identity_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_id = value .try_into() .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); self } pub fn identity_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_type = value.try_into().map_err(|e| { format!("error converting supplied value for identity_type: {}", e) }); self } pub fn role_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.role_name = value .try_into() .map_err(|e| format!("error converting supplied value for role_name: {}", e)); self } } impl std::convert::TryFrom for super::ProjectRoleRoleAssignment { type Error = String; fn try_from(value: ProjectRoleRoleAssignment) -> Result { Ok(Self { identity_id: value.identity_id?, identity_type: value.identity_type?, role_name: value.role_name?, }) } } pub struct ProjectUpdate { description: Result, String>, name: Result, String>, } impl Default for ProjectUpdate { fn default() -> Self { Self { description: Ok(Default::default()), name: Ok(Default::default()), } } } impl ProjectUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::ProjectUpdate { type Error = String; fn try_from(value: ProjectUpdate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct Rack { id: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Rack { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Rack { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Rack { type Error = String; fn try_from(value: Rack) -> Result { Ok(Self { id: value.id?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct RackResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for RackResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl RackResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::RackResultsPage { type Error = String; fn try_from(value: RackResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Role { description: Result, name: Result, } impl Default for Role { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), } } } impl Role { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::Role { type Error = String; fn try_from(value: Role) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct RoleResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for RoleResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl RoleResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::RoleResultsPage { type Error = String; fn try_from(value: RoleResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct RouterRoute { description: Result, destination: Result, id: Result, kind: Result, name: Result, target: Result, time_created: Result, String>, time_modified: Result, String>, vpc_router_id: Result, } impl Default for RouterRoute { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), destination: Err("no value supplied for destination".to_string()), id: Err("no value supplied for id".to_string()), kind: Err("no value supplied for kind".to_string()), name: Err("no value supplied for name".to_string()), target: Err("no value supplied for target".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), vpc_router_id: Err("no value supplied for vpc_router_id".to_string()), } } } impl RouterRoute { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn destination(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.destination = value .try_into() .map_err(|e| format!("error converting supplied value for destination: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn kind(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.kind = value .try_into() .map_err(|e| format!("error converting supplied value for kind: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn target(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.target = value .try_into() .map_err(|e| format!("error converting supplied value for target: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn vpc_router_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vpc_router_id = value.try_into().map_err(|e| { format!("error converting supplied value for vpc_router_id: {}", e) }); self } } impl std::convert::TryFrom for super::RouterRoute { type Error = String; fn try_from(value: RouterRoute) -> Result { Ok(Self { description: value.description?, destination: value.destination?, id: value.id?, kind: value.kind?, name: value.name?, target: value.target?, time_created: value.time_created?, time_modified: value.time_modified?, vpc_router_id: value.vpc_router_id?, }) } } pub struct RouterRouteCreateParams { description: Result, destination: Result, name: Result, target: Result, } impl Default for RouterRouteCreateParams { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), destination: Err("no value supplied for destination".to_string()), name: Err("no value supplied for name".to_string()), target: Err("no value supplied for target".to_string()), } } } impl RouterRouteCreateParams { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn destination(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.destination = value .try_into() .map_err(|e| format!("error converting supplied value for destination: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn target(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.target = value .try_into() .map_err(|e| format!("error converting supplied value for target: {}", e)); self } } impl std::convert::TryFrom for super::RouterRouteCreateParams { type Error = String; fn try_from(value: RouterRouteCreateParams) -> Result { Ok(Self { description: value.description?, destination: value.destination?, name: value.name?, target: value.target?, }) } } pub struct RouterRouteResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for RouterRouteResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl RouterRouteResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::RouterRouteResultsPage { type Error = String; fn try_from(value: RouterRouteResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct RouterRouteUpdateParams { description: Result, String>, destination: Result, name: Result, String>, target: Result, } impl Default for RouterRouteUpdateParams { fn default() -> Self { Self { description: Ok(Default::default()), destination: Err("no value supplied for destination".to_string()), name: Ok(Default::default()), target: Err("no value supplied for target".to_string()), } } } impl RouterRouteUpdateParams { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn destination(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.destination = value .try_into() .map_err(|e| format!("error converting supplied value for destination: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn target(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.target = value .try_into() .map_err(|e| format!("error converting supplied value for target: {}", e)); self } } impl std::convert::TryFrom for super::RouterRouteUpdateParams { type Error = String; fn try_from(value: RouterRouteUpdateParams) -> Result { Ok(Self { description: value.description?, destination: value.destination?, name: value.name?, target: value.target?, }) } } pub struct Saga { id: Result, state: Result, } impl Default for Saga { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), state: Err("no value supplied for state".to_string()), } } } impl Saga { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn state(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.state = value .try_into() .map_err(|e| format!("error converting supplied value for state: {}", e)); self } } impl std::convert::TryFrom for super::Saga { type Error = String; fn try_from(value: Saga) -> Result { Ok(Self { id: value.id?, state: value.state?, }) } } pub struct SagaResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for SagaResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl SagaResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::SagaResultsPage { type Error = String; fn try_from(value: SagaResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct SamlIdentityProvider { acs_url: Result, description: Result, id: Result, idp_entity_id: Result, name: Result, public_cert: Result, String>, slo_url: Result, sp_client_id: Result, technical_contact_email: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for SamlIdentityProvider { fn default() -> Self { Self { acs_url: Err("no value supplied for acs_url".to_string()), description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), idp_entity_id: Err("no value supplied for idp_entity_id".to_string()), name: Err("no value supplied for name".to_string()), public_cert: Ok(Default::default()), slo_url: Err("no value supplied for slo_url".to_string()), sp_client_id: Err("no value supplied for sp_client_id".to_string()), technical_contact_email: Err( "no value supplied for technical_contact_email".to_string() ), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl SamlIdentityProvider { pub fn acs_url(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.acs_url = value .try_into() .map_err(|e| format!("error converting supplied value for acs_url: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn idp_entity_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.idp_entity_id = value.try_into().map_err(|e| { format!("error converting supplied value for idp_entity_id: {}", e) }); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn public_cert(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.public_cert = value .try_into() .map_err(|e| format!("error converting supplied value for public_cert: {}", e)); self } pub fn slo_url(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.slo_url = value .try_into() .map_err(|e| format!("error converting supplied value for slo_url: {}", e)); self } pub fn sp_client_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.sp_client_id = value.try_into().map_err(|e| { format!("error converting supplied value for sp_client_id: {}", e) }); self } pub fn technical_contact_email(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.technical_contact_email = value.try_into().map_err(|e| { format!( "error converting supplied value for technical_contact_email: {}", e ) }); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::SamlIdentityProvider { type Error = String; fn try_from(value: SamlIdentityProvider) -> Result { Ok(Self { acs_url: value.acs_url?, description: value.description?, id: value.id?, idp_entity_id: value.idp_entity_id?, name: value.name?, public_cert: value.public_cert?, slo_url: value.slo_url?, sp_client_id: value.sp_client_id?, technical_contact_email: value.technical_contact_email?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct SamlIdentityProviderCreate { acs_url: Result, description: Result, idp_entity_id: Result, idp_metadata_source: Result, name: Result, signing_keypair: Result, String>, slo_url: Result, sp_client_id: Result, technical_contact_email: Result, } impl Default for SamlIdentityProviderCreate { fn default() -> Self { Self { acs_url: Err("no value supplied for acs_url".to_string()), description: Err("no value supplied for description".to_string()), idp_entity_id: Err("no value supplied for idp_entity_id".to_string()), idp_metadata_source: Err( "no value supplied for idp_metadata_source".to_string() ), name: Err("no value supplied for name".to_string()), signing_keypair: Ok(Default::default()), slo_url: Err("no value supplied for slo_url".to_string()), sp_client_id: Err("no value supplied for sp_client_id".to_string()), technical_contact_email: Err( "no value supplied for technical_contact_email".to_string() ), } } } impl SamlIdentityProviderCreate { pub fn acs_url(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.acs_url = value .try_into() .map_err(|e| format!("error converting supplied value for acs_url: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn idp_entity_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.idp_entity_id = value.try_into().map_err(|e| { format!("error converting supplied value for idp_entity_id: {}", e) }); self } pub fn idp_metadata_source(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.idp_metadata_source = value.try_into().map_err(|e| { format!( "error converting supplied value for idp_metadata_source: {}", e ) }); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn signing_keypair(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.signing_keypair = value.try_into().map_err(|e| { format!("error converting supplied value for signing_keypair: {}", e) }); self } pub fn slo_url(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.slo_url = value .try_into() .map_err(|e| format!("error converting supplied value for slo_url: {}", e)); self } pub fn sp_client_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.sp_client_id = value.try_into().map_err(|e| { format!("error converting supplied value for sp_client_id: {}", e) }); self } pub fn technical_contact_email(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.technical_contact_email = value.try_into().map_err(|e| { format!( "error converting supplied value for technical_contact_email: {}", e ) }); self } } impl std::convert::TryFrom for super::SamlIdentityProviderCreate { type Error = String; fn try_from(value: SamlIdentityProviderCreate) -> Result { Ok(Self { acs_url: value.acs_url?, description: value.description?, idp_entity_id: value.idp_entity_id?, idp_metadata_source: value.idp_metadata_source?, name: value.name?, signing_keypair: value.signing_keypair?, slo_url: value.slo_url?, sp_client_id: value.sp_client_id?, technical_contact_email: value.technical_contact_email?, }) } } pub struct Silo { description: Result, discoverable: Result, id: Result, name: Result, time_created: Result, String>, time_modified: Result, String>, user_provision_type: Result, } impl Default for Silo { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), discoverable: Err("no value supplied for discoverable".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), user_provision_type: Err( "no value supplied for user_provision_type".to_string() ), } } } impl Silo { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn discoverable(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.discoverable = value.try_into().map_err(|e| { format!("error converting supplied value for discoverable: {}", e) }); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn user_provision_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.user_provision_type = value.try_into().map_err(|e| { format!( "error converting supplied value for user_provision_type: {}", e ) }); self } } impl std::convert::TryFrom for super::Silo { type Error = String; fn try_from(value: Silo) -> Result { Ok(Self { description: value.description?, discoverable: value.discoverable?, id: value.id?, name: value.name?, time_created: value.time_created?, time_modified: value.time_modified?, user_provision_type: value.user_provision_type?, }) } } pub struct SiloCreate { description: Result, discoverable: Result, name: Result, user_provision_type: Result, } impl Default for SiloCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), discoverable: Err("no value supplied for discoverable".to_string()), name: Err("no value supplied for name".to_string()), user_provision_type: Err( "no value supplied for user_provision_type".to_string() ), } } } impl SiloCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn discoverable(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.discoverable = value.try_into().map_err(|e| { format!("error converting supplied value for discoverable: {}", e) }); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn user_provision_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.user_provision_type = value.try_into().map_err(|e| { format!( "error converting supplied value for user_provision_type: {}", e ) }); self } } impl std::convert::TryFrom for super::SiloCreate { type Error = String; fn try_from(value: SiloCreate) -> Result { Ok(Self { description: value.description?, discoverable: value.discoverable?, name: value.name?, user_provision_type: value.user_provision_type?, }) } } pub struct SiloResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for SiloResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl SiloResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::SiloResultsPage { type Error = String; fn try_from(value: SiloResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct SiloRolePolicy { role_assignments: Result, String>, } impl Default for SiloRolePolicy { fn default() -> Self { Self { role_assignments: Err("no value supplied for role_assignments".to_string()), } } } impl SiloRolePolicy { pub fn role_assignments(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.role_assignments = value.try_into().map_err(|e| { format!( "error converting supplied value for role_assignments: {}", e ) }); self } } impl std::convert::TryFrom for super::SiloRolePolicy { type Error = String; fn try_from(value: SiloRolePolicy) -> Result { Ok(Self { role_assignments: value.role_assignments?, }) } } pub struct SiloRoleRoleAssignment { identity_id: Result, identity_type: Result, role_name: Result, } impl Default for SiloRoleRoleAssignment { fn default() -> Self { Self { identity_id: Err("no value supplied for identity_id".to_string()), identity_type: Err("no value supplied for identity_type".to_string()), role_name: Err("no value supplied for role_name".to_string()), } } } impl SiloRoleRoleAssignment { pub fn identity_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_id = value .try_into() .map_err(|e| format!("error converting supplied value for identity_id: {}", e)); self } pub fn identity_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.identity_type = value.try_into().map_err(|e| { format!("error converting supplied value for identity_type: {}", e) }); self } pub fn role_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.role_name = value .try_into() .map_err(|e| format!("error converting supplied value for role_name: {}", e)); self } } impl std::convert::TryFrom for super::SiloRoleRoleAssignment { type Error = String; fn try_from(value: SiloRoleRoleAssignment) -> Result { Ok(Self { identity_id: value.identity_id?, identity_type: value.identity_type?, role_name: value.role_name?, }) } } pub struct Sled { id: Result, service_address: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Sled { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), service_address: Err("no value supplied for service_address".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Sled { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn service_address(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.service_address = value.try_into().map_err(|e| { format!("error converting supplied value for service_address: {}", e) }); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Sled { type Error = String; fn try_from(value: Sled) -> Result { Ok(Self { id: value.id?, service_address: value.service_address?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct SledResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for SledResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl SledResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::SledResultsPage { type Error = String; fn try_from(value: SledResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Snapshot { description: Result, disk_id: Result, id: Result, name: Result, project_id: Result, size: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Snapshot { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), disk_id: Err("no value supplied for disk_id".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), project_id: Err("no value supplied for project_id".to_string()), size: Err("no value supplied for size".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Snapshot { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn disk_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.disk_id = value .try_into() .map_err(|e| format!("error converting supplied value for disk_id: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn project_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.project_id = value .try_into() .map_err(|e| format!("error converting supplied value for project_id: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Snapshot { type Error = String; fn try_from(value: Snapshot) -> Result { Ok(Self { description: value.description?, disk_id: value.disk_id?, id: value.id?, name: value.name?, project_id: value.project_id?, size: value.size?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct SnapshotCreate { description: Result, disk: Result, name: Result, } impl Default for SnapshotCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), disk: Err("no value supplied for disk".to_string()), name: Err("no value supplied for name".to_string()), } } } impl SnapshotCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn disk(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.disk = value .try_into() .map_err(|e| format!("error converting supplied value for disk: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::SnapshotCreate { type Error = String; fn try_from(value: SnapshotCreate) -> Result { Ok(Self { description: value.description?, disk: value.disk?, name: value.name?, }) } } pub struct SnapshotResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for SnapshotResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl SnapshotResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::SnapshotResultsPage { type Error = String; fn try_from(value: SnapshotResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct SpoofLoginBody { username: Result, } impl Default for SpoofLoginBody { fn default() -> Self { Self { username: Err("no value supplied for username".to_string()), } } } impl SpoofLoginBody { pub fn username(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.username = value .try_into() .map_err(|e| format!("error converting supplied value for username: {}", e)); self } } impl std::convert::TryFrom for super::SpoofLoginBody { type Error = String; fn try_from(value: SpoofLoginBody) -> Result { Ok(Self { username: value.username?, }) } } pub struct SshKey { description: Result, id: Result, name: Result, public_key: Result, silo_user_id: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for SshKey { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), public_key: Err("no value supplied for public_key".to_string()), silo_user_id: Err("no value supplied for silo_user_id".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl SshKey { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn public_key(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.public_key = value .try_into() .map_err(|e| format!("error converting supplied value for public_key: {}", e)); self } pub fn silo_user_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.silo_user_id = value.try_into().map_err(|e| { format!("error converting supplied value for silo_user_id: {}", e) }); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::SshKey { type Error = String; fn try_from(value: SshKey) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, public_key: value.public_key?, silo_user_id: value.silo_user_id?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct SshKeyCreate { description: Result, name: Result, public_key: Result, } impl Default for SshKeyCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), public_key: Err("no value supplied for public_key".to_string()), } } } impl SshKeyCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn public_key(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.public_key = value .try_into() .map_err(|e| format!("error converting supplied value for public_key: {}", e)); self } } impl std::convert::TryFrom for super::SshKeyCreate { type Error = String; fn try_from(value: SshKeyCreate) -> Result { Ok(Self { description: value.description?, name: value.name?, public_key: value.public_key?, }) } } pub struct SshKeyResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for SshKeyResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl SshKeyResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::SshKeyResultsPage { type Error = String; fn try_from(value: SshKeyResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct TimeseriesSchema { created: Result, String>, datum_type: Result, field_schema: Result, String>, timeseries_name: Result, } impl Default for TimeseriesSchema { fn default() -> Self { Self { created: Err("no value supplied for created".to_string()), datum_type: Err("no value supplied for datum_type".to_string()), field_schema: Err("no value supplied for field_schema".to_string()), timeseries_name: Err("no value supplied for timeseries_name".to_string()), } } } impl TimeseriesSchema { pub fn created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.created = value .try_into() .map_err(|e| format!("error converting supplied value for created: {}", e)); self } pub fn datum_type(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.datum_type = value .try_into() .map_err(|e| format!("error converting supplied value for datum_type: {}", e)); self } pub fn field_schema(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.field_schema = value.try_into().map_err(|e| { format!("error converting supplied value for field_schema: {}", e) }); self } pub fn timeseries_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.timeseries_name = value.try_into().map_err(|e| { format!("error converting supplied value for timeseries_name: {}", e) }); self } } impl std::convert::TryFrom for super::TimeseriesSchema { type Error = String; fn try_from(value: TimeseriesSchema) -> Result { Ok(Self { created: value.created?, datum_type: value.datum_type?, field_schema: value.field_schema?, timeseries_name: value.timeseries_name?, }) } } pub struct TimeseriesSchemaResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for TimeseriesSchemaResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl TimeseriesSchemaResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::TimeseriesSchemaResultsPage { type Error = String; fn try_from(value: TimeseriesSchemaResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct User { display_name: Result, id: Result, } impl Default for User { fn default() -> Self { Self { display_name: Err("no value supplied for display_name".to_string()), id: Err("no value supplied for id".to_string()), } } } impl User { pub fn display_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.display_name = value.try_into().map_err(|e| { format!("error converting supplied value for display_name: {}", e) }); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } } impl std::convert::TryFrom for super::User { type Error = String; fn try_from(value: User) -> Result { Ok(Self { display_name: value.display_name?, id: value.id?, }) } } pub struct UserBuiltin { description: Result, id: Result, name: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for UserBuiltin { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl UserBuiltin { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::UserBuiltin { type Error = String; fn try_from(value: UserBuiltin) -> Result { Ok(Self { description: value.description?, id: value.id?, name: value.name?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct UserBuiltinResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for UserBuiltinResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl UserBuiltinResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::UserBuiltinResultsPage { type Error = String; fn try_from(value: UserBuiltinResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct UserResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for UserResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl UserResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::UserResultsPage { type Error = String; fn try_from(value: UserResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct Vpc { description: Result, dns_name: Result, id: Result, ipv6_prefix: Result, name: Result, project_id: Result, system_router_id: Result, time_created: Result, String>, time_modified: Result, String>, } impl Default for Vpc { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), dns_name: Err("no value supplied for dns_name".to_string()), id: Err("no value supplied for id".to_string()), ipv6_prefix: Err("no value supplied for ipv6_prefix".to_string()), name: Err("no value supplied for name".to_string()), project_id: Err("no value supplied for project_id".to_string()), system_router_id: Err("no value supplied for system_router_id".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), } } } impl Vpc { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn dns_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.dns_name = value .try_into() .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn ipv6_prefix(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ipv6_prefix = value .try_into() .map_err(|e| format!("error converting supplied value for ipv6_prefix: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn project_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.project_id = value .try_into() .map_err(|e| format!("error converting supplied value for project_id: {}", e)); self } pub fn system_router_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.system_router_id = value.try_into().map_err(|e| { format!( "error converting supplied value for system_router_id: {}", e ) }); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } } impl std::convert::TryFrom for super::Vpc { type Error = String; fn try_from(value: Vpc) -> Result { Ok(Self { description: value.description?, dns_name: value.dns_name?, id: value.id?, ipv6_prefix: value.ipv6_prefix?, name: value.name?, project_id: value.project_id?, system_router_id: value.system_router_id?, time_created: value.time_created?, time_modified: value.time_modified?, }) } } pub struct VpcCreate { description: Result, dns_name: Result, ipv6_prefix: Result, String>, name: Result, } impl Default for VpcCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), dns_name: Err("no value supplied for dns_name".to_string()), ipv6_prefix: Ok(Default::default()), name: Err("no value supplied for name".to_string()), } } } impl VpcCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn dns_name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.dns_name = value .try_into() .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); self } pub fn ipv6_prefix(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.ipv6_prefix = value .try_into() .map_err(|e| format!("error converting supplied value for ipv6_prefix: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::VpcCreate { type Error = String; fn try_from(value: VpcCreate) -> Result { Ok(Self { description: value.description?, dns_name: value.dns_name?, ipv6_prefix: value.ipv6_prefix?, name: value.name?, }) } } pub struct VpcFirewallRule { action: Result, description: Result, direction: Result, filters: Result, id: Result, name: Result, priority: Result, status: Result, targets: Result, String>, time_created: Result, String>, time_modified: Result, String>, vpc_id: Result, } impl Default for VpcFirewallRule { fn default() -> Self { Self { action: Err("no value supplied for action".to_string()), description: Err("no value supplied for description".to_string()), direction: Err("no value supplied for direction".to_string()), filters: Err("no value supplied for filters".to_string()), id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), priority: Err("no value supplied for priority".to_string()), status: Err("no value supplied for status".to_string()), targets: Err("no value supplied for targets".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), vpc_id: Err("no value supplied for vpc_id".to_string()), } } } impl VpcFirewallRule { pub fn action(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.action = value .try_into() .map_err(|e| format!("error converting supplied value for action: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn direction(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.direction = value .try_into() .map_err(|e| format!("error converting supplied value for direction: {}", e)); self } pub fn filters(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.filters = value .try_into() .map_err(|e| format!("error converting supplied value for filters: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn priority(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.priority = value .try_into() .map_err(|e| format!("error converting supplied value for priority: {}", e)); self } pub fn status(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.status = value .try_into() .map_err(|e| format!("error converting supplied value for status: {}", e)); self } pub fn targets(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.targets = value .try_into() .map_err(|e| format!("error converting supplied value for targets: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn vpc_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vpc_id = value .try_into() .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); self } } impl std::convert::TryFrom for super::VpcFirewallRule { type Error = String; fn try_from(value: VpcFirewallRule) -> Result { Ok(Self { action: value.action?, description: value.description?, direction: value.direction?, filters: value.filters?, id: value.id?, name: value.name?, priority: value.priority?, status: value.status?, targets: value.targets?, time_created: value.time_created?, time_modified: value.time_modified?, vpc_id: value.vpc_id?, }) } } pub struct VpcFirewallRuleFilter { hosts: Result>, String>, ports: Result>, String>, protocols: Result>, String>, } impl Default for VpcFirewallRuleFilter { fn default() -> Self { Self { hosts: Ok(Default::default()), ports: Ok(Default::default()), protocols: Ok(Default::default()), } } } impl VpcFirewallRuleFilter { pub fn hosts(mut self, value: T) -> Self where T: std::convert::TryInto>>, T::Error: std::fmt::Display, { self.hosts = value .try_into() .map_err(|e| format!("error converting supplied value for hosts: {}", e)); self } pub fn ports(mut self, value: T) -> Self where T: std::convert::TryInto>>, T::Error: std::fmt::Display, { self.ports = value .try_into() .map_err(|e| format!("error converting supplied value for ports: {}", e)); self } pub fn protocols(mut self, value: T) -> Self where T: std::convert::TryInto>>, T::Error: std::fmt::Display, { self.protocols = value .try_into() .map_err(|e| format!("error converting supplied value for protocols: {}", e)); self } } impl std::convert::TryFrom for super::VpcFirewallRuleFilter { type Error = String; fn try_from(value: VpcFirewallRuleFilter) -> Result { Ok(Self { hosts: value.hosts?, ports: value.ports?, protocols: value.protocols?, }) } } pub struct VpcFirewallRuleUpdate { action: Result, description: Result, direction: Result, filters: Result, name: Result, priority: Result, status: Result, targets: Result, String>, } impl Default for VpcFirewallRuleUpdate { fn default() -> Self { Self { action: Err("no value supplied for action".to_string()), description: Err("no value supplied for description".to_string()), direction: Err("no value supplied for direction".to_string()), filters: Err("no value supplied for filters".to_string()), name: Err("no value supplied for name".to_string()), priority: Err("no value supplied for priority".to_string()), status: Err("no value supplied for status".to_string()), targets: Err("no value supplied for targets".to_string()), } } } impl VpcFirewallRuleUpdate { pub fn action(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.action = value .try_into() .map_err(|e| format!("error converting supplied value for action: {}", e)); self } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn direction(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.direction = value .try_into() .map_err(|e| format!("error converting supplied value for direction: {}", e)); self } pub fn filters(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.filters = value .try_into() .map_err(|e| format!("error converting supplied value for filters: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn priority(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.priority = value .try_into() .map_err(|e| format!("error converting supplied value for priority: {}", e)); self } pub fn status(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.status = value .try_into() .map_err(|e| format!("error converting supplied value for status: {}", e)); self } pub fn targets(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.targets = value .try_into() .map_err(|e| format!("error converting supplied value for targets: {}", e)); self } } impl std::convert::TryFrom for super::VpcFirewallRuleUpdate { type Error = String; fn try_from(value: VpcFirewallRuleUpdate) -> Result { Ok(Self { action: value.action?, description: value.description?, direction: value.direction?, filters: value.filters?, name: value.name?, priority: value.priority?, status: value.status?, targets: value.targets?, }) } } pub struct VpcFirewallRuleUpdateParams { rules: Result, String>, } impl Default for VpcFirewallRuleUpdateParams { fn default() -> Self { Self { rules: Err("no value supplied for rules".to_string()), } } } impl VpcFirewallRuleUpdateParams { pub fn rules(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.rules = value .try_into() .map_err(|e| format!("error converting supplied value for rules: {}", e)); self } } impl std::convert::TryFrom for super::VpcFirewallRuleUpdateParams { type Error = String; fn try_from(value: VpcFirewallRuleUpdateParams) -> Result { Ok(Self { rules: value.rules?, }) } } pub struct VpcFirewallRules { rules: Result, String>, } impl Default for VpcFirewallRules { fn default() -> Self { Self { rules: Err("no value supplied for rules".to_string()), } } } impl VpcFirewallRules { pub fn rules(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.rules = value .try_into() .map_err(|e| format!("error converting supplied value for rules: {}", e)); self } } impl std::convert::TryFrom for super::VpcFirewallRules { type Error = String; fn try_from(value: VpcFirewallRules) -> Result { Ok(Self { rules: value.rules?, }) } } pub struct VpcResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for VpcResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl VpcResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::VpcResultsPage { type Error = String; fn try_from(value: VpcResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct VpcRouter { description: Result, id: Result, kind: Result, name: Result, time_created: Result, String>, time_modified: Result, String>, vpc_id: Result, } impl Default for VpcRouter { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), kind: Err("no value supplied for kind".to_string()), name: Err("no value supplied for name".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), vpc_id: Err("no value supplied for vpc_id".to_string()), } } } impl VpcRouter { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn kind(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.kind = value .try_into() .map_err(|e| format!("error converting supplied value for kind: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn vpc_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vpc_id = value .try_into() .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); self } } impl std::convert::TryFrom for super::VpcRouter { type Error = String; fn try_from(value: VpcRouter) -> Result { Ok(Self { description: value.description?, id: value.id?, kind: value.kind?, name: value.name?, time_created: value.time_created?, time_modified: value.time_modified?, vpc_id: value.vpc_id?, }) } } pub struct VpcRouterCreate { description: Result, name: Result, } impl Default for VpcRouterCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), name: Err("no value supplied for name".to_string()), } } } impl VpcRouterCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::VpcRouterCreate { type Error = String; fn try_from(value: VpcRouterCreate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct VpcRouterResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for VpcRouterResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl VpcRouterResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::VpcRouterResultsPage { type Error = String; fn try_from(value: VpcRouterResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct VpcRouterUpdate { description: Result, String>, name: Result, String>, } impl Default for VpcRouterUpdate { fn default() -> Self { Self { description: Ok(Default::default()), name: Ok(Default::default()), } } } impl VpcRouterUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::VpcRouterUpdate { type Error = String; fn try_from(value: VpcRouterUpdate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct VpcSubnet { description: Result, id: Result, ipv4_block: Result, ipv6_block: Result, name: Result, time_created: Result, String>, time_modified: Result, String>, vpc_id: Result, } impl Default for VpcSubnet { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), id: Err("no value supplied for id".to_string()), ipv4_block: Err("no value supplied for ipv4_block".to_string()), ipv6_block: Err("no value supplied for ipv6_block".to_string()), name: Err("no value supplied for name".to_string()), time_created: Err("no value supplied for time_created".to_string()), time_modified: Err("no value supplied for time_modified".to_string()), vpc_id: Err("no value supplied for vpc_id".to_string()), } } } impl VpcSubnet { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn ipv4_block(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ipv4_block = value .try_into() .map_err(|e| format!("error converting supplied value for ipv4_block: {}", e)); self } pub fn ipv6_block(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ipv6_block = value .try_into() .map_err(|e| format!("error converting supplied value for ipv6_block: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn time_created(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_created = value.try_into().map_err(|e| { format!("error converting supplied value for time_created: {}", e) }); self } pub fn time_modified(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time_modified = value.try_into().map_err(|e| { format!("error converting supplied value for time_modified: {}", e) }); self } pub fn vpc_id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.vpc_id = value .try_into() .map_err(|e| format!("error converting supplied value for vpc_id: {}", e)); self } } impl std::convert::TryFrom for super::VpcSubnet { type Error = String; fn try_from(value: VpcSubnet) -> Result { Ok(Self { description: value.description?, id: value.id?, ipv4_block: value.ipv4_block?, ipv6_block: value.ipv6_block?, name: value.name?, time_created: value.time_created?, time_modified: value.time_modified?, vpc_id: value.vpc_id?, }) } } pub struct VpcSubnetCreate { description: Result, ipv4_block: Result, ipv6_block: Result, String>, name: Result, } impl Default for VpcSubnetCreate { fn default() -> Self { Self { description: Err("no value supplied for description".to_string()), ipv4_block: Err("no value supplied for ipv4_block".to_string()), ipv6_block: Ok(Default::default()), name: Err("no value supplied for name".to_string()), } } } impl VpcSubnetCreate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn ipv4_block(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.ipv4_block = value .try_into() .map_err(|e| format!("error converting supplied value for ipv4_block: {}", e)); self } pub fn ipv6_block(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.ipv6_block = value .try_into() .map_err(|e| format!("error converting supplied value for ipv6_block: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::VpcSubnetCreate { type Error = String; fn try_from(value: VpcSubnetCreate) -> Result { Ok(Self { description: value.description?, ipv4_block: value.ipv4_block?, ipv6_block: value.ipv6_block?, name: value.name?, }) } } pub struct VpcSubnetResultsPage { items: Result, String>, next_page: Result, String>, } impl Default for VpcSubnetResultsPage { fn default() -> Self { Self { items: Err("no value supplied for items".to_string()), next_page: Ok(Default::default()), } } } impl VpcSubnetResultsPage { pub fn items(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.items = value .try_into() .map_err(|e| format!("error converting supplied value for items: {}", e)); self } pub fn next_page(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.next_page = value .try_into() .map_err(|e| format!("error converting supplied value for next_page: {}", e)); self } } impl std::convert::TryFrom for super::VpcSubnetResultsPage { type Error = String; fn try_from(value: VpcSubnetResultsPage) -> Result { Ok(Self { items: value.items?, next_page: value.next_page?, }) } } pub struct VpcSubnetUpdate { description: Result, String>, name: Result, String>, } impl Default for VpcSubnetUpdate { fn default() -> Self { Self { description: Ok(Default::default()), name: Ok(Default::default()), } } } impl VpcSubnetUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::VpcSubnetUpdate { type Error = String; fn try_from(value: VpcSubnetUpdate) -> Result { Ok(Self { description: value.description?, name: value.name?, }) } } pub struct VpcUpdate { description: Result, String>, dns_name: Result, String>, name: Result, String>, } impl Default for VpcUpdate { fn default() -> Self { Self { description: Ok(Default::default()), dns_name: Ok(Default::default()), name: Ok(Default::default()), } } } impl VpcUpdate { pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.description = value .try_into() .map_err(|e| format!("error converting supplied value for description: {}", e)); self } pub fn dns_name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.dns_name = value .try_into() .map_err(|e| format!("error converting supplied value for dns_name: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::VpcUpdate { type Error = String; fn try_from(value: VpcUpdate) -> Result { Ok(Self { description: value.description?, dns_name: value.dns_name?, name: value.name?, }) } } } mod defaults { pub(super) fn instance_create_network_interfaces( ) -> super::InstanceNetworkInterfaceAttachment { super::InstanceNetworkInterfaceAttachment::Default } } } #[derive(Clone, Debug)] ///Client for Oxide Region API /// ///API for interacting with the Oxide control plane 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 { let dur = std::time::Duration::from_secs(15); let client = reqwest::ClientBuilder::new() .connect_timeout(dur) .timeout(dur) .build() .unwrap(); Self::new_with_client(baseurl, client) } /// 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, } } /// Return the base URL to which requests are made. pub fn baseurl(&self) -> &String { &self.baseurl } /// Return the internal `reqwest::Client` used to make requests. pub fn client(&self) -> &reqwest::Client { &self.client } } impl Client { ///Get a disk by id /// ///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) } ///Get a global image by id /// ///Sends a `GET` request to `/by-id/global-images/{id}` ///```ignore /// let response = client.image_global_view_by_id() /// .id(id) /// .send() /// .await; /// ``` pub fn image_global_view_by_id(&self) -> builder::ImageGlobalViewById { builder::ImageGlobalViewById::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) } ///Get 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) } ///Get an instance's 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) } ///Get an organization by id /// ///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) } ///Get a project by id /// ///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) } ///Get 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) } ///Get a vpc router 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 VPC 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) } ///Get a VPC 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) } ///Get a VPC by id /// ///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 racks in the system /// ///Sends a `GET` request to `/hardware/racks` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to 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 information about a particular rack /// ///Sends a `GET` request to `/hardware/racks/{rack_id}` /// ///Arguments: /// - `rack_id`: The rack's unique ID. /// ///```ignore /// let response = client.rack_view() /// .rack_id(rack_id) /// .send() /// .await; /// ``` pub fn rack_view(&self) -> builder::RackView { builder::RackView::new(self) } ///List sleds in the system /// ///Sends a `GET` request to `/hardware/sleds` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.sled_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn sled_list(&self) -> builder::SledList { builder::SledList::new(self) } ///Fetch information about a sled in the system /// ///Sends a `GET` request to `/hardware/sleds/{sled_id}` /// ///Arguments: /// - `sled_id`: The sled's unique ID. /// ///```ignore /// let response = client.sled_view() /// .sled_id(sled_id) /// .send() /// .await; /// ``` pub fn sled_view(&self) -> builder::SledView { builder::SledView::new(self) } ///List global images /// ///Returns a list of all the global images. Global images are returned /// sorted by creation date, with the most recent images appearing first. /// ///Sends a `GET` request to `/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.image_global_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn image_global_list(&self) -> builder::ImageGlobalList { builder::ImageGlobalList::new(self) } ///Create a global image /// ///Create a new global image. This image can then be used by any user as a /// base for instances. /// ///Sends a `POST` request to `/images` ///```ignore /// let response = client.image_global_create() /// .body(body) /// .send() /// .await; /// ``` pub fn image_global_create(&self) -> builder::ImageGlobalCreate { builder::ImageGlobalCreate::new(self) } ///Get a global image /// ///Returns the details of a specific global image. /// ///Sends a `GET` request to `/images/{image_name}` ///```ignore /// let response = client.image_global_view() /// .image_name(image_name) /// .send() /// .await; /// ``` pub fn image_global_view(&self) -> builder::ImageGlobalView { builder::ImageGlobalView::new(self) } ///Delete a global image /// ///Permanently delete a global image. This operation cannot be undone. Any /// instances using the global image will continue to run, however new /// instances can not be created with this image. /// ///Sends a `DELETE` request to `/images/{image_name}` ///```ignore /// let response = client.image_global_delete() /// .image_name(image_name) /// .send() /// .await; /// ``` pub fn image_global_delete(&self) -> builder::ImageGlobalDelete { builder::ImageGlobalDelete::new(self) } ///List IP Pools /// ///Sends a `GET` request to `/ip-pools` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.ip_pool_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn ip_pool_list(&self) -> builder::IpPoolList { builder::IpPoolList::new(self) } ///Create a new IP Pool /// ///Sends a `POST` request to `/ip-pools` ///```ignore /// let response = client.ip_pool_create() /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_create(&self) -> builder::IpPoolCreate { builder::IpPoolCreate::new(self) } ///Fetch a single IP Pool /// ///Sends a `GET` request to `/ip-pools/{pool_name}` ///```ignore /// let response = client.ip_pool_view() /// .pool_name(pool_name) /// .send() /// .await; /// ``` pub fn ip_pool_view(&self) -> builder::IpPoolView { builder::IpPoolView::new(self) } ///Update an IP Pool /// ///Sends a `PUT` request to `/ip-pools/{pool_name}` ///```ignore /// let response = client.ip_pool_update() /// .pool_name(pool_name) /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_update(&self) -> builder::IpPoolUpdate { builder::IpPoolUpdate::new(self) } ///Delete an IP Pool /// ///Sends a `DELETE` request to `/ip-pools/{pool_name}` ///```ignore /// let response = client.ip_pool_delete() /// .pool_name(pool_name) /// .send() /// .await; /// ``` pub fn ip_pool_delete(&self) -> builder::IpPoolDelete { builder::IpPoolDelete::new(self) } ///List the ranges of IP addresses within an existing IP Pool /// ///Note that ranges are listed sorted by their first address. /// ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` /// ///Arguments: /// - `pool_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// ///```ignore /// let response = client.ip_pool_range_list() /// .pool_name(pool_name) /// .limit(limit) /// .page_token(page_token) /// .send() /// .await; /// ``` pub fn ip_pool_range_list(&self) -> builder::IpPoolRangeList { builder::IpPoolRangeList::new(self) } ///Add a new range to an existing IP Pool /// ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/add` ///```ignore /// let response = client.ip_pool_range_add() /// .pool_name(pool_name) /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_range_add(&self) -> builder::IpPoolRangeAdd { builder::IpPoolRangeAdd::new(self) } ///Remove a range from an existing IP Pool /// ///Sends a `POST` request to `/ip-pools/{pool_name}/ranges/remove` ///```ignore /// let response = client.ip_pool_range_remove() /// .pool_name(pool_name) /// .body(body) /// .send() /// .await; /// ``` pub fn ip_pool_range_remove(&self) -> builder::IpPoolRangeRemove { builder::IpPoolRangeRemove::new(self) } ///Sends a `POST` request to `/login` ///```ignore /// let response = client.spoof_login() /// .body(body) /// .send() /// .await; /// ``` pub fn spoof_login(&self) -> builder::SpoofLogin { builder::SpoofLogin::new(self) } ///Ask the user to login to their identity provider /// ///Either display a page asking a user for their credentials, or redirect /// them to their identity provider. /// ///Sends a `GET` request to `/login/{silo_name}/{provider_name}` ///```ignore /// let response = client.login() /// .silo_name(silo_name) /// .provider_name(provider_name) /// .send() /// .await; /// ``` pub fn login(&self) -> builder::Login { builder::Login::new(self) } ///Consume some sort of credentials, and authenticate a user /// ///Either receive a username and password, or some sort of identity /// provider data (like a SAMLResponse). Use these to set the user's session /// cookie. /// ///Sends a `POST` request to `/login/{silo_name}/{provider_name}` ///```ignore /// let response = client.consume_credentials() /// .silo_name(silo_name) /// .provider_name(provider_name) /// .body(body) /// .send() /// .await; /// ``` pub fn consume_credentials(&self) -> builder::ConsumeCredentials { builder::ConsumeCredentials::new(self) } ///Sends a `POST` request to `/logout` ///```ignore /// let response = client.logout() /// .send() /// .await; /// ``` pub fn logout(&self) -> builder::Logout { builder::Logout::new(self) } ///List all organizations /// ///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 a new organization /// ///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 a specific organization /// ///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 a specific organization /// ///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 a specific organization /// ///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 the IAM policy for this Organization /// ///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 the IAM policy for this Organization /// ///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 all projects /// ///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 new project /// ///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 specific project /// ///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 specific project /// ///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 specific project /// ///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 in a project /// ///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) } ///Create a disk in a project /// ///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) } ///Get a single disk in a project /// ///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) } ///Delete a disk from a project /// ///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 metrics for a disk /// ///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) } ///Get an image /// ///Get the details of 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 in a project /// ///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 in a project /// ///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) } ///Get an instance in a project /// ///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 from a project /// ///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 disks attached to this instance /// ///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) } ///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) } ///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 associated with an instance /// ///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 to a different propolis-server, possibly on a /// different sled /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/migrate` ```ignore /// let response = client.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 attached to this instance /// ///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 for an instance /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces` ```ignore /// let response = client.instance_network_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) } ///Get an interface attached to an instance /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore /// let response = client.instance_network_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 information about an instance's network interface /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore /// let response = client.instance_network_interface_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .interface_name(interface_name) /// .body(body) /// .send() /// .await; /// ``` pub fn instance_network_interface_update(&self) -> builder::InstanceNetworkInterfaceUpdate { builder::InstanceNetworkInterfaceUpdate::new(self) } ///Detach a network interface from an instance /// ///Note that the primary interface for an instance cannot be deleted if /// there are any secondary interfaces. A new primary interface must be /// designated first. The primary interface can be deleted if there are no /// secondary interfaces. /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/network-interfaces/{interface_name}` ```ignore /// let response = client.instance_network_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 /// ///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) } ///Get contents of an instance's serial console /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/instances/ /// {instance_name}/serial-console` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `instance_name` /// - `from_start`: Character index in the serial buffer from which to read, /// counting the bytes output since instance start. If this is not /// provided, `most_recent` must be provided, and if this *is* provided, /// `most_recent` must *not* be provided. /// - `max_bytes`: Maximum number of bytes of buffered serial console /// contents to return. If the requested range runs to the end of the /// available buffer, the data returned will be shorter than `max_bytes`. /// - `most_recent`: Character index in the serial buffer from which to /// read, counting *backward* from the most recently buffered data /// retrieved from the instance. (See note on `from_start` about mutual /// exclusivity) /// ///```ignore /// let response = client.instance_serial_console() /// .organization_name(organization_name) /// .project_name(project_name) /// .instance_name(instance_name) /// .from_start(from_start) /// .max_bytes(max_bytes) /// .most_recent(most_recent) /// .send() /// .await; /// ``` pub fn instance_serial_console(&self) -> builder::InstanceSerialConsole { builder::InstanceSerialConsole::new(self) } ///Boot an instance /// ///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 /// ///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 the IAM policy for this Project /// ///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 the IAM policy for this Project /// ///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 in a project /// ///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 of 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) } ///Get a snapshot in a project /// ///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 from a project /// ///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 in a project /// ///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 in a project /// ///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) } ///Get a VPC in a project /// ///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 from a project /// ///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 for a VPC /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` ```ignore /// let response = client.vpc_firewall_rules_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .send() /// .await; /// ``` pub fn vpc_firewall_rules_view(&self) -> builder::VpcFirewallRulesView { builder::VpcFirewallRulesView::new(self) } ///Replace the firewall rules for a VPC /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/firewall/rules` ```ignore /// let response = client.vpc_firewall_rules_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_firewall_rules_update(&self) -> builder::VpcFirewallRulesUpdate { builder::VpcFirewallRulesUpdate::new(self) } ///List VPC Custom and System Routers /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.vpc_router_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_router_list(&self) -> builder::VpcRouterList { builder::VpcRouterList::new(self) } ///Create a VPC Router /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers` ```ignore /// let response = client.vpc_router_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_create(&self) -> builder::VpcRouterCreate { builder::VpcRouterCreate::new(self) } ///Get a VPC Router /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` ```ignore /// let response = client.vpc_router_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .send() /// .await; /// ``` pub fn vpc_router_view(&self) -> builder::VpcRouterView { builder::VpcRouterView::new(self) } ///Update a VPC Router /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` ```ignore /// let response = client.vpc_router_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_update(&self) -> builder::VpcRouterUpdate { builder::VpcRouterUpdate::new(self) } ///Delete a router from its VPC /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}` ```ignore /// let response = client.vpc_router_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .send() /// .await; /// ``` pub fn vpc_router_delete(&self) -> builder::VpcRouterDelete { builder::VpcRouterDelete::new(self) } ///List a Router's routes /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `router_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.vpc_router_route_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_router_route_list(&self) -> builder::VpcRouterRouteList { builder::VpcRouterRouteList::new(self) } ///Create a VPC Router /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes` ```ignore /// let response = client.vpc_router_route_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_route_create(&self) -> builder::VpcRouterRouteCreate { builder::VpcRouterRouteCreate::new(self) } ///Get a VPC Router route /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore /// let response = client.vpc_router_route_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .route_name(route_name) /// .send() /// .await; /// ``` pub fn vpc_router_route_view(&self) -> builder::VpcRouterRouteView { builder::VpcRouterRouteView::new(self) } ///Update a Router route /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore /// let response = client.vpc_router_route_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .route_name(route_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_router_route_update(&self) -> builder::VpcRouterRouteUpdate { builder::VpcRouterRouteUpdate::new(self) } ///Delete a route from its router /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/routers/{router_name}/routes/{route_name}` ```ignore /// let response = client.vpc_router_route_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .router_name(router_name) /// .route_name(route_name) /// .send() /// .await; /// ``` pub fn vpc_router_route_delete(&self) -> builder::VpcRouterRouteDelete { builder::VpcRouterRouteDelete::new(self) } ///List subnets in a VPC /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.vpc_subnet_list() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_subnet_list(&self) -> builder::VpcSubnetList { builder::VpcSubnetList::new(self) } ///Create a subnet in a VPC /// ///Sends a `POST` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets` ```ignore /// let response = client.vpc_subnet_create() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_subnet_create(&self) -> builder::VpcSubnetCreate { builder::VpcSubnetCreate::new(self) } ///Get subnet in a VPC /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` ```ignore /// let response = client.vpc_subnet_view() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .send() /// .await; /// ``` pub fn vpc_subnet_view(&self) -> builder::VpcSubnetView { builder::VpcSubnetView::new(self) } ///Update a VPC Subnet /// ///Sends a `PUT` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` ```ignore /// let response = client.vpc_subnet_update() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .body(body) /// .send() /// .await; /// ``` pub fn vpc_subnet_update(&self) -> builder::VpcSubnetUpdate { builder::VpcSubnetUpdate::new(self) } ///Delete a subnet from a VPC /// ///Sends a `DELETE` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}` ```ignore /// let response = client.vpc_subnet_delete() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .send() /// .await; /// ``` pub fn vpc_subnet_delete(&self) -> builder::VpcSubnetDelete { builder::VpcSubnetDelete::new(self) } ///List network interfaces in a VPC subnet /// ///Sends a `GET` request to /// `/organizations/{organization_name}/projects/{project_name}/vpcs/ /// {vpc_name}/subnets/{subnet_name}/network-interfaces` /// ///Arguments: /// - `organization_name` /// - `project_name` /// - `vpc_name` /// - `subnet_name` /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.vpc_subnet_list_network_interfaces() /// .organization_name(organization_name) /// .project_name(project_name) /// .vpc_name(vpc_name) /// .subnet_name(subnet_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn vpc_subnet_list_network_interfaces(&self) -> builder::VpcSubnetListNetworkInterfaces { builder::VpcSubnetListNetworkInterfaces::new(self) } ///Fetch the top-level IAM policy /// ///Sends a `GET` request to `/policy` ///```ignore /// let response = client.policy_view() /// .send() /// .await; /// ``` pub fn policy_view(&self) -> builder::PolicyView { builder::PolicyView::new(self) } ///Update the top-level IAM policy /// ///Sends a `PUT` request to `/policy` ///```ignore /// let response = client.policy_update() /// .body(body) /// .send() /// .await; /// ``` pub fn policy_update(&self) -> builder::PolicyUpdate { builder::PolicyUpdate::new(self) } ///List the 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 specific 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) } ///List all sagas (for debugging) /// ///Sends a `GET` request to `/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 information about a single saga (for debugging) /// ///Sends a `GET` request to `/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) } ///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) } ///List the current user's SSH public keys /// ///Sends a `GET` request to `/session/me/sshkeys` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.session_sshkey_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn session_sshkey_list(&self) -> builder::SessionSshkeyList { builder::SessionSshkeyList::new(self) } ///Create a new SSH public key for the current user /// ///Sends a `POST` request to `/session/me/sshkeys` ///```ignore /// let response = client.session_sshkey_create() /// .body(body) /// .send() /// .await; /// ``` pub fn session_sshkey_create(&self) -> builder::SessionSshkeyCreate { builder::SessionSshkeyCreate::new(self) } ///Get (by name) an SSH public key belonging to the current user /// ///Sends a `GET` request to `/session/me/sshkeys/{ssh_key_name}` ///```ignore /// let response = client.session_sshkey_view() /// .ssh_key_name(ssh_key_name) /// .send() /// .await; /// ``` pub fn session_sshkey_view(&self) -> builder::SessionSshkeyView { builder::SessionSshkeyView::new(self) } ///Delete (by name) an SSH public key belonging to the current user /// ///Sends a `DELETE` request to `/session/me/sshkeys/{ssh_key_name}` ///```ignore /// let response = client.session_sshkey_delete() /// .ssh_key_name(ssh_key_name) /// .send() /// .await; /// ``` pub fn session_sshkey_delete(&self) -> builder::SessionSshkeyDelete { builder::SessionSshkeyDelete::new(self) } ///Sends a `GET` request to `/silos` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to 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 new silo /// ///Sends a `POST` request to `/silos` ///```ignore /// let response = client.silo_create() /// .body(body) /// .send() /// .await; /// ``` pub fn silo_create(&self) -> builder::SiloCreate { builder::SiloCreate::new(self) } ///Fetch a specific silo /// ///Sends a `GET` request to `/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 specific silo /// ///Sends a `DELETE` request to `/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 Silo identity providers /// ///Sends a `GET` request to `/silos/{silo_name}/identity-providers` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.silo_identity_provider_list() /// .silo_name(silo_name) /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn silo_identity_provider_list(&self) -> builder::SiloIdentityProviderList { builder::SiloIdentityProviderList::new(self) } ///Fetch the IAM policy for this Silo /// ///Sends a `GET` request to `/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 the IAM policy for this Silo /// ///Sends a `PUT` request to `/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) } ///Create a new SAML identity provider for a silo /// ///Sends a `POST` request to `/silos/{silo_name}/saml-identity-providers` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `body` /// ///```ignore /// let response = client.silo_identity_provider_create() /// .silo_name(silo_name) /// .body(body) /// .send() /// .await; /// ``` pub fn silo_identity_provider_create(&self) -> builder::SiloIdentityProviderCreate { builder::SiloIdentityProviderCreate::new(self) } ///GET a silo's SAML identity provider /// ///Sends a `GET` request to /// `/silos/{silo_name}/saml-identity-providers/{provider_name}` /// ///Arguments: /// - `silo_name`: The silo's unique name. /// - `provider_name`: The SAML identity provider's name /// ///```ignore /// let response = client.silo_identity_provider_view() /// .silo_name(silo_name) /// .provider_name(provider_name) /// .send() /// .await; /// ``` pub fn silo_identity_provider_view(&self) -> builder::SiloIdentityProviderView { builder::SiloIdentityProviderView::new(self) } ///List the built-in system users /// ///Sends a `GET` request to `/system/user` /// ///Arguments: /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page /// - `sort_by` /// ///```ignore /// let response = client.system_user_list() /// .limit(limit) /// .page_token(page_token) /// .sort_by(sort_by) /// .send() /// .await; /// ``` pub fn system_user_list(&self) -> builder::SystemUserList { builder::SystemUserList::new(self) } ///Fetch a specific built-in system user /// ///Sends a `GET` request to `/system/user/{user_name}` /// ///Arguments: /// - `user_name`: The built-in user's unique name. /// ///```ignore /// let response = client.system_user_view() /// .user_name(user_name) /// .send() /// .await; /// ``` pub fn system_user_view(&self) -> builder::SystemUserView { builder::SystemUserView::new(self) } ///List all timeseries schema /// ///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) } ///Refresh update metadata /// ///Sends a `POST` request to `/updates/refresh` ///```ignore /// let response = client.updates_refresh() /// .send() /// .await; /// ``` pub fn updates_refresh(&self) -> builder::UpdatesRefresh { builder::UpdatesRefresh::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) } } 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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_global_view_by_id`] /// ///[`Client::image_global_view_by_id`]: super::Client::image_global_view_by_id #[derive(Debug, Clone)] pub struct ImageGlobalViewById<'a> { client: &'a super::Client, id: Result, } impl<'a> ImageGlobalViewById<'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/global-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/global-images/{}", client.baseurl, encode_path(&id.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: 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 `DeviceAuthRequest` for body failed".to_string()); self } ///Sends a `POST` request to `/device/auth` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.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: 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 `DeviceAuthVerify` for body failed".to_string()); self } ///Sends a `POST` request to `/device/confirm` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/device/confirm", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 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: 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 `DeviceAccessTokenRequest` for body failed".to_string() }); self } ///Sends a `POST` request to `/device/token` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.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::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 `Option < 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 `Option < 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 `Option < IdSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/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!("{}/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).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 `/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 `/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!( "{}/hardware/racks/{}", client.baseurl, encode_path(&rack_id.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `Option < 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 `Option < 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 `Option < IdSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/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!("{}/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).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 `/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 `/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!( "{}/hardware/sleds/{}", client.baseurl, encode_path(&sled_id.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::image_global_list`] /// ///[`Client::image_global_list`]: super::Client::image_global_list #[derive(Debug, Clone)] pub struct ImageGlobalList<'a> { client: &'a super::Client, limit: Result, String>, page_token: Result, String>, sort_by: Result, String>, } impl<'a> ImageGlobalList<'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 `Option < 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 `Option < 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 `Option < NameSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/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!("{}/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).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 `/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_global_create`] /// ///[`Client::image_global_create`]: super::Client::image_global_create #[derive(Debug, Clone)] pub struct ImageGlobalCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> ImageGlobalCreate<'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 `GlobalImageCreate` for body failed".to_string()); self } ///Sends a `POST` request to `/images` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/images", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::image_global_view`] /// ///[`Client::image_global_view`]: super::Client::image_global_view #[derive(Debug, Clone)] pub struct ImageGlobalView<'a> { client: &'a super::Client, image_name: Result, } impl<'a> ImageGlobalView<'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 `/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!( "{}/images/{}", client.baseurl, encode_path(&image_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::image_global_delete`] /// ///[`Client::image_global_delete`]: super::Client::image_global_delete #[derive(Debug, Clone)] pub struct ImageGlobalDelete<'a> { client: &'a super::Client, image_name: Result, } impl<'a> ImageGlobalDelete<'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 `/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!( "{}/images/{}", client.baseurl, encode_path(&image_name.to_string()), ); let request = client.client.delete(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_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 `Option < 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 `Option < 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 `Option < NameOrIdSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/ip-pools` pub async fn send( self, ) -> Result, Error> { let Self { client, limit, page_token, sort_by, } = self; let 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!("{}/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).query(&query).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/ip-pools` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: 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: 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 `IpPoolCreate` for body failed".to_string()); self } ///Sends a `POST` request to `/ip-pools` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/ip-pools", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_view`] /// ///[`Client::ip_pool_view`]: super::Client::ip_pool_view #[derive(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 `/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!( "{}/ip-pools/{}", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_update`] /// ///[`Client::ip_pool_update`]: super::Client::ip_pool_update #[derive(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: 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 `IpPoolUpdate` for body failed".to_string()); self } ///Sends a `PUT` request to `/ip-pools/{pool_name}` pub async fn send(self) -> Result, Error> { let Self { client, pool_name, body, } = self; let pool_name = pool_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/ip-pools/{}", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client.client.put(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_delete`] /// ///[`Client::ip_pool_delete`]: super::Client::ip_pool_delete #[derive(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 `/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!( "{}/ip-pools/{}", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client.client.delete(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_range_list`] /// ///[`Client::ip_pool_range_list`]: super::Client::ip_pool_range_list #[derive(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 `Option < 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 `Option < String >` for page_token failed".to_string()); self } ///Sends a `GET` request to `/ip-pools/{pool_name}/ranges` pub async fn send( self, ) -> Result, Error> { let Self { client, pool_name, limit, page_token, } = self; let pool_name = 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!( "{}/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).query(&query).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/ip-pools/{pool_name}/ranges` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: 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 `/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!( "{}/ip-pools/{}/ranges/add", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::ip_pool_range_remove`] /// ///[`Client::ip_pool_range_remove`]: super::Client::ip_pool_range_remove #[derive(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 `/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!( "{}/ip-pools/{}/ranges/remove", client.baseurl, encode_path(&pool_name.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::spoof_login`] /// ///[`Client::spoof_login`]: super::Client::spoof_login #[derive(Debug, Clone)] pub struct SpoofLogin<'a> { client: &'a super::Client, body: Result, } impl<'a> SpoofLogin<'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 `SpoofLoginBody` for body failed".to_string()); self } ///Sends a `POST` request to `/login` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/login", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), } } } ///Builder for [`Client::login`] /// ///[`Client::login`]: super::Client::login #[derive(Debug, Clone)] pub struct Login<'a> { client: &'a super::Client, silo_name: Result, provider_name: Result, } impl<'a> Login<'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}/{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/{}/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&provider_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), } } } ///Builder for [`Client::consume_credentials`] /// ///[`Client::consume_credentials`]: super::Client::consume_credentials #[derive(Debug)] pub struct ConsumeCredentials<'a> { client: &'a super::Client, silo_name: Result, provider_name: Result, body: Result, } impl<'a> ConsumeCredentials<'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}/{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/{}/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&provider_name.to_string()), ); let request = client .client .post(url) .header( reqwest::header::CONTENT_TYPE, reqwest::header::HeaderValue::from_static("application/octet-stream"), ) .body(body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), _ => Err(Error::ErrorResponse(ResponseValue::stream(response))), } } } ///Builder for [`Client::logout`] /// ///[`Client::logout`]: super::Client::logout #[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).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::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 `Option < 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 `Option < 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 `Option < 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).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: 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 `OrganizationCreate` for body failed".to_string()); self } ///Sends a `POST` request to `/organizations` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/organizations", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `OrganizationUpdate` for body failed".to_string()); 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.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client.client.put(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `OrganizationRolePolicy` for body failed".to_string()); 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.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/policy", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client.client.put(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `ProjectCreate` for body failed".to_string()); 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.map_err(Error::InvalidRequest)?; let url = format!( "{}/organizations/{}/projects", client.baseurl, encode_path(&organization_name.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `ProjectUpdate` for body failed".to_string()); 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.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).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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `DiskCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).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 `Option < 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 `Option < 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 `Option < 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 `Option < 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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `ImageCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `InstanceCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `DiskIdentifier` for body failed".to_string()); 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.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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `DiskIdentifier` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `InstanceMigrate` for body failed".to_string()); 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.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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `NetworkInterfaceCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `NetworkInterfaceUpdate` for body failed".to_string()); 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.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).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).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).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 `Option < 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 `Option < 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 `Option < 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).query(&query).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::instance_start`] /// ///[`Client::instance_start`]: super::Client::instance_start #[derive(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).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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `ProjectRolePolicy` for body failed".to_string()); 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.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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `SnapshotCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `VpcCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `VpcUpdate` for body failed".to_string()); 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.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).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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value.try_into().map_err(|_| { "conversion to `VpcFirewallRuleUpdateParams` for body failed".to_string() }); 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.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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `VpcRouterCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `VpcRouterUpdate` for body failed".to_string()); 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.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).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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `RouterRouteCreateParams` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `RouterRouteUpdateParams` for body failed".to_string()); 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.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).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).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 `Option < 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 `Option < 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 `Option < 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).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: Err("body 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `VpcSubnetCreate` for body failed".to_string()); 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.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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: Err("body 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 } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `VpcSubnetUpdate` for body failed".to_string()); 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.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).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).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 `Option < 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 `Option < 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 `Option < 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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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: 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 `FleetRolePolicy` for body failed".to_string()); self } ///Sends a `PUT` request to `/policy` pub async fn send( self, ) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/policy", client.baseurl,); let request = client.client.put(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `Option < 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 `Option < 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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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 `Option < 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 `Option < 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 `Option < IdSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/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!("{}/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).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 `/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 `/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!( "{}/sagas/{}", client.baseurl, encode_path(&saga_id.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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_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 `Option < 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 `Option < 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 `Option < 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).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: 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 `SshKeyCreate` for body failed".to_string()); self } ///Sends a `POST` request to `/session/me/sshkeys` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/session/me/sshkeys", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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).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_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 `Option < 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 `Option < 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 `Option < NameOrIdSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/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!("{}/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).query(&query).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/silos` 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: 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 `SiloCreate` for body failed".to_string()); self } ///Sends a `POST` request to `/silos` pub async fn send(self) -> Result, Error> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/silos", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `/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!( "{}/silos/{}", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `/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!( "{}/silos/{}", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client.client.delete(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `Option < 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 `Option < 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 `Option < NameSortMode >` for sort_by failed".to_string() }); self } ///Sends a `GET` request to `/silos/{silo_name}/identity-providers` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, limit, page_token, sort_by, } = self; let silo_name = 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!( "{}/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).query(&query).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } ///Streams `GET` requests to `/silos/{silo_name}/identity-providers` pub fn stream( self, ) -> impl futures::Stream>> + Unpin + 'a { use futures::StreamExt; use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { limit: 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_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 `/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!( "{}/silos/{}/policy", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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: 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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `SiloRolePolicy` for body failed".to_string()); self } ///Sends a `PUT` request to `/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.map_err(Error::InvalidRequest)?; let url = format!( "{}/silos/{}/policy", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client.client.put(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_identity_provider_create`] /// ///[`Client::silo_identity_provider_create`]: super::Client::silo_identity_provider_create #[derive(Debug, Clone)] pub struct SiloIdentityProviderCreate<'a> { client: &'a super::Client, silo_name: Result, body: Result, } impl<'a> SiloIdentityProviderCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, silo_name: Err("silo_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 body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value.try_into().map_err(|_| { "conversion to `SamlIdentityProviderCreate` for body failed".to_string() }); self } ///Sends a `POST` request to /// `/silos/{silo_name}/saml-identity-providers` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, body, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/silos/{}/saml-identity-providers", client.baseurl, encode_path(&silo_name.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::silo_identity_provider_view`] /// ///[`Client::silo_identity_provider_view`]: super::Client::silo_identity_provider_view #[derive(Debug, Clone)] pub struct SiloIdentityProviderView<'a> { client: &'a super::Client, silo_name: Result, provider_name: Result, } impl<'a> SiloIdentityProviderView<'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 /// `/silos/{silo_name}/saml-identity-providers/{provider_name}` pub async fn send( self, ) -> Result, Error> { let Self { client, silo_name, provider_name, } = self; let silo_name = silo_name.map_err(Error::InvalidRequest)?; let provider_name = provider_name.map_err(Error::InvalidRequest)?; let url = format!( "{}/silos/{}/saml-identity-providers/{}", client.baseurl, encode_path(&silo_name.to_string()), encode_path(&provider_name.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::system_user_list`] /// ///[`Client::system_user_list`]: super::Client::system_user_list #[derive(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 `Option < 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 `Option < 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 `Option < 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).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).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, 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 `Option < 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 `Option < 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).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::updates_refresh`] /// ///[`Client::updates_refresh`]: super::Client::updates_refresh #[derive(Debug, Clone)] pub struct UpdatesRefresh<'a> { client: &'a super::Client, } impl<'a> UpdatesRefresh<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/updates/refresh` pub async fn send(self) -> Result, Error> { let Self { client } = self; let url = format!("{}/updates/refresh", client.baseurl,); let request = client.client.post(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 500u16..=599u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::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 `Option < 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 `Option < 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 `Option < 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).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() } } } pub mod prelude { pub use self::super::Client; }