update nexus and typify (#142)
This commit is contained in:
parent
dd26a17911
commit
ea5a6a5a79
|
@ -1727,7 +1727,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typify"
|
name = "typify"
|
||||||
version = "0.0.10-dev"
|
version = "0.0.10-dev"
|
||||||
source = "git+https://github.com/oxidecomputer/typify#46c474efa1d3d99e1e0820b4dd2ac42e3a9b5d6e"
|
source = "git+https://github.com/oxidecomputer/typify#b0520682aecfe077d0eb9c6612e4c5f71ab36bf6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"typify-impl",
|
"typify-impl",
|
||||||
"typify-macro",
|
"typify-macro",
|
||||||
|
@ -1736,7 +1736,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typify-impl"
|
name = "typify-impl"
|
||||||
version = "0.0.10-dev"
|
version = "0.0.10-dev"
|
||||||
source = "git+https://github.com/oxidecomputer/typify#46c474efa1d3d99e1e0820b4dd2ac42e3a9b5d6e"
|
source = "git+https://github.com/oxidecomputer/typify#b0520682aecfe077d0eb9c6612e4c5f71ab36bf6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"log",
|
"log",
|
||||||
|
@ -1754,7 +1754,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typify-macro"
|
name = "typify-macro"
|
||||||
version = "0.0.10-dev"
|
version = "0.0.10-dev"
|
||||||
source = "git+https://github.com/oxidecomputer/typify#46c474efa1d3d99e1e0820b4dd2ac42e3a9b5d6e"
|
source = "git+https://github.com/oxidecomputer/typify#b0520682aecfe077d0eb9c6612e4c5f71ab36bf6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -5,6 +5,64 @@ pub mod types {
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use std::convert::TryFrom;
|
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, 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, 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, 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,
|
||||||
|
}
|
||||||
|
|
||||||
|
///Type storing bin edges and a count of samples within it.
|
||||||
|
#[derive(Clone, Debug, Deserialize, 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,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct BlockSize(i64);
|
pub struct BlockSize(i64);
|
||||||
impl std::ops::Deref for BlockSize {
|
impl std::ops::Deref for BlockSize {
|
||||||
|
@ -41,6 +99,44 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///A cumulative or counter data type.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Cumulativedouble {
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
pub value: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A cumulative or counter data type.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Cumulativeint64 {
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
pub value: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A `Datum` is a single sampled data point from a metric.
|
||||||
|
#[derive(Clone, Debug, Deserialize, 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<u8>),
|
||||||
|
#[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.
|
///The type of an individual datum of a metric.
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub enum DatumType {
|
pub enum DatumType {
|
||||||
|
@ -124,34 +220,10 @@ pub mod types {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct Digest {
|
#[serde(tag = "type", content = "value")]
|
||||||
#[serde(rename = "type")]
|
pub enum Digest {
|
||||||
pub type_: DigestType,
|
|
||||||
pub value: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
|
||||||
pub enum DigestType {
|
|
||||||
#[serde(rename = "sha256")]
|
#[serde(rename = "sha256")]
|
||||||
Sha256,
|
Sha256(String),
|
||||||
}
|
|
||||||
|
|
||||||
impl ToString for DigestType {
|
|
||||||
fn to_string(&self) -> String {
|
|
||||||
match *self {
|
|
||||||
Self::Sha256 => "sha256".to_string(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::str::FromStr for DigestType {
|
|
||||||
type Err = &'static str;
|
|
||||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
|
||||||
match value {
|
|
||||||
"sha256" => Ok(Self::Sha256),
|
|
||||||
_ => Err("invalid value"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Client view of a [`Disk`]
|
///Client view of a [`Disk`]
|
||||||
|
@ -197,6 +269,50 @@ pub mod types {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, 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<Self, Self::Err> {
|
||||||
|
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
|
///A single page of results
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct DiskResultsPage {
|
pub struct DiskResultsPage {
|
||||||
|
@ -270,6 +386,36 @@ pub mod types {
|
||||||
pub request_id: String,
|
pub request_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct ExternalIp {
|
||||||
|
pub ip: std::net::IpAddr,
|
||||||
|
pub kind: IpKind,
|
||||||
|
}
|
||||||
|
|
||||||
|
///Parameters for creating an external IP address for instances.
|
||||||
|
#[derive(Clone, Debug, Deserialize, 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<Name>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
///A single page of results
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct ExternalIpResultsPage {
|
||||||
|
///list of items on this page of results
|
||||||
|
pub items: Vec<ExternalIp>,
|
||||||
|
///token used to fetch the next page of results (if any)
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub next_page: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
///The name and type information for a field of a timeseries schema.
|
///The name and type information for a field of a timeseries schema.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct FieldSchema {
|
pub struct FieldSchema {
|
||||||
|
@ -458,6 +604,104 @@ pub mod types {
|
||||||
pub next_page: Option<String>,
|
pub next_page: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///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::<Vec<_>>(); 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, Serialize)]
|
||||||
|
pub struct Histogramdouble {
|
||||||
|
pub bins: Vec<Bindouble>,
|
||||||
|
pub n_samples: u64,
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
|
///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::<Vec<_>>(); 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, Serialize)]
|
||||||
|
pub struct Histogramint64 {
|
||||||
|
pub bins: Vec<Binint64>,
|
||||||
|
pub n_samples: u64,
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
///Supported set of sort modes for scanning by id only.
|
///Supported set of sort modes for scanning by id only.
|
||||||
///
|
///
|
||||||
///Currently, we only support scanning in ascending order.
|
///Currently, we only support scanning in ascending order.
|
||||||
|
@ -677,6 +921,14 @@ pub mod types {
|
||||||
///The disks to be created or attached for this instance.
|
///The disks to be created or attached for this instance.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub disks: Vec<InstanceDiskAttachment>,
|
pub disks: Vec<InstanceDiskAttachment>,
|
||||||
|
///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<ExternalIpCreate>,
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
pub memory: ByteCount,
|
pub memory: ByteCount,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
@ -827,6 +1079,35 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///The kind of an external IP address for an instance
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, 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<Self, Self::Err> {
|
||||||
|
match value {
|
||||||
|
"ephemeral" => Ok(Self::Ephemeral),
|
||||||
|
"floating" => Ok(Self::Floating),
|
||||||
|
_ => Err("invalid value"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum IpNet {
|
pub enum IpNet {
|
||||||
|
@ -861,6 +1142,8 @@ pub mod types {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
///unique, mutable, user-controlled identifier for each resource
|
///unique, mutable, user-controlled identifier for each resource
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub project_id: Option<uuid::Uuid>,
|
||||||
///timestamp when this resource was created
|
///timestamp when this resource was created
|
||||||
pub time_created: chrono::DateTime<chrono::offset::Utc>,
|
pub time_created: chrono::DateTime<chrono::offset::Utc>,
|
||||||
///timestamp when this resource was last modified
|
///timestamp when this resource was last modified
|
||||||
|
@ -874,6 +1157,10 @@ pub mod types {
|
||||||
pub struct IpPoolCreate {
|
pub struct IpPoolCreate {
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub organization: Option<Name>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub project: Option<Name>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
@ -976,7 +1263,7 @@ pub mod types {
|
||||||
impl std::convert::TryFrom<&str> for Ipv6Net {
|
impl std::convert::TryFrom<&str> for Ipv6Net {
|
||||||
type Error = &'static str;
|
type Error = &'static str;
|
||||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||||
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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$") . 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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$\"") ; }
|
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()))
|
Ok(Self(value.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1102,9 +1389,26 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///A `Measurement` is a timestamped datum from a single metric
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Measurement {
|
||||||
|
pub datum: Datum,
|
||||||
|
pub timestamp: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A single page of results
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct MeasurementResultsPage {
|
||||||
|
///list of items on this page of results
|
||||||
|
pub items: Vec<Measurement>,
|
||||||
|
///token used to fetch the next page of results (if any)
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub next_page: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
///Names must begin with a lower case ASCII letter, be composed exclusively
|
///Names must begin with a lower case ASCII letter, be composed exclusively
|
||||||
/// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end
|
/// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end
|
||||||
/// with a '-'.
|
/// with a '-'. Names cannot be a UUID though they may contain a UUID.
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
pub struct Name(String);
|
pub struct Name(String);
|
||||||
impl std::ops::Deref for Name {
|
impl std::ops::Deref for Name {
|
||||||
|
@ -1120,13 +1424,7 @@ pub mod types {
|
||||||
if value.len() > 63usize {
|
if value.len() > 63usize {
|
||||||
return Err("longer than 63 characters");
|
return Err("longer than 63 characters");
|
||||||
}
|
}
|
||||||
if regress::Regex::new("^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$")
|
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]$\"") ; }
|
||||||
.unwrap()
|
|
||||||
.find(value)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return Err("doesn't match pattern \"^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$\"");
|
|
||||||
}
|
|
||||||
Ok(Self(value.to_string()))
|
Ok(Self(value.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2700,6 +2998,37 @@ pub trait ClientDisksExt {
|
||||||
/// .await;
|
/// .await;
|
||||||
/// ```
|
/// ```
|
||||||
fn disk_delete(&self) -> builder::DiskDelete;
|
fn disk_delete(&self) -> builder::DiskDelete;
|
||||||
|
///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;
|
||||||
|
/// ```
|
||||||
|
fn disk_metrics_list(&self) -> builder::DiskMetricsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientDisksExt for Client {
|
impl ClientDisksExt for Client {
|
||||||
|
@ -2722,6 +3051,10 @@ impl ClientDisksExt for Client {
|
||||||
fn disk_delete(&self) -> builder::DiskDelete {
|
fn disk_delete(&self) -> builder::DiskDelete {
|
||||||
builder::DiskDelete::new(self)
|
builder::DiskDelete::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn disk_metrics_list(&self) -> builder::DiskMetricsList {
|
||||||
|
builder::DiskMetricsList::new(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ClientHardwareExt {
|
pub trait ClientHardwareExt {
|
||||||
|
@ -3258,6 +3591,19 @@ pub trait ClientInstancesExt {
|
||||||
/// .await;
|
/// .await;
|
||||||
/// ```
|
/// ```
|
||||||
fn instance_disk_detach(&self) -> builder::InstanceDiskDetach;
|
fn instance_disk_detach(&self) -> builder::InstanceDiskDetach;
|
||||||
|
///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;
|
||||||
|
/// ```
|
||||||
|
fn instance_external_ip_list(&self) -> builder::InstanceExternalIpList;
|
||||||
///Migrate an instance to a different propolis-server, possibly on a
|
///Migrate an instance to a different propolis-server, possibly on a
|
||||||
/// different sled
|
/// different sled
|
||||||
///
|
///
|
||||||
|
@ -3474,6 +3820,10 @@ impl ClientInstancesExt for Client {
|
||||||
builder::InstanceDiskDetach::new(self)
|
builder::InstanceDiskDetach::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn instance_external_ip_list(&self) -> builder::InstanceExternalIpList {
|
||||||
|
builder::InstanceExternalIpList::new(self)
|
||||||
|
}
|
||||||
|
|
||||||
fn instance_migrate(&self) -> builder::InstanceMigrate {
|
fn instance_migrate(&self) -> builder::InstanceMigrate {
|
||||||
builder::InstanceMigrate::new(self)
|
builder::InstanceMigrate::new(self)
|
||||||
}
|
}
|
||||||
|
@ -8830,6 +9180,226 @@ pub mod builder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Builder for [`ClientDisksExt::disk_metrics_list`]
|
||||||
|
///
|
||||||
|
///[`ClientDisksExt::disk_metrics_list`]: super::ClientDisksExt::disk_metrics_list
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct DiskMetricsList<'a> {
|
||||||
|
client: &'a super::Client,
|
||||||
|
organization_name: Result<types::Name, String>,
|
||||||
|
project_name: Result<types::Name, String>,
|
||||||
|
disk_name: Result<types::Name, String>,
|
||||||
|
metric_name: Result<types::DiskMetricName, String>,
|
||||||
|
end_time: Result<Option<chrono::DateTime<chrono::offset::Utc>>, String>,
|
||||||
|
limit: Result<Option<std::num::NonZeroU32>, String>,
|
||||||
|
page_token: Result<Option<String>, String>,
|
||||||
|
start_time: Result<Option<chrono::DateTime<chrono::offset::Utc>>, 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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.organization_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for organization_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn project_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.project_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for project_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn disk_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.disk_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for disk_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn metric_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::DiskMetricName>,
|
||||||
|
{
|
||||||
|
self.metric_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `DiskMetricName` for metric_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn end_time<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
{
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<std::num::NonZeroU32>,
|
||||||
|
{
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<String>,
|
||||||
|
{
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
{
|
||||||
|
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<ResponseValue<types::MeasurementResultsPage>, Error<types::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::new();
|
||||||
|
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<Item = Result<types::Measurement, Error<types::Error>>> + 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 [`ClientImagesExt::image_list`]
|
///Builder for [`ClientImagesExt::image_list`]
|
||||||
///
|
///
|
||||||
///[`ClientImagesExt::image_list`]: super::ClientImagesExt::image_list
|
///[`ClientImagesExt::image_list`]: super::ClientImagesExt::image_list
|
||||||
|
@ -10092,6 +10662,95 @@ pub mod builder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Builder for [`ClientInstancesExt::instance_external_ip_list`]
|
||||||
|
///
|
||||||
|
///[`ClientInstancesExt::instance_external_ip_list`]: super::ClientInstancesExt::instance_external_ip_list
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct InstanceExternalIpList<'a> {
|
||||||
|
client: &'a super::Client,
|
||||||
|
organization_name: Result<types::Name, String>,
|
||||||
|
project_name: Result<types::Name, String>,
|
||||||
|
instance_name: Result<types::Name, String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.organization_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for organization_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn project_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.project_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for project_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn instance_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
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<ResponseValue<types::ExternalIpResultsPage>, Error<types::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 [`ClientInstancesExt::instance_migrate`]
|
///Builder for [`ClientInstancesExt::instance_migrate`]
|
||||||
///
|
///
|
||||||
///[`ClientInstancesExt::instance_migrate`]: super::ClientInstancesExt::instance_migrate
|
///[`ClientInstancesExt::instance_migrate`]: super::ClientInstancesExt::instance_migrate
|
||||||
|
|
|
@ -5,6 +5,64 @@ pub mod types {
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use std::convert::TryFrom;
|
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, Serialize, JsonSchema)]
|
||||||
|
#[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, Serialize, JsonSchema)]
|
||||||
|
#[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, Serialize, JsonSchema)]
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
|
||||||
|
///Type storing bin edges and a count of samples within it.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
pub struct BlockSize(i64);
|
pub struct BlockSize(i64);
|
||||||
impl std::ops::Deref for BlockSize {
|
impl std::ops::Deref for BlockSize {
|
||||||
|
@ -41,6 +99,44 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///A cumulative or counter data type.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
pub struct Cumulativedouble {
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
pub value: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A cumulative or counter data type.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
pub struct Cumulativeint64 {
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
pub value: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A `Datum` is a single sampled data point from a metric.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
#[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<u8>),
|
||||||
|
#[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.
|
///The type of an individual datum of a metric.
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema,
|
Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema,
|
||||||
|
@ -126,36 +222,10 @@ pub mod types {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
pub struct Digest {
|
#[serde(tag = "type", content = "value")]
|
||||||
#[serde(rename = "type")]
|
pub enum Digest {
|
||||||
pub type_: DigestType,
|
|
||||||
pub value: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(
|
|
||||||
Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema,
|
|
||||||
)]
|
|
||||||
pub enum DigestType {
|
|
||||||
#[serde(rename = "sha256")]
|
#[serde(rename = "sha256")]
|
||||||
Sha256,
|
Sha256(String),
|
||||||
}
|
|
||||||
|
|
||||||
impl ToString for DigestType {
|
|
||||||
fn to_string(&self) -> String {
|
|
||||||
match *self {
|
|
||||||
Self::Sha256 => "sha256".to_string(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::str::FromStr for DigestType {
|
|
||||||
type Err = &'static str;
|
|
||||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
|
||||||
match value {
|
|
||||||
"sha256" => Ok(Self::Sha256),
|
|
||||||
_ => Err("invalid value"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Client view of a [`Disk`]
|
///Client view of a [`Disk`]
|
||||||
|
@ -201,6 +271,52 @@ pub mod types {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema,
|
||||||
|
)]
|
||||||
|
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<Self, Self::Err> {
|
||||||
|
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
|
///A single page of results
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
pub struct DiskResultsPage {
|
pub struct DiskResultsPage {
|
||||||
|
@ -274,6 +390,36 @@ pub mod types {
|
||||||
pub request_id: String,
|
pub request_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
pub struct ExternalIp {
|
||||||
|
pub ip: std::net::IpAddr,
|
||||||
|
pub kind: IpKind,
|
||||||
|
}
|
||||||
|
|
||||||
|
///Parameters for creating an external IP address for instances.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
#[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<Name>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
///A single page of results
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
pub struct ExternalIpResultsPage {
|
||||||
|
///list of items on this page of results
|
||||||
|
pub items: Vec<ExternalIp>,
|
||||||
|
///token used to fetch the next page of results (if any)
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub next_page: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
///The name and type information for a field of a timeseries schema.
|
///The name and type information for a field of a timeseries schema.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
pub struct FieldSchema {
|
pub struct FieldSchema {
|
||||||
|
@ -468,6 +614,104 @@ pub mod types {
|
||||||
pub next_page: Option<String>,
|
pub next_page: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///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::<Vec<_>>(); 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, Serialize, JsonSchema)]
|
||||||
|
pub struct Histogramdouble {
|
||||||
|
pub bins: Vec<Bindouble>,
|
||||||
|
pub n_samples: u64,
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
|
///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::<Vec<_>>(); 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, Serialize, JsonSchema)]
|
||||||
|
pub struct Histogramint64 {
|
||||||
|
pub bins: Vec<Binint64>,
|
||||||
|
pub n_samples: u64,
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
///Supported set of sort modes for scanning by id only.
|
///Supported set of sort modes for scanning by id only.
|
||||||
///
|
///
|
||||||
///Currently, we only support scanning in ascending order.
|
///Currently, we only support scanning in ascending order.
|
||||||
|
@ -693,6 +937,14 @@ pub mod types {
|
||||||
///The disks to be created or attached for this instance.
|
///The disks to be created or attached for this instance.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub disks: Vec<InstanceDiskAttachment>,
|
pub disks: Vec<InstanceDiskAttachment>,
|
||||||
|
///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<ExternalIpCreate>,
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
pub memory: ByteCount,
|
pub memory: ByteCount,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
@ -845,6 +1097,37 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///The kind of an external IP address for an instance
|
||||||
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, JsonSchema,
|
||||||
|
)]
|
||||||
|
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<Self, Self::Err> {
|
||||||
|
match value {
|
||||||
|
"ephemeral" => Ok(Self::Ephemeral),
|
||||||
|
"floating" => Ok(Self::Floating),
|
||||||
|
_ => Err("invalid value"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum IpNet {
|
pub enum IpNet {
|
||||||
|
@ -879,6 +1162,8 @@ pub mod types {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
///unique, mutable, user-controlled identifier for each resource
|
///unique, mutable, user-controlled identifier for each resource
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub project_id: Option<uuid::Uuid>,
|
||||||
///timestamp when this resource was created
|
///timestamp when this resource was created
|
||||||
pub time_created: chrono::DateTime<chrono::offset::Utc>,
|
pub time_created: chrono::DateTime<chrono::offset::Utc>,
|
||||||
///timestamp when this resource was last modified
|
///timestamp when this resource was last modified
|
||||||
|
@ -892,6 +1177,10 @@ pub mod types {
|
||||||
pub struct IpPoolCreate {
|
pub struct IpPoolCreate {
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub organization: Option<Name>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub project: Option<Name>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
@ -994,7 +1283,7 @@ pub mod types {
|
||||||
impl std::convert::TryFrom<&str> for Ipv6Net {
|
impl std::convert::TryFrom<&str> for Ipv6Net {
|
||||||
type Error = &'static str;
|
type Error = &'static str;
|
||||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||||
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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$") . 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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$\"") ; }
|
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()))
|
Ok(Self(value.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1120,9 +1409,26 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///A `Measurement` is a timestamped datum from a single metric
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
pub struct Measurement {
|
||||||
|
pub datum: Datum,
|
||||||
|
pub timestamp: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A single page of results
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
|
||||||
|
pub struct MeasurementResultsPage {
|
||||||
|
///list of items on this page of results
|
||||||
|
pub items: Vec<Measurement>,
|
||||||
|
///token used to fetch the next page of results (if any)
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub next_page: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
///Names must begin with a lower case ASCII letter, be composed exclusively
|
///Names must begin with a lower case ASCII letter, be composed exclusively
|
||||||
/// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end
|
/// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end
|
||||||
/// with a '-'.
|
/// with a '-'. Names cannot be a UUID though they may contain a UUID.
|
||||||
#[derive(Clone, Debug, Serialize, JsonSchema)]
|
#[derive(Clone, Debug, Serialize, JsonSchema)]
|
||||||
pub struct Name(String);
|
pub struct Name(String);
|
||||||
impl std::ops::Deref for Name {
|
impl std::ops::Deref for Name {
|
||||||
|
@ -1138,13 +1444,7 @@ pub mod types {
|
||||||
if value.len() > 63usize {
|
if value.len() > 63usize {
|
||||||
return Err("longer than 63 characters");
|
return Err("longer than 63 characters");
|
||||||
}
|
}
|
||||||
if regress::Regex::new("^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$")
|
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]$\"") ; }
|
||||||
.unwrap()
|
|
||||||
.find(value)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return Err("doesn't match pattern \"^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$\"");
|
|
||||||
}
|
|
||||||
Ok(Self(value.to_string()))
|
Ok(Self(value.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3517,6 +3817,40 @@ impl Client {
|
||||||
builder::DiskDelete::new(self)
|
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
|
||||||
///
|
///
|
||||||
///List images in a project. The images are returned sorted by creation
|
///List images in a project. The images are returned sorted by creation
|
||||||
|
@ -3750,6 +4084,22 @@ impl Client {
|
||||||
builder::InstanceDiskDetach::new(self)
|
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
|
///Migrate an instance to a different propolis-server, possibly on a
|
||||||
/// different sled
|
/// different sled
|
||||||
///
|
///
|
||||||
|
@ -8651,6 +9001,226 @@ pub mod builder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Builder for [`Client::disk_metrics_list`]
|
||||||
|
///
|
||||||
|
///[`Client::disk_metrics_list`]: super::Client::disk_metrics_list
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct DiskMetricsList<'a> {
|
||||||
|
client: &'a super::Client,
|
||||||
|
organization_name: Result<types::Name, String>,
|
||||||
|
project_name: Result<types::Name, String>,
|
||||||
|
disk_name: Result<types::Name, String>,
|
||||||
|
metric_name: Result<types::DiskMetricName, String>,
|
||||||
|
end_time: Result<Option<chrono::DateTime<chrono::offset::Utc>>, String>,
|
||||||
|
limit: Result<Option<std::num::NonZeroU32>, String>,
|
||||||
|
page_token: Result<Option<String>, String>,
|
||||||
|
start_time: Result<Option<chrono::DateTime<chrono::offset::Utc>>, 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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.organization_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for organization_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn project_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.project_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for project_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn disk_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.disk_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for disk_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn metric_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::DiskMetricName>,
|
||||||
|
{
|
||||||
|
self.metric_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `DiskMetricName` for metric_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn end_time<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
{
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<std::num::NonZeroU32>,
|
||||||
|
{
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<String>,
|
||||||
|
{
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
{
|
||||||
|
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<ResponseValue<types::MeasurementResultsPage>, Error<types::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::new();
|
||||||
|
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<Item = Result<types::Measurement, Error<types::Error>>> + 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`]
|
///Builder for [`Client::image_list`]
|
||||||
///
|
///
|
||||||
///[`Client::image_list`]: super::Client::image_list
|
///[`Client::image_list`]: super::Client::image_list
|
||||||
|
@ -9913,6 +10483,95 @@ pub mod builder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Builder for [`Client::instance_external_ip_list`]
|
||||||
|
///
|
||||||
|
///[`Client::instance_external_ip_list`]: super::Client::instance_external_ip_list
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct InstanceExternalIpList<'a> {
|
||||||
|
client: &'a super::Client,
|
||||||
|
organization_name: Result<types::Name, String>,
|
||||||
|
project_name: Result<types::Name, String>,
|
||||||
|
instance_name: Result<types::Name, String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.organization_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for organization_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn project_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
self.project_name = value
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| "conversion to `Name` for project_name failed".to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn instance_name<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: TryInto<types::Name>,
|
||||||
|
{
|
||||||
|
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<ResponseValue<types::ExternalIpResultsPage>, Error<types::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`]
|
///Builder for [`Client::instance_migrate`]
|
||||||
///
|
///
|
||||||
///[`Client::instance_migrate`]: super::Client::instance_migrate
|
///[`Client::instance_migrate`]: super::Client::instance_migrate
|
||||||
|
|
|
@ -5,6 +5,64 @@ pub mod types {
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use std::convert::TryFrom;
|
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, 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, 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, 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,
|
||||||
|
}
|
||||||
|
|
||||||
|
///Type storing bin edges and a count of samples within it.
|
||||||
|
#[derive(Clone, Debug, Deserialize, 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,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct BlockSize(i64);
|
pub struct BlockSize(i64);
|
||||||
impl std::ops::Deref for BlockSize {
|
impl std::ops::Deref for BlockSize {
|
||||||
|
@ -41,6 +99,44 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///A cumulative or counter data type.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Cumulativedouble {
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
pub value: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A cumulative or counter data type.
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Cumulativeint64 {
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
pub value: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A `Datum` is a single sampled data point from a metric.
|
||||||
|
#[derive(Clone, Debug, Deserialize, 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<u8>),
|
||||||
|
#[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.
|
///The type of an individual datum of a metric.
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub enum DatumType {
|
pub enum DatumType {
|
||||||
|
@ -124,34 +220,10 @@ pub mod types {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct Digest {
|
#[serde(tag = "type", content = "value")]
|
||||||
#[serde(rename = "type")]
|
pub enum Digest {
|
||||||
pub type_: DigestType,
|
|
||||||
pub value: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
|
||||||
pub enum DigestType {
|
|
||||||
#[serde(rename = "sha256")]
|
#[serde(rename = "sha256")]
|
||||||
Sha256,
|
Sha256(String),
|
||||||
}
|
|
||||||
|
|
||||||
impl ToString for DigestType {
|
|
||||||
fn to_string(&self) -> String {
|
|
||||||
match *self {
|
|
||||||
Self::Sha256 => "sha256".to_string(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::str::FromStr for DigestType {
|
|
||||||
type Err = &'static str;
|
|
||||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
|
||||||
match value {
|
|
||||||
"sha256" => Ok(Self::Sha256),
|
|
||||||
_ => Err("invalid value"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Client view of a [`Disk`]
|
///Client view of a [`Disk`]
|
||||||
|
@ -197,6 +269,50 @@ pub mod types {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, 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<Self, Self::Err> {
|
||||||
|
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
|
///A single page of results
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct DiskResultsPage {
|
pub struct DiskResultsPage {
|
||||||
|
@ -270,6 +386,36 @@ pub mod types {
|
||||||
pub request_id: String,
|
pub request_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct ExternalIp {
|
||||||
|
pub ip: std::net::IpAddr,
|
||||||
|
pub kind: IpKind,
|
||||||
|
}
|
||||||
|
|
||||||
|
///Parameters for creating an external IP address for instances.
|
||||||
|
#[derive(Clone, Debug, Deserialize, 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<Name>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
///A single page of results
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct ExternalIpResultsPage {
|
||||||
|
///list of items on this page of results
|
||||||
|
pub items: Vec<ExternalIp>,
|
||||||
|
///token used to fetch the next page of results (if any)
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub next_page: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
///The name and type information for a field of a timeseries schema.
|
///The name and type information for a field of a timeseries schema.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct FieldSchema {
|
pub struct FieldSchema {
|
||||||
|
@ -458,6 +604,104 @@ pub mod types {
|
||||||
pub next_page: Option<String>,
|
pub next_page: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///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::<Vec<_>>(); 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, Serialize)]
|
||||||
|
pub struct Histogramdouble {
|
||||||
|
pub bins: Vec<Bindouble>,
|
||||||
|
pub n_samples: u64,
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
|
///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::<Vec<_>>(); 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, Serialize)]
|
||||||
|
pub struct Histogramint64 {
|
||||||
|
pub bins: Vec<Binint64>,
|
||||||
|
pub n_samples: u64,
|
||||||
|
pub start_time: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
///Supported set of sort modes for scanning by id only.
|
///Supported set of sort modes for scanning by id only.
|
||||||
///
|
///
|
||||||
///Currently, we only support scanning in ascending order.
|
///Currently, we only support scanning in ascending order.
|
||||||
|
@ -677,6 +921,14 @@ pub mod types {
|
||||||
///The disks to be created or attached for this instance.
|
///The disks to be created or attached for this instance.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub disks: Vec<InstanceDiskAttachment>,
|
pub disks: Vec<InstanceDiskAttachment>,
|
||||||
|
///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<ExternalIpCreate>,
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
pub memory: ByteCount,
|
pub memory: ByteCount,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
@ -827,6 +1079,35 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///The kind of an external IP address for an instance
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, 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<Self, Self::Err> {
|
||||||
|
match value {
|
||||||
|
"ephemeral" => Ok(Self::Ephemeral),
|
||||||
|
"floating" => Ok(Self::Floating),
|
||||||
|
_ => Err("invalid value"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum IpNet {
|
pub enum IpNet {
|
||||||
|
@ -861,6 +1142,8 @@ pub mod types {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
///unique, mutable, user-controlled identifier for each resource
|
///unique, mutable, user-controlled identifier for each resource
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub project_id: Option<uuid::Uuid>,
|
||||||
///timestamp when this resource was created
|
///timestamp when this resource was created
|
||||||
pub time_created: chrono::DateTime<chrono::offset::Utc>,
|
pub time_created: chrono::DateTime<chrono::offset::Utc>,
|
||||||
///timestamp when this resource was last modified
|
///timestamp when this resource was last modified
|
||||||
|
@ -874,6 +1157,10 @@ pub mod types {
|
||||||
pub struct IpPoolCreate {
|
pub struct IpPoolCreate {
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub organization: Option<Name>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub project: Option<Name>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
@ -976,7 +1263,7 @@ pub mod types {
|
||||||
impl std::convert::TryFrom<&str> for Ipv6Net {
|
impl std::convert::TryFrom<&str> for Ipv6Net {
|
||||||
type Error = &'static str;
|
type Error = &'static str;
|
||||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||||
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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$") . 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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$\"") ; }
|
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()))
|
Ok(Self(value.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1102,9 +1389,26 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///A `Measurement` is a timestamped datum from a single metric
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Measurement {
|
||||||
|
pub datum: Datum,
|
||||||
|
pub timestamp: chrono::DateTime<chrono::offset::Utc>,
|
||||||
|
}
|
||||||
|
|
||||||
|
///A single page of results
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct MeasurementResultsPage {
|
||||||
|
///list of items on this page of results
|
||||||
|
pub items: Vec<Measurement>,
|
||||||
|
///token used to fetch the next page of results (if any)
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub next_page: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
///Names must begin with a lower case ASCII letter, be composed exclusively
|
///Names must begin with a lower case ASCII letter, be composed exclusively
|
||||||
/// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end
|
/// of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end
|
||||||
/// with a '-'.
|
/// with a '-'. Names cannot be a UUID though they may contain a UUID.
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
pub struct Name(String);
|
pub struct Name(String);
|
||||||
impl std::ops::Deref for Name {
|
impl std::ops::Deref for Name {
|
||||||
|
@ -1120,13 +1424,7 @@ pub mod types {
|
||||||
if value.len() > 63usize {
|
if value.len() > 63usize {
|
||||||
return Err("longer than 63 characters");
|
return Err("longer than 63 characters");
|
||||||
}
|
}
|
||||||
if regress::Regex::new("^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$")
|
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]$\"") ; }
|
||||||
.unwrap()
|
|
||||||
.find(value)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return Err("doesn't match pattern \"^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$\"");
|
|
||||||
}
|
|
||||||
Ok(Self(value.to_string()))
|
Ok(Self(value.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4556,6 +4854,145 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///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.
|
||||||
|
pub async fn disk_metrics_list<'a>(
|
||||||
|
&'a self,
|
||||||
|
organization_name: &'a types::Name,
|
||||||
|
project_name: &'a types::Name,
|
||||||
|
disk_name: &'a types::Name,
|
||||||
|
metric_name: types::DiskMetricName,
|
||||||
|
end_time: Option<&'a chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
limit: Option<std::num::NonZeroU32>,
|
||||||
|
page_token: Option<&'a str>,
|
||||||
|
start_time: Option<&'a chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
) -> Result<ResponseValue<types::MeasurementResultsPage>, Error<types::Error>> {
|
||||||
|
let url = format!(
|
||||||
|
"{}/organizations/{}/projects/{}/disks/{}/metrics/{}",
|
||||||
|
self.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::new();
|
||||||
|
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 = self.client.get(url).query(&query).build()?;
|
||||||
|
let result = self.client.execute(request).await;
|
||||||
|
let response = result?;
|
||||||
|
match response.status().as_u16() {
|
||||||
|
200u16 => ResponseValue::from_response(response).await,
|
||||||
|
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||||
|
ResponseValue::from_response(response).await?,
|
||||||
|
)),
|
||||||
|
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||||
|
ResponseValue::from_response(response).await?,
|
||||||
|
)),
|
||||||
|
_ => Err(Error::UnexpectedResponse(response)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///Fetch metrics for a disk as a Stream
|
||||||
|
///
|
||||||
|
///Sends repeated `GET` requests to
|
||||||
|
/// `/organizations/{organization_name}/projects/{project_name}/disks/
|
||||||
|
/// {disk_name}/metrics/{metric_name}` until there are no more results.
|
||||||
|
///
|
||||||
|
///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
|
||||||
|
/// - `start_time`: An inclusive start time of metrics.
|
||||||
|
pub fn disk_metrics_list_stream<'a>(
|
||||||
|
&'a self,
|
||||||
|
organization_name: &'a types::Name,
|
||||||
|
project_name: &'a types::Name,
|
||||||
|
disk_name: &'a types::Name,
|
||||||
|
metric_name: types::DiskMetricName,
|
||||||
|
end_time: Option<&'a chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
limit: Option<std::num::NonZeroU32>,
|
||||||
|
start_time: Option<&'a chrono::DateTime<chrono::offset::Utc>>,
|
||||||
|
) -> impl futures::Stream<Item = Result<types::Measurement, Error<types::Error>>> + Unpin + '_
|
||||||
|
{
|
||||||
|
use futures::StreamExt;
|
||||||
|
use futures::TryFutureExt;
|
||||||
|
use futures::TryStreamExt;
|
||||||
|
self.disk_metrics_list(
|
||||||
|
organization_name,
|
||||||
|
project_name,
|
||||||
|
disk_name,
|
||||||
|
metric_name,
|
||||||
|
end_time,
|
||||||
|
limit,
|
||||||
|
None,
|
||||||
|
start_time,
|
||||||
|
)
|
||||||
|
.map_ok(move |page| {
|
||||||
|
let page = page.into_inner();
|
||||||
|
let first = futures::stream::iter(page.items.into_iter().map(Ok));
|
||||||
|
let rest = futures::stream::try_unfold(page.next_page, move |state| async move {
|
||||||
|
if state.is_none() {
|
||||||
|
Ok(None)
|
||||||
|
} else {
|
||||||
|
self.disk_metrics_list(
|
||||||
|
organization_name,
|
||||||
|
project_name,
|
||||||
|
disk_name,
|
||||||
|
metric_name,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
state.as_deref(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.map_ok(|page| {
|
||||||
|
let page = page.into_inner();
|
||||||
|
Some((
|
||||||
|
futures::stream::iter(page.items.into_iter().map(Ok)),
|
||||||
|
page.next_page,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.try_flatten();
|
||||||
|
first.chain(rest)
|
||||||
|
})
|
||||||
|
.try_flatten_stream()
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
///List images
|
///List images
|
||||||
///
|
///
|
||||||
///List images in a project. The images are returned sorted by creation
|
///List images in a project. The images are returned sorted by creation
|
||||||
|
@ -5174,6 +5611,39 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///List external IP addresses associated with an instance
|
||||||
|
///
|
||||||
|
///Sends a `GET` request to
|
||||||
|
/// `/organizations/{organization_name}/projects/{project_name}/instances/
|
||||||
|
/// {instance_name}/external-ips`
|
||||||
|
pub async fn instance_external_ip_list<'a>(
|
||||||
|
&'a self,
|
||||||
|
organization_name: &'a types::Name,
|
||||||
|
project_name: &'a types::Name,
|
||||||
|
instance_name: &'a types::Name,
|
||||||
|
) -> Result<ResponseValue<types::ExternalIpResultsPage>, Error<types::Error>> {
|
||||||
|
let url = format!(
|
||||||
|
"{}/organizations/{}/projects/{}/instances/{}/external-ips",
|
||||||
|
self.baseurl,
|
||||||
|
encode_path(&organization_name.to_string()),
|
||||||
|
encode_path(&project_name.to_string()),
|
||||||
|
encode_path(&instance_name.to_string()),
|
||||||
|
);
|
||||||
|
let request = self.client.get(url).build()?;
|
||||||
|
let result = self.client.execute(request).await;
|
||||||
|
let response = result?;
|
||||||
|
match response.status().as_u16() {
|
||||||
|
200u16 => ResponseValue::from_response(response).await,
|
||||||
|
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||||
|
ResponseValue::from_response(response).await?,
|
||||||
|
)),
|
||||||
|
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||||
|
ResponseValue::from_response(response).await?,
|
||||||
|
)),
|
||||||
|
_ => Err(Error::UnexpectedResponse(response)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///Migrate an instance to a different propolis-server, possibly on a
|
///Migrate an instance to a different propolis-server, possibly on a
|
||||||
/// different sled
|
/// different sled
|
||||||
///
|
///
|
||||||
|
|
|
@ -2229,6 +2229,114 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/organizations/{organization_name}/projects/{project_name}/disks/{disk_name}/metrics/{metric_name}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"disks"
|
||||||
|
],
|
||||||
|
"summary": "Fetch metrics for a disk.",
|
||||||
|
"operationId": "disk_metrics_list",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "disk_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "metric_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/DiskMetricName"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "organization_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "project_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "end_time",
|
||||||
|
"description": "An exclusive end time of metrics.",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"style": "form"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "Maximum number of items returned by a single call",
|
||||||
|
"schema": {
|
||||||
|
"nullable": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint32",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"style": "form"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "page_token",
|
||||||
|
"description": "Token returned by previous call to retrieve the subsequent page",
|
||||||
|
"schema": {
|
||||||
|
"nullable": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"style": "form"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "start_time",
|
||||||
|
"description": "An inclusive start time of metrics.",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"style": "form"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/MeasurementResultsPage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"4XX": {
|
||||||
|
"$ref": "#/components/responses/Error"
|
||||||
|
},
|
||||||
|
"5XX": {
|
||||||
|
"$ref": "#/components/responses/Error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-dropshot-pagination": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"/organizations/{organization_name}/projects/{project_name}/images": {
|
"/organizations/{organization_name}/projects/{project_name}/images": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -2930,6 +3038,62 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/organizations/{organization_name}/projects/{project_name}/instances/{instance_name}/external-ips": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"instances"
|
||||||
|
],
|
||||||
|
"summary": "List external IP addresses associated with an instance",
|
||||||
|
"operationId": "instance_external_ip_list",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "instance_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "organization_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "project_name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"style": "simple"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ExternalIpResultsPage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"4XX": {
|
||||||
|
"$ref": "#/components/responses/Error"
|
||||||
|
},
|
||||||
|
"5XX": {
|
||||||
|
"$ref": "#/components/responses/Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/organizations/{organization_name}/projects/{project_name}/instances/{instance_name}/migrate": {
|
"/organizations/{organization_name}/projects/{project_name}/instances/{instance_name}/migrate": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -6652,6 +6816,194 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemas": {
|
"schemas": {
|
||||||
|
"BinRangedouble": {
|
||||||
|
"description": "A type storing a range over `T`.\n\nThis type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively.",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"description": "A range unbounded below and exclusively above, `..end`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"end": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"range_to"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"end",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A range bounded inclusively below and exclusively above, `start..end`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"end": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"range"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"end",
|
||||||
|
"start",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A range bounded inclusively below and unbounded above, `start..`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"start": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"range_from"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"start",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"BinRangeint64": {
|
||||||
|
"description": "A type storing a range over `T`.\n\nThis type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively.",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"description": "A range unbounded below and exclusively above, `..end`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"end": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"range_to"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"end",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A range bounded inclusively below and exclusively above, `start..end`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"end": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"range"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"end",
|
||||||
|
"start",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A range bounded inclusively below and unbounded above, `start..`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"start": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"range_from"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"start",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Bindouble": {
|
||||||
|
"description": "Type storing bin edges and a count of samples within it.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"count": {
|
||||||
|
"description": "The total count of samples in this bin.",
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint64",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"range": {
|
||||||
|
"description": "The range of the support covered by this bin.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/BinRangedouble"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"count",
|
||||||
|
"range"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Binint64": {
|
||||||
|
"description": "Type storing bin edges and a count of samples within it.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"count": {
|
||||||
|
"description": "The total count of samples in this bin.",
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint64",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"range": {
|
||||||
|
"description": "The range of the support covered by this bin.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/BinRangeint64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"count",
|
||||||
|
"range"
|
||||||
|
]
|
||||||
|
},
|
||||||
"BlockSize": {
|
"BlockSize": {
|
||||||
"title": "disk block size in bytes",
|
"title": "disk block size in bytes",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
|
@ -6667,6 +7019,216 @@
|
||||||
"format": "uint64",
|
"format": "uint64",
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
},
|
},
|
||||||
|
"Cumulativedouble": {
|
||||||
|
"description": "A cumulative or counter data type.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"start_time": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"start_time",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Cumulativeint64": {
|
||||||
|
"description": "A cumulative or counter data type.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"start_time": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"start_time",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Datum": {
|
||||||
|
"description": "A `Datum` is a single sampled data point from a metric.",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"bool"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"i64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"f64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"string"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint8",
|
||||||
|
"minimum": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"bytes"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"$ref": "#/components/schemas/Cumulativeint64"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"cumulative_i64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"$ref": "#/components/schemas/Cumulativedouble"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"cumulative_f64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"$ref": "#/components/schemas/Histogramint64"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"histogram_i64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"$ref": "#/components/schemas/Histogramdouble"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"histogram_f64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"DatumType": {
|
"DatumType": {
|
||||||
"description": "The type of an individual datum of a metric.",
|
"description": "The type of an individual datum of a metric.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -7157,6 +7719,71 @@
|
||||||
"request_id"
|
"request_id"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"ExternalIp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ip": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "ip"
|
||||||
|
},
|
||||||
|
"kind": {
|
||||||
|
"$ref": "#/components/schemas/IpKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"ip",
|
||||||
|
"kind"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ExternalIpCreate": {
|
||||||
|
"description": "Parameters for creating an external IP address for instances.",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"description": "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.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"pool_name": {
|
||||||
|
"nullable": true,
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"ephemeral"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ExternalIpResultsPage": {
|
||||||
|
"description": "A single page of results",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"description": "list of items on this page of results",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/ExternalIp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"next_page": {
|
||||||
|
"nullable": true,
|
||||||
|
"description": "token used to fetch the next page of results (if any)",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"items"
|
||||||
|
]
|
||||||
|
},
|
||||||
"FieldSchema": {
|
"FieldSchema": {
|
||||||
"description": "The name and type information for a field of a timeseries schema.",
|
"description": "The name and type information for a field of a timeseries schema.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -7387,6 +8014,58 @@
|
||||||
"items"
|
"items"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"Histogramdouble": {
|
||||||
|
"description": "A simple type for managing a histogram metric.\n\nA 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.\n\nNote that any gaps, unsorted bins, or non-finite values will result in an error.\n\nExample ------- ```rust use oximeter::histogram::{BinRange, Histogram};\n\nlet 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);\n\nlet data = hist.iter().collect::<Vec<_>>(); 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\n\nassert_eq!(data[1].range, BinRange::range(0, 10)); // The range `0..10` assert_eq!(data[1].count, 1); // 4 is sampled into this bin ```\n\nNotes -----\n\nHistograms 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.\n\nThe 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.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bins": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/Bindouble"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"n_samples": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint64",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"start_time": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"bins",
|
||||||
|
"n_samples",
|
||||||
|
"start_time"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Histogramint64": {
|
||||||
|
"description": "A simple type for managing a histogram metric.\n\nA 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.\n\nNote that any gaps, unsorted bins, or non-finite values will result in an error.\n\nExample ------- ```rust use oximeter::histogram::{BinRange, Histogram};\n\nlet 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);\n\nlet data = hist.iter().collect::<Vec<_>>(); 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\n\nassert_eq!(data[1].range, BinRange::range(0, 10)); // The range `0..10` assert_eq!(data[1].count, 1); // 4 is sampled into this bin ```\n\nNotes -----\n\nHistograms 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.\n\nThe 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.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bins": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/Binint64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"n_samples": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint64",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"start_time": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"bins",
|
||||||
|
"n_samples",
|
||||||
|
"start_time"
|
||||||
|
]
|
||||||
|
},
|
||||||
"IdentityProvider": {
|
"IdentityProvider": {
|
||||||
"description": "Client view of an [`IdentityProvider`]",
|
"description": "Client view of an [`IdentityProvider`]",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -7804,6 +8483,14 @@
|
||||||
"$ref": "#/components/schemas/InstanceDiskAttachment"
|
"$ref": "#/components/schemas/InstanceDiskAttachment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"external_ips": {
|
||||||
|
"description": "The external IP addresses provided to this instance.\n\nBy 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.",
|
||||||
|
"default": [],
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/ExternalIpCreate"
|
||||||
|
}
|
||||||
|
},
|
||||||
"hostname": {
|
"hostname": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -8044,6 +8731,14 @@
|
||||||
"destroyed"
|
"destroyed"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"IpKind": {
|
||||||
|
"description": "The kind of an external IP address for an instance",
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"ephemeral",
|
||||||
|
"floating"
|
||||||
|
]
|
||||||
|
},
|
||||||
"IpNet": {
|
"IpNet": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
|
@ -8085,6 +8780,11 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"project_id": {
|
||||||
|
"nullable": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
"time_created": {
|
"time_created": {
|
||||||
"description": "timestamp when this resource was created",
|
"description": "timestamp when this resource was created",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -8113,6 +8813,12 @@
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"$ref": "#/components/schemas/Name"
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"organization": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"$ref": "#/components/schemas/Name"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
@ -8251,7 +8957,7 @@
|
||||||
"title": "An IPv6 subnet",
|
"title": "An IPv6 subnet",
|
||||||
"description": "An IPv6 subnet, including prefix and subnet mask",
|
"description": "An IPv6 subnet, including prefix and subnet mask",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"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}:)\\/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$"
|
"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])$"
|
||||||
},
|
},
|
||||||
"Ipv6Range": {
|
"Ipv6Range": {
|
||||||
"description": "A non-decreasing IPv6 address range, inclusive of both ends.\n\nThe first address must be less than or equal to the last address.",
|
"description": "A non-decreasing IPv6 address range, inclusive of both ends.\n\nThe first address must be less than or equal to the last address.",
|
||||||
|
@ -8289,11 +8995,49 @@
|
||||||
"minLength": 17,
|
"minLength": 17,
|
||||||
"maxLength": 17
|
"maxLength": 17
|
||||||
},
|
},
|
||||||
|
"Measurement": {
|
||||||
|
"description": "A `Measurement` is a timestamped datum from a single metric",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"datum": {
|
||||||
|
"$ref": "#/components/schemas/Datum"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"datum",
|
||||||
|
"timestamp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"MeasurementResultsPage": {
|
||||||
|
"description": "A single page of results",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"description": "list of items on this page of results",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/Measurement"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"next_page": {
|
||||||
|
"nullable": true,
|
||||||
|
"description": "token used to fetch the next page of results (if any)",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"items"
|
||||||
|
]
|
||||||
|
},
|
||||||
"Name": {
|
"Name": {
|
||||||
"title": "A name unique within the parent collection",
|
"title": "A name unique within the parent collection",
|
||||||
"description": "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 '-'.",
|
"description": "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.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "^[a-z](|[a-zA-Z0-9-]*[a-zA-Z0-9])$",
|
"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]$",
|
||||||
"maxLength": 63
|
"maxLength": 63
|
||||||
},
|
},
|
||||||
"NetworkInterface": {
|
"NetworkInterface": {
|
||||||
|
@ -10912,6 +11656,17 @@
|
||||||
"name_descending",
|
"name_descending",
|
||||||
"id_ascending"
|
"id_ascending"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"DiskMetricName": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"activated",
|
||||||
|
"flush",
|
||||||
|
"read",
|
||||||
|
"read_bytes",
|
||||||
|
"write",
|
||||||
|
"write_bytes"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue