#[allow(unused_imports)]
use progenitor_client::{encode_path, RequestBuilderExt};
pub use progenitor_client::{ByteStream, Error, ResponseValue};
#[allow(unused_imports)]
use reqwest::header::{HeaderMap, HeaderValue};
pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
///Describes properties that should uniquely identify a Gimlet.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Describes properties that should uniquely identify a
/// Gimlet.",
/// "type": "object",
/// "required": [
/// "part",
/// "revision",
/// "serial"
/// ],
/// "properties": {
/// "part": {
/// "type": "string"
/// },
/// "revision": {
/// "type": "integer",
/// "format": "int64"
/// },
/// "serial": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Baseboard {
pub part: String,
pub revision: i64,
pub serial: String,
}
impl From<&Baseboard> for Baseboard {
fn from(value: &Baseboard) -> Self {
value.clone()
}
}
///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.
///
/// JSON schema
///
/// ```json
///{
/// "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",
/// "required": [
/// "end",
/// "type"
/// ],
/// "properties": {
/// "end": {
/// "type": "number",
/// "format": "double"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "range_to"
/// ]
/// }
/// }
/// },
/// {
/// "description": "A range bounded inclusively below and exclusively
/// above, `start..end`.",
/// "type": "object",
/// "required": [
/// "end",
/// "start",
/// "type"
/// ],
/// "properties": {
/// "end": {
/// "type": "number",
/// "format": "double"
/// },
/// "start": {
/// "type": "number",
/// "format": "double"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "range"
/// ]
/// }
/// }
/// },
/// {
/// "description": "A range bounded inclusively below and unbounded
/// above, `start..`.",
/// "type": "object",
/// "required": [
/// "start",
/// "type"
/// ],
/// "properties": {
/// "start": {
/// "type": "number",
/// "format": "double"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "range_from"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[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 },
}
impl From<&BinRangedouble> for BinRangedouble {
fn from(value: &BinRangedouble) -> Self {
value.clone()
}
}
///A type storing a range over `T`.
///
///This type supports ranges similar to the `RangeTo`, `Range` and
/// `RangeFrom` types in the standard library. Those cover `(..end)`,
/// `(start..end)`, and `(start..)` respectively.
///
/// JSON schema
///
/// ```json
///{
/// "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",
/// "required": [
/// "end",
/// "type"
/// ],
/// "properties": {
/// "end": {
/// "type": "integer",
/// "format": "int64"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "range_to"
/// ]
/// }
/// }
/// },
/// {
/// "description": "A range bounded inclusively below and exclusively
/// above, `start..end`.",
/// "type": "object",
/// "required": [
/// "end",
/// "start",
/// "type"
/// ],
/// "properties": {
/// "end": {
/// "type": "integer",
/// "format": "int64"
/// },
/// "start": {
/// "type": "integer",
/// "format": "int64"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "range"
/// ]
/// }
/// }
/// },
/// {
/// "description": "A range bounded inclusively below and unbounded
/// above, `start..`.",
/// "type": "object",
/// "required": [
/// "start",
/// "type"
/// ],
/// "properties": {
/// "start": {
/// "type": "integer",
/// "format": "int64"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "range_from"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[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 },
}
impl From<&BinRangeint64> for BinRangeint64 {
fn from(value: &BinRangeint64) -> Self {
value.clone()
}
}
///Type storing bin edges and a count of samples within it.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Type storing bin edges and a count of samples within
/// it.",
/// "type": "object",
/// "required": [
/// "count",
/// "range"
/// ],
/// "properties": {
/// "count": {
/// "description": "The total count of samples in this bin.",
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "range": {
/// "description": "The range of the support covered by this bin.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/BinRangedouble"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[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,
}
impl From<&Bindouble> for Bindouble {
fn from(value: &Bindouble) -> Self {
value.clone()
}
}
///Type storing bin edges and a count of samples within it.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Type storing bin edges and a count of samples within
/// it.",
/// "type": "object",
/// "required": [
/// "count",
/// "range"
/// ],
/// "properties": {
/// "count": {
/// "description": "The total count of samples in this bin.",
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "range": {
/// "description": "The range of the support covered by this bin.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/BinRangeint64"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[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,
}
impl From<&Binint64> for Binint64 {
fn from(value: &Binint64) -> Self {
value.clone()
}
}
///BlockSize
///
/// JSON schema
///
/// ```json
///{
/// "title": "disk block size in bytes",
/// "type": "integer",
/// "enum": [
/// 512,
/// 2048,
/// 4096
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Serialize)]
pub struct BlockSize(i64);
impl std::ops::Deref for BlockSize {
type Target = i64;
fn deref(&self) -> &i64 {
&self.0
}
}
impl From for i64 {
fn from(value: BlockSize) -> Self {
value.0
}
}
impl From<&BlockSize> for BlockSize {
fn from(value: &BlockSize) -> Self {
value.clone()
}
}
impl std::convert::TryFrom for BlockSize {
type Error = &'static str;
fn try_from(value: i64) -> Result {
if ![512_i64, 2048_i64, 4096_i64].contains(&value) {
Err("invalid value")
} else {
Ok(Self(value))
}
}
}
impl<'de> serde::Deserialize<'de> for BlockSize {
fn deserialize(deserializer: D) -> Result
where
D: serde::Deserializer<'de>,
{
Self::try_from(::deserialize(deserializer)?)
.map_err(|e| ::custom(e.to_string()))
}
}
///A count of bytes, typically used either for memory or storage capacity
///
///The maximum supported byte count is [`i64::MAX`]. This makes it
/// somewhat inconvenient to define constructors: a u32 constructor can be
/// infallible, but an i64 constructor can fail (if the value is negative)
/// and a u64 constructor can fail (if the value is larger than i64::MAX).
/// We provide all of these for consumers' convenience.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A count of bytes, typically used either for memory or
/// storage capacity\n\nThe maximum supported byte count is [`i64::MAX`].
/// This makes it somewhat inconvenient to define constructors: a u32
/// constructor can be infallible, but an i64 constructor can fail (if the
/// value is negative) and a u64 constructor can fail (if the value is
/// larger than i64::MAX). We provide all of these for consumers'
/// convenience.",
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ByteCount(pub u64);
impl std::ops::Deref for ByteCount {
type Target = u64;
fn deref(&self) -> &u64 {
&self.0
}
}
impl From for u64 {
fn from(value: ByteCount) -> Self {
value.0
}
}
impl From<&ByteCount> for ByteCount {
fn from(value: &ByteCount) -> Self {
value.clone()
}
}
impl From for ByteCount {
fn from(value: u64) -> Self {
Self(value)
}
}
impl std::str::FromStr for ByteCount {
type Err = ::Err;
fn from_str(value: &str) -> Result {
Ok(Self(value.parse()?))
}
}
impl std::convert::TryFrom<&str> for ByteCount {
type Error = ::Err;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for ByteCount {
type Error = ::Err;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for ByteCount {
type Error = ::Err;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl ToString for ByteCount {
fn to_string(&self) -> String {
self.0.to_string()
}
}
///Client view of a [`Certificate`]
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of a [`Certificate`]",
/// "type": "object",
/// "required": [
/// "description",
/// "id",
/// "name",
/// "service",
/// "time_created",
/// "time_modified"
/// ],
/// "properties": {
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "service": {
/// "$ref": "#/components/schemas/ServiceUsingCertificate"
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Certificate {
///human-readable free-form text about a resource
pub description: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
pub service: ServiceUsingCertificate,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
}
impl From<&Certificate> for Certificate {
fn from(value: &Certificate) -> Self {
value.clone()
}
}
///Create-time parameters for a
/// [`Certificate`](crate::external_api::views::Certificate)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for a
/// [`Certificate`](crate::external_api::views::Certificate)",
/// "type": "object",
/// "required": [
/// "cert",
/// "description",
/// "key",
/// "name",
/// "service"
/// ],
/// "properties": {
/// "cert": {
/// "description": "PEM file containing public certificate chain",
/// "type": "array",
/// "items": {
/// "type": "integer",
/// "format": "uint8",
/// "minimum": 0.0
/// }
/// },
/// "description": {
/// "type": "string"
/// },
/// "key": {
/// "description": "PEM file containing private key",
/// "type": "array",
/// "items": {
/// "type": "integer",
/// "format": "uint8",
/// "minimum": 0.0
/// }
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "service": {
/// "description": "The service using this certificate",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ServiceUsingCertificate"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CertificateCreate {
///PEM file containing public certificate chain
pub cert: Vec,
pub description: String,
///PEM file containing private key
pub key: Vec,
pub name: Name,
///The service using this certificate
pub service: ServiceUsingCertificate,
}
impl From<&CertificateCreate> for CertificateCreate {
fn from(value: &CertificateCreate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Certificate"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CertificateResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&CertificateResultsPage> for CertificateResultsPage {
fn from(value: &CertificateResultsPage) -> Self {
value.clone()
}
}
///Identity-related metadata that's included in "asset" public API objects
/// (which generally have no name or description)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Identity-related metadata that's included in \"asset\"
/// public API objects (which generally have no name or description)",
/// "type": "object",
/// "required": [
/// "component_type",
/// "id",
/// "time_created",
/// "time_modified",
/// "version"
/// ],
/// "properties": {
/// "component_type": {
/// "$ref": "#/components/schemas/UpdateableComponentType"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// },
/// "version": {
/// "$ref": "#/components/schemas/SemverVersion"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ComponentUpdate {
pub component_type: UpdateableComponentType,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
pub version: SemverVersion,
}
impl From<&ComponentUpdate> for ComponentUpdate {
fn from(value: &ComponentUpdate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/ComponentUpdate"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ComponentUpdateResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&ComponentUpdateResultsPage> for ComponentUpdateResultsPage {
fn from(value: &ComponentUpdateResultsPage) -> Self {
value.clone()
}
}
///A cumulative or counter data type.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A cumulative or counter data type.",
/// "type": "object",
/// "required": [
/// "start_time",
/// "value"
/// ],
/// "properties": {
/// "start_time": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "value": {
/// "type": "number",
/// "format": "double"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Cumulativedouble {
pub start_time: chrono::DateTime,
pub value: f64,
}
impl From<&Cumulativedouble> for Cumulativedouble {
fn from(value: &Cumulativedouble) -> Self {
value.clone()
}
}
///A cumulative or counter data type.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A cumulative or counter data type.",
/// "type": "object",
/// "required": [
/// "start_time",
/// "value"
/// ],
/// "properties": {
/// "start_time": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "value": {
/// "type": "integer",
/// "format": "int64"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Cumulativeint64 {
pub start_time: chrono::DateTime,
pub value: i64,
}
impl From<&Cumulativeint64> for Cumulativeint64 {
fn from(value: &Cumulativeint64) -> Self {
value.clone()
}
}
///A `Datum` is a single sampled data point from a metric.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A `Datum` is a single sampled data point from a
/// metric.",
/// "oneOf": [
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "type": "boolean"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "bool"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "type": "integer",
/// "format": "int64"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "i64"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "type": "number",
/// "format": "double"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "f64"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "string"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "type": "array",
/// "items": {
/// "type": "integer",
/// "format": "uint8",
/// "minimum": 0.0
/// }
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "bytes"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "$ref": "#/components/schemas/Cumulativeint64"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "cumulative_i64"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "$ref": "#/components/schemas/Cumulativedouble"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "cumulative_f64"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "$ref": "#/components/schemas/Histogramint64"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "histogram_i64"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "datum",
/// "type"
/// ],
/// "properties": {
/// "datum": {
/// "$ref": "#/components/schemas/Histogramdouble"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "histogram_f64"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[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),
#[serde(rename = "cumulative_i64")]
CumulativeI64(Cumulativeint64),
#[serde(rename = "cumulative_f64")]
CumulativeF64(Cumulativedouble),
#[serde(rename = "histogram_i64")]
HistogramI64(Histogramint64),
#[serde(rename = "histogram_f64")]
HistogramF64(Histogramdouble),
}
impl From<&Datum> for Datum {
fn from(value: &Datum) -> Self {
value.clone()
}
}
impl From for Datum {
fn from(value: bool) -> Self {
Self::Bool(value)
}
}
impl From for Datum {
fn from(value: i64) -> Self {
Self::I64(value)
}
}
impl From for Datum {
fn from(value: f64) -> Self {
Self::F64(value)
}
}
impl From> for Datum {
fn from(value: Vec) -> Self {
Self::Bytes(value)
}
}
impl From for Datum {
fn from(value: Cumulativeint64) -> Self {
Self::CumulativeI64(value)
}
}
impl From for Datum {
fn from(value: Cumulativedouble) -> Self {
Self::CumulativeF64(value)
}
}
impl From for Datum {
fn from(value: Histogramint64) -> Self {
Self::HistogramI64(value)
}
}
impl From for Datum {
fn from(value: Histogramdouble) -> Self {
Self::HistogramF64(value)
}
}
///The type of an individual datum of a metric.
///
/// JSON schema
///
/// ```json
///{
/// "description": "The type of an individual datum of a metric.",
/// "type": "string",
/// "enum": [
/// "bool",
/// "i64",
/// "f64",
/// "string",
/// "bytes",
/// "cumulative_i64",
/// "cumulative_f64",
/// "histogram_i64",
/// "histogram_f64"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum DatumType {
#[serde(rename = "bool")]
Bool,
#[serde(rename = "i64")]
I64,
#[serde(rename = "f64")]
F64,
#[serde(rename = "string")]
String,
#[serde(rename = "bytes")]
Bytes,
#[serde(rename = "cumulative_i64")]
CumulativeI64,
#[serde(rename = "cumulative_f64")]
CumulativeF64,
#[serde(rename = "histogram_i64")]
HistogramI64,
#[serde(rename = "histogram_f64")]
HistogramF64,
}
impl From<&DatumType> for DatumType {
fn from(value: &DatumType) -> Self {
value.clone()
}
}
impl ToString for DatumType {
fn to_string(&self) -> String {
match *self {
Self::Bool => "bool".to_string(),
Self::I64 => "i64".to_string(),
Self::F64 => "f64".to_string(),
Self::String => "string".to_string(),
Self::Bytes => "bytes".to_string(),
Self::CumulativeI64 => "cumulative_i64".to_string(),
Self::CumulativeF64 => "cumulative_f64".to_string(),
Self::HistogramI64 => "histogram_i64".to_string(),
Self::HistogramF64 => "histogram_f64".to_string(),
}
}
}
impl std::str::FromStr for DatumType {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"bool" => Ok(Self::Bool),
"i64" => Ok(Self::I64),
"f64" => Ok(Self::F64),
"string" => Ok(Self::String),
"bytes" => Ok(Self::Bytes),
"cumulative_i64" => Ok(Self::CumulativeI64),
"cumulative_f64" => Ok(Self::CumulativeF64),
"histogram_i64" => Ok(Self::HistogramI64),
"histogram_f64" => Ok(Self::HistogramF64),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for DatumType {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for DatumType {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for DatumType {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///DerEncodedKeyPair
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "private_key",
/// "public_cert"
/// ],
/// "properties": {
/// "private_key": {
/// "description": "request signing private key (base64 encoded der
/// file)",
/// "type": "string"
/// },
/// "public_cert": {
/// "description": "request signing public certificate (base64 encoded
/// der file)",
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DerEncodedKeyPair {
///request signing private key (base64 encoded der file)
pub private_key: String,
///request signing public certificate (base64 encoded der file)
pub public_cert: String,
}
impl From<&DerEncodedKeyPair> for DerEncodedKeyPair {
fn from(value: &DerEncodedKeyPair) -> Self {
value.clone()
}
}
///DeviceAccessTokenRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "client_id",
/// "device_code",
/// "grant_type"
/// ],
/// "properties": {
/// "client_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "device_code": {
/// "type": "string"
/// },
/// "grant_type": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DeviceAccessTokenRequest {
pub client_id: uuid::Uuid,
pub device_code: String,
pub grant_type: String,
}
impl From<&DeviceAccessTokenRequest> for DeviceAccessTokenRequest {
fn from(value: &DeviceAccessTokenRequest) -> Self {
value.clone()
}
}
///DeviceAuthRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "client_id"
/// ],
/// "properties": {
/// "client_id": {
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DeviceAuthRequest {
pub client_id: uuid::Uuid,
}
impl From<&DeviceAuthRequest> for DeviceAuthRequest {
fn from(value: &DeviceAuthRequest) -> Self {
value.clone()
}
}
///DeviceAuthVerify
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "user_code"
/// ],
/// "properties": {
/// "user_code": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DeviceAuthVerify {
pub user_code: String,
}
impl From<&DeviceAuthVerify> for DeviceAuthVerify {
fn from(value: &DeviceAuthVerify) -> Self {
value.clone()
}
}
///Digest
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "type": "object",
/// "required": [
/// "type",
/// "value"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "enum": [
/// "sha256"
/// ]
/// },
/// "value": {
/// "type": "string"
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type", content = "value")]
pub enum Digest {
#[serde(rename = "sha256")]
Sha256(String),
}
impl From<&Digest> for Digest {
fn from(value: &Digest) -> Self {
value.clone()
}
}
///Client view of a [`Disk`]
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of a [`Disk`]",
/// "type": "object",
/// "required": [
/// "block_size",
/// "description",
/// "device_path",
/// "id",
/// "name",
/// "project_id",
/// "size",
/// "state",
/// "time_created",
/// "time_modified"
/// ],
/// "properties": {
/// "block_size": {
/// "$ref": "#/components/schemas/ByteCount"
/// },
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "device_path": {
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "image_id": {
/// "type": [
/// "string",
/// "null"
/// ],
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "project_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "size": {
/// "$ref": "#/components/schemas/ByteCount"
/// },
/// "snapshot_id": {
/// "type": [
/// "string",
/// "null"
/// ],
/// "format": "uuid"
/// },
/// "state": {
/// "$ref": "#/components/schemas/DiskState"
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Disk {
pub block_size: ByteCount,
///human-readable free-form text about a resource
pub description: String,
pub device_path: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub image_id: Option,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
pub project_id: uuid::Uuid,
pub size: ByteCount,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub snapshot_id: Option,
pub state: DiskState,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
}
impl From<&Disk> for Disk {
fn from(value: &Disk) -> Self {
value.clone()
}
}
///Create-time parameters for a
/// [`Disk`](omicron_common::api::external::Disk)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for a
/// [`Disk`](omicron_common::api::external::Disk)",
/// "type": "object",
/// "required": [
/// "description",
/// "disk_source",
/// "name",
/// "size"
/// ],
/// "properties": {
/// "description": {
/// "type": "string"
/// },
/// "disk_source": {
/// "description": "initial source for this disk",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/DiskSource"
/// }
/// ]
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "size": {
/// "description": "total size of the Disk in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DiskCreate {
pub description: String,
///initial source for this disk
pub disk_source: DiskSource,
pub name: Name,
///total size of the Disk in bytes
pub size: ByteCount,
}
impl From<&DiskCreate> for DiskCreate {
fn from(value: &DiskCreate) -> Self {
value.clone()
}
}
///TODO-v1: Delete this Parameters for the
/// [`Disk`](omicron_common::api::external::Disk) to be attached or detached
/// to an instance
///
/// JSON schema
///
/// ```json
///{
/// "description": "TODO-v1: Delete this Parameters for the
/// [`Disk`](omicron_common::api::external::Disk) to be attached or detached
/// to an instance",
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DiskIdentifier {
pub name: Name,
}
impl From<&DiskIdentifier> for DiskIdentifier {
fn from(value: &DiskIdentifier) -> Self {
value.clone()
}
}
///DiskMetricName
///
/// JSON schema
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "activated",
/// "flush",
/// "read",
/// "read_bytes",
/// "write",
/// "write_bytes"
/// ]
///}
/// ```
///
#[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 From<&DiskMetricName> for DiskMetricName {
fn from(value: &DiskMetricName) -> Self {
value.clone()
}
}
impl ToString for DiskMetricName {
fn to_string(&self) -> String {
match *self {
Self::Activated => "activated".to_string(),
Self::Flush => "flush".to_string(),
Self::Read => "read".to_string(),
Self::ReadBytes => "read_bytes".to_string(),
Self::Write => "write".to_string(),
Self::WriteBytes => "write_bytes".to_string(),
}
}
}
impl std::str::FromStr for DiskMetricName {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"activated" => Ok(Self::Activated),
"flush" => Ok(Self::Flush),
"read" => Ok(Self::Read),
"read_bytes" => Ok(Self::ReadBytes),
"write" => Ok(Self::Write),
"write_bytes" => Ok(Self::WriteBytes),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for DiskMetricName {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for DiskMetricName {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for DiskMetricName {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///DiskPath
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "disk"
/// ],
/// "properties": {
/// "disk": {
/// "$ref": "#/components/schemas/NameOrId"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DiskPath {
pub disk: NameOrId,
}
impl From<&DiskPath> for DiskPath {
fn from(value: &DiskPath) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Disk"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DiskResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&DiskResultsPage> for DiskResultsPage {
fn from(value: &DiskResultsPage) -> Self {
value.clone()
}
}
///Different sources for a disk
///
/// JSON schema
///
/// ```json
///{
/// "description": "Different sources for a disk",
/// "oneOf": [
/// {
/// "description": "Create a blank disk",
/// "type": "object",
/// "required": [
/// "block_size",
/// "type"
/// ],
/// "properties": {
/// "block_size": {
/// "description": "size of blocks for this Disk. valid values are:
/// 512, 2048, or 4096",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/BlockSize"
/// }
/// ]
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "blank"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Create a disk from a disk snapshot",
/// "type": "object",
/// "required": [
/// "snapshot_id",
/// "type"
/// ],
/// "properties": {
/// "snapshot_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "snapshot"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Create a disk from a project image",
/// "type": "object",
/// "required": [
/// "image_id",
/// "type"
/// ],
/// "properties": {
/// "image_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "image"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Create a disk from a global image",
/// "type": "object",
/// "required": [
/// "image_id",
/// "type"
/// ],
/// "properties": {
/// "image_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "global_image"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum DiskSource {
///Create a blank disk
#[serde(rename = "blank")]
Blank {
///size of blocks for this Disk. valid values are: 512, 2048, or
/// 4096
block_size: BlockSize,
},
///Create a disk from a disk snapshot
#[serde(rename = "snapshot")]
Snapshot { snapshot_id: uuid::Uuid },
///Create a disk from a project image
#[serde(rename = "image")]
Image { image_id: uuid::Uuid },
///Create a disk from a global image
#[serde(rename = "global_image")]
GlobalImage { image_id: uuid::Uuid },
}
impl From<&DiskSource> for DiskSource {
fn from(value: &DiskSource) -> Self {
value.clone()
}
}
///State of a Disk (primarily: attached or not)
///
/// JSON schema
///
/// ```json
///{
/// "description": "State of a Disk (primarily: attached or not)",
/// "oneOf": [
/// {
/// "description": "Disk is being initialized",
/// "type": "object",
/// "required": [
/// "state"
/// ],
/// "properties": {
/// "state": {
/// "type": "string",
/// "enum": [
/// "creating"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Disk is ready but detached from any Instance",
/// "type": "object",
/// "required": [
/// "state"
/// ],
/// "properties": {
/// "state": {
/// "type": "string",
/// "enum": [
/// "detached"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Disk is being attached to the given Instance",
/// "type": "object",
/// "required": [
/// "instance",
/// "state"
/// ],
/// "properties": {
/// "instance": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "state": {
/// "type": "string",
/// "enum": [
/// "attaching"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Disk is attached to the given Instance",
/// "type": "object",
/// "required": [
/// "instance",
/// "state"
/// ],
/// "properties": {
/// "instance": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "state": {
/// "type": "string",
/// "enum": [
/// "attached"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Disk is being detached from the given Instance",
/// "type": "object",
/// "required": [
/// "instance",
/// "state"
/// ],
/// "properties": {
/// "instance": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "state": {
/// "type": "string",
/// "enum": [
/// "detaching"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Disk has been destroyed",
/// "type": "object",
/// "required": [
/// "state"
/// ],
/// "properties": {
/// "state": {
/// "type": "string",
/// "enum": [
/// "destroyed"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Disk is unavailable",
/// "type": "object",
/// "required": [
/// "state"
/// ],
/// "properties": {
/// "state": {
/// "type": "string",
/// "enum": [
/// "faulted"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "state", content = "instance")]
pub enum DiskState {
#[serde(rename = "creating")]
Creating,
#[serde(rename = "detached")]
Detached,
///Disk is being attached to the given Instance
#[serde(rename = "attaching")]
Attaching(uuid::Uuid),
///Disk is attached to the given Instance
#[serde(rename = "attached")]
Attached(uuid::Uuid),
///Disk is being detached from the given Instance
#[serde(rename = "detaching")]
Detaching(uuid::Uuid),
#[serde(rename = "destroyed")]
Destroyed,
#[serde(rename = "faulted")]
Faulted,
}
impl From<&DiskState> for DiskState {
fn from(value: &DiskState) -> Self {
value.clone()
}
}
///OS image distribution
///
/// JSON schema
///
/// ```json
///{
/// "description": "OS image distribution",
/// "type": "object",
/// "required": [
/// "name",
/// "version"
/// ],
/// "properties": {
/// "name": {
/// "description": "The name of the distribution (e.g. \"alpine\" or
/// \"ubuntu\")",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "version": {
/// "description": "The version of the distribution (e.g. \"3.10\" or
/// \"18.04\")",
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Distribution {
///The name of the distribution (e.g. "alpine" or "ubuntu")
pub name: Name,
///The version of the distribution (e.g. "3.10" or "18.04")
pub version: String,
}
impl From<&Distribution> for Distribution {
fn from(value: &Distribution) -> Self {
value.clone()
}
}
///Error information from a response.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Error information from a response.",
/// "type": "object",
/// "required": [
/// "message",
/// "request_id"
/// ],
/// "properties": {
/// "error_code": {
/// "type": "string"
/// },
/// "message": {
/// "type": "string"
/// },
/// "request_id": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Error {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error_code: Option,
pub message: String,
pub request_id: String,
}
impl From<&Error> for Error {
fn from(value: &Error) -> Self {
value.clone()
}
}
///ExternalIp
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "ip",
/// "kind"
/// ],
/// "properties": {
/// "ip": {
/// "type": "string",
/// "format": "ip"
/// },
/// "kind": {
/// "$ref": "#/components/schemas/IpKind"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ExternalIp {
pub ip: std::net::IpAddr,
pub kind: IpKind,
}
impl From<&ExternalIp> for ExternalIp {
fn from(value: &ExternalIp) -> Self {
value.clone()
}
}
///Parameters for creating an external IP address for instances.
///
/// JSON schema
///
/// ```json
///{
/// "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",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "pool_name": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "ephemeral"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[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,
},
}
impl From<&ExternalIpCreate> for ExternalIpCreate {
fn from(value: &ExternalIpCreate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/ExternalIp"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ExternalIpResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&ExternalIpResultsPage> for ExternalIpResultsPage {
fn from(value: &ExternalIpResultsPage) -> Self {
value.clone()
}
}
///The name and type information for a field of a timeseries schema.
///
/// JSON schema
///
/// ```json
///{
/// "description": "The name and type information for a field of a
/// timeseries schema.",
/// "type": "object",
/// "required": [
/// "name",
/// "source",
/// "ty"
/// ],
/// "properties": {
/// "name": {
/// "type": "string"
/// },
/// "source": {
/// "$ref": "#/components/schemas/FieldSource"
/// },
/// "ty": {
/// "$ref": "#/components/schemas/FieldType"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FieldSchema {
pub name: String,
pub source: FieldSource,
pub ty: FieldType,
}
impl From<&FieldSchema> for FieldSchema {
fn from(value: &FieldSchema) -> Self {
value.clone()
}
}
///The source from which a field is derived, the target or metric.
///
/// JSON schema
///
/// ```json
///{
/// "description": "The source from which a field is derived, the target or
/// metric.",
/// "type": "string",
/// "enum": [
/// "target",
/// "metric"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum FieldSource {
#[serde(rename = "target")]
Target,
#[serde(rename = "metric")]
Metric,
}
impl From<&FieldSource> for FieldSource {
fn from(value: &FieldSource) -> Self {
value.clone()
}
}
impl ToString for FieldSource {
fn to_string(&self) -> String {
match *self {
Self::Target => "target".to_string(),
Self::Metric => "metric".to_string(),
}
}
}
impl std::str::FromStr for FieldSource {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"target" => Ok(Self::Target),
"metric" => Ok(Self::Metric),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for FieldSource {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for FieldSource {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for FieldSource {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///The `FieldType` identifies the data type of a target or metric field.
///
/// JSON schema
///
/// ```json
///{
/// "description": "The `FieldType` identifies the data type of a target or
/// metric field.",
/// "type": "string",
/// "enum": [
/// "string",
/// "i64",
/// "ip_addr",
/// "uuid",
/// "bool"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum FieldType {
#[serde(rename = "string")]
String,
#[serde(rename = "i64")]
I64,
#[serde(rename = "ip_addr")]
IpAddr,
#[serde(rename = "uuid")]
Uuid,
#[serde(rename = "bool")]
Bool,
}
impl From<&FieldType> for FieldType {
fn from(value: &FieldType) -> Self {
value.clone()
}
}
impl ToString for FieldType {
fn to_string(&self) -> String {
match *self {
Self::String => "string".to_string(),
Self::I64 => "i64".to_string(),
Self::IpAddr => "ip_addr".to_string(),
Self::Uuid => "uuid".to_string(),
Self::Bool => "bool".to_string(),
}
}
}
impl std::str::FromStr for FieldType {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"string" => Ok(Self::String),
"i64" => Ok(Self::I64),
"ip_addr" => Ok(Self::IpAddr),
"uuid" => Ok(Self::Uuid),
"bool" => Ok(Self::Bool),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for FieldType {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for FieldType {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for FieldType {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///FleetRole
///
/// JSON schema
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "admin",
/// "collaborator",
/// "viewer"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum FleetRole {
#[serde(rename = "admin")]
Admin,
#[serde(rename = "collaborator")]
Collaborator,
#[serde(rename = "viewer")]
Viewer,
}
impl From<&FleetRole> for FleetRole {
fn from(value: &FleetRole) -> Self {
value.clone()
}
}
impl ToString for FleetRole {
fn to_string(&self) -> String {
match *self {
Self::Admin => "admin".to_string(),
Self::Collaborator => "collaborator".to_string(),
Self::Viewer => "viewer".to_string(),
}
}
}
impl std::str::FromStr for FleetRole {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"admin" => Ok(Self::Admin),
"collaborator" => Ok(Self::Collaborator),
"viewer" => Ok(Self::Viewer),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for FleetRole {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for FleetRole {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for FleetRole {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///Client view of a [`Policy`], which describes how this resource may be
/// accessed
///
///Note that the Policy only describes access granted explicitly for this
/// resource. The policies of parent resources can also cause a user to
/// have access to this resource.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of a [`Policy`], which describes how this
/// resource may be accessed\n\nNote that the Policy only describes access
/// granted explicitly for this resource. The policies of parent resources
/// can also cause a user to have access to this resource.",
/// "type": "object",
/// "required": [
/// "role_assignments"
/// ],
/// "properties": {
/// "role_assignments": {
/// "description": "Roles directly assigned on this resource",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/FleetRoleRoleAssignment"
/// }
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FleetRolePolicy {
///Roles directly assigned on this resource
pub role_assignments: Vec,
}
impl From<&FleetRolePolicy> for FleetRolePolicy {
fn from(value: &FleetRolePolicy) -> Self {
value.clone()
}
}
///Describes the assignment of a particular role on a particular resource
/// to a particular identity (user, group, etc.)
///
///The resource is not part of this structure. Rather, [`RoleAssignment`]s
/// are put into a [`Policy`] and that Policy is applied to a particular
/// resource.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Describes the assignment of a particular role on a
/// particular resource to a particular identity (user, group, etc.)\n\nThe
/// resource is not part of this structure. Rather, [`RoleAssignment`]s are
/// put into a [`Policy`] and that Policy is applied to a particular
/// resource.",
/// "type": "object",
/// "required": [
/// "identity_id",
/// "identity_type",
/// "role_name"
/// ],
/// "properties": {
/// "identity_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "identity_type": {
/// "$ref": "#/components/schemas/IdentityType"
/// },
/// "role_name": {
/// "$ref": "#/components/schemas/FleetRole"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FleetRoleRoleAssignment {
pub identity_id: uuid::Uuid,
pub identity_type: IdentityType,
pub role_name: FleetRole,
}
impl From<&FleetRoleRoleAssignment> for FleetRoleRoleAssignment {
fn from(value: &FleetRoleRoleAssignment) -> Self {
value.clone()
}
}
///Client view of global Images
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of global Images",
/// "type": "object",
/// "required": [
/// "block_size",
/// "description",
/// "distribution",
/// "id",
/// "name",
/// "size",
/// "time_created",
/// "time_modified",
/// "version"
/// ],
/// "properties": {
/// "block_size": {
/// "description": "size of blocks in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// },
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "digest": {
/// "description": "Hash of the image contents, if applicable",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Digest"
/// }
/// ]
/// },
/// "distribution": {
/// "description": "Image distribution",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "size": {
/// "description": "total size in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// },
/// "url": {
/// "description": "URL source of this image, if any",
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "version": {
/// "description": "Image version",
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GlobalImage {
///size of blocks in bytes
pub block_size: ByteCount,
///human-readable free-form text about a resource
pub description: String,
///Hash of the image contents, if applicable
#[serde(default, skip_serializing_if = "Option::is_none")]
pub digest: Option,
///Image distribution
pub distribution: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///total size in bytes
pub size: ByteCount,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
///URL source of this image, if any
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option,
///Image version
pub version: String,
}
impl From<&GlobalImage> for GlobalImage {
fn from(value: &GlobalImage) -> Self {
value.clone()
}
}
///Create-time parameters for an
/// [`GlobalImage`](crate::external_api::views::GlobalImage)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for an
/// [`GlobalImage`](crate::external_api::views::GlobalImage)",
/// "type": "object",
/// "required": [
/// "block_size",
/// "description",
/// "distribution",
/// "name",
/// "source"
/// ],
/// "properties": {
/// "block_size": {
/// "description": "block size in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/BlockSize"
/// }
/// ]
/// },
/// "description": {
/// "type": "string"
/// },
/// "distribution": {
/// "description": "OS image distribution",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Distribution"
/// }
/// ]
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "source": {
/// "description": "The source of the image's contents.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ImageSource"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GlobalImageCreate {
///block size in bytes
pub block_size: BlockSize,
pub description: String,
///OS image distribution
pub distribution: Distribution,
pub name: Name,
///The source of the image's contents.
pub source: ImageSource,
}
impl From<&GlobalImageCreate> for GlobalImageCreate {
fn from(value: &GlobalImageCreate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/GlobalImage"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GlobalImageResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&GlobalImageResultsPage> for GlobalImageResultsPage {
fn from(value: &GlobalImageResultsPage) -> Self {
value.clone()
}
}
///Client view of a [`Group`]
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of a [`Group`]",
/// "type": "object",
/// "required": [
/// "display_name",
/// "id",
/// "silo_id"
/// ],
/// "properties": {
/// "display_name": {
/// "description": "Human-readable name that can identify the group",
/// "type": "string"
/// },
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "silo_id": {
/// "description": "Uuid of the silo to which this group belongs",
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Group {
///Human-readable name that can identify the group
pub display_name: String,
pub id: uuid::Uuid,
///Uuid of the silo to which this group belongs
pub silo_id: uuid::Uuid,
}
impl From<&Group> for Group {
fn from(value: &Group) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Group"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GroupResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&GroupResultsPage> for GroupResultsPage {
fn from(value: &GroupResultsPage) -> Self {
value.clone()
}
}
///A simple type for managing a histogram metric.
///
///A histogram maintains the count of any number of samples, over a set of
/// bins. Bins are specified on construction via their _left_ edges,
/// inclusive. There can't be any "gaps" in the bins, and an additional bin
/// may be added to the left, right, or both so that the bins extend to the
/// entire range of the support.
///
///Note that any gaps, unsorted bins, or non-finite values will result in
/// an error.
///
///Example ------- ```rust use oximeter::histogram::{BinRange, Histogram};
///
///let edges = [0i64, 10, 20]; let mut hist =
/// Histogram::new(&edges).unwrap(); assert_eq!(hist.n_bins(), 4); // One
/// additional bin for the range (20..) assert_eq!(hist.n_samples(), 0);
/// hist.sample(4); hist.sample(100); assert_eq!(hist.n_samples(), 2);
///
///let data = hist.iter().collect::>(); assert_eq!(data[0].range,
/// BinRange::range(i64::MIN, 0)); // An additional bin for `..0`
/// assert_eq!(data[0].count, 0); // Nothing is in this bin
///
///assert_eq!(data[1].range, BinRange::range(0, 10)); // The range `0..10`
/// assert_eq!(data[1].count, 1); // 4 is sampled into this bin ```
///
///Notes -----
///
///Histograms may be constructed either from their left bin edges, or from
/// a sequence of ranges. In either case, the left-most bin may be converted
/// upon construction. In particular, if the left-most value is not equal to
/// the minimum of the support, a new bin will be added from the minimum to
/// that provided value. If the left-most value _is_ the support's minimum,
/// because the provided bin was unbounded below, such as `(..0)`, then that
/// bin will be converted into one bounded below, `(MIN..0)` in this case.
///
///The short of this is that, most of the time, it shouldn't matter. If one
/// specifies the extremes of the support as their bins, be aware that the
/// left-most may be converted from a `BinRange::RangeTo` into a
/// `BinRange::Range`. In other words, the first bin of a histogram is
/// _always_ a `Bin::Range` or a `Bin::RangeFrom` after construction. In
/// fact, every bin is one of those variants, the `BinRange::RangeTo` is
/// only provided as a convenience during construction.
///
/// JSON schema
///
/// ```json
///{
/// "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::>(); 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",
/// "required": [
/// "bins",
/// "n_samples",
/// "start_time"
/// ],
/// "properties": {
/// "bins": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Bindouble"
/// }
/// },
/// "n_samples": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "start_time": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Histogramdouble {
pub bins: Vec,
pub n_samples: u64,
pub start_time: chrono::DateTime,
}
impl From<&Histogramdouble> for Histogramdouble {
fn from(value: &Histogramdouble) -> Self {
value.clone()
}
}
///A simple type for managing a histogram metric.
///
///A histogram maintains the count of any number of samples, over a set of
/// bins. Bins are specified on construction via their _left_ edges,
/// inclusive. There can't be any "gaps" in the bins, and an additional bin
/// may be added to the left, right, or both so that the bins extend to the
/// entire range of the support.
///
///Note that any gaps, unsorted bins, or non-finite values will result in
/// an error.
///
///Example ------- ```rust use oximeter::histogram::{BinRange, Histogram};
///
///let edges = [0i64, 10, 20]; let mut hist =
/// Histogram::new(&edges).unwrap(); assert_eq!(hist.n_bins(), 4); // One
/// additional bin for the range (20..) assert_eq!(hist.n_samples(), 0);
/// hist.sample(4); hist.sample(100); assert_eq!(hist.n_samples(), 2);
///
///let data = hist.iter().collect::>(); assert_eq!(data[0].range,
/// BinRange::range(i64::MIN, 0)); // An additional bin for `..0`
/// assert_eq!(data[0].count, 0); // Nothing is in this bin
///
///assert_eq!(data[1].range, BinRange::range(0, 10)); // The range `0..10`
/// assert_eq!(data[1].count, 1); // 4 is sampled into this bin ```
///
///Notes -----
///
///Histograms may be constructed either from their left bin edges, or from
/// a sequence of ranges. In either case, the left-most bin may be converted
/// upon construction. In particular, if the left-most value is not equal to
/// the minimum of the support, a new bin will be added from the minimum to
/// that provided value. If the left-most value _is_ the support's minimum,
/// because the provided bin was unbounded below, such as `(..0)`, then that
/// bin will be converted into one bounded below, `(MIN..0)` in this case.
///
///The short of this is that, most of the time, it shouldn't matter. If one
/// specifies the extremes of the support as their bins, be aware that the
/// left-most may be converted from a `BinRange::RangeTo` into a
/// `BinRange::Range`. In other words, the first bin of a histogram is
/// _always_ a `Bin::Range` or a `Bin::RangeFrom` after construction. In
/// fact, every bin is one of those variants, the `BinRange::RangeTo` is
/// only provided as a convenience during construction.
///
/// JSON schema
///
/// ```json
///{
/// "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::>(); 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",
/// "required": [
/// "bins",
/// "n_samples",
/// "start_time"
/// ],
/// "properties": {
/// "bins": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Binint64"
/// }
/// },
/// "n_samples": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "start_time": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Histogramint64 {
pub bins: Vec,
pub n_samples: u64,
pub start_time: chrono::DateTime,
}
impl From<&Histogramint64> for Histogramint64 {
fn from(value: &Histogramint64) -> Self {
value.clone()
}
}
///Supported set of sort modes for scanning by id only.
///
///Currently, we only support scanning in ascending order.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Supported set of sort modes for scanning by id
/// only.\n\nCurrently, we only support scanning in ascending order.",
/// "oneOf": [
/// {
/// "description": "sort in increasing order of \"id\"",
/// "type": "string",
/// "enum": [
/// "id_ascending"
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum IdSortMode {
///sort in increasing order of "id"
#[serde(rename = "id_ascending")]
IdAscending,
}
impl From<&IdSortMode> for IdSortMode {
fn from(value: &IdSortMode) -> Self {
value.clone()
}
}
impl ToString for IdSortMode {
fn to_string(&self) -> String {
match *self {
Self::IdAscending => "id_ascending".to_string(),
}
}
}
impl std::str::FromStr for IdSortMode {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"id_ascending" => Ok(Self::IdAscending),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for IdSortMode {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for IdSortMode {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for IdSortMode {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///Client view of an [`IdentityProvider`]
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of an [`IdentityProvider`]",
/// "type": "object",
/// "required": [
/// "description",
/// "id",
/// "name",
/// "provider_type",
/// "time_created",
/// "time_modified"
/// ],
/// "properties": {
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "provider_type": {
/// "description": "Identity provider type",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/IdentityProviderType"
/// }
/// ]
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IdentityProvider {
///human-readable free-form text about a resource
pub description: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///Identity provider type
pub provider_type: IdentityProviderType,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
}
impl From<&IdentityProvider> for IdentityProvider {
fn from(value: &IdentityProvider) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/IdentityProvider"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IdentityProviderResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&IdentityProviderResultsPage> for IdentityProviderResultsPage {
fn from(value: &IdentityProviderResultsPage) -> Self {
value.clone()
}
}
///IdentityProviderType
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "description": "SAML identity provider",
/// "type": "string",
/// "enum": [
/// "saml"
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum IdentityProviderType {
///SAML identity provider
#[serde(rename = "saml")]
Saml,
}
impl From<&IdentityProviderType> for IdentityProviderType {
fn from(value: &IdentityProviderType) -> Self {
value.clone()
}
}
impl ToString for IdentityProviderType {
fn to_string(&self) -> String {
match *self {
Self::Saml => "saml".to_string(),
}
}
}
impl std::str::FromStr for IdentityProviderType {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"saml" => Ok(Self::Saml),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for IdentityProviderType {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for IdentityProviderType {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for IdentityProviderType {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///Describes what kind of identity is described by an id
///
/// JSON schema
///
/// ```json
///{
/// "description": "Describes what kind of identity is described by an id",
/// "type": "string",
/// "enum": [
/// "silo_user",
/// "silo_group"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum IdentityType {
#[serde(rename = "silo_user")]
SiloUser,
#[serde(rename = "silo_group")]
SiloGroup,
}
impl From<&IdentityType> for IdentityType {
fn from(value: &IdentityType) -> Self {
value.clone()
}
}
impl ToString for IdentityType {
fn to_string(&self) -> String {
match *self {
Self::SiloUser => "silo_user".to_string(),
Self::SiloGroup => "silo_group".to_string(),
}
}
}
impl std::str::FromStr for IdentityType {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"silo_user" => Ok(Self::SiloUser),
"silo_group" => Ok(Self::SiloGroup),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for IdentityType {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for IdentityType {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for IdentityType {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///IdpMetadataSource
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "type": "object",
/// "required": [
/// "type",
/// "url"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "enum": [
/// "url"
/// ]
/// },
/// "url": {
/// "type": "string"
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "data",
/// "type"
/// ],
/// "properties": {
/// "data": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "base64_encoded_xml"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum IdpMetadataSource {
#[serde(rename = "url")]
Url { url: String },
#[serde(rename = "base64_encoded_xml")]
Base64EncodedXml { data: String },
}
impl From<&IdpMetadataSource> for IdpMetadataSource {
fn from(value: &IdpMetadataSource) -> Self {
value.clone()
}
}
///Client view of project Images
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of project Images",
/// "type": "object",
/// "required": [
/// "block_size",
/// "description",
/// "id",
/// "name",
/// "project_id",
/// "size",
/// "time_created",
/// "time_modified"
/// ],
/// "properties": {
/// "block_size": {
/// "description": "size of blocks in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// },
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "digest": {
/// "description": "Hash of the image contents, if applicable",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Digest"
/// }
/// ]
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "project_id": {
/// "description": "The project the disk belongs to",
/// "type": "string",
/// "format": "uuid"
/// },
/// "size": {
/// "description": "total size in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// },
/// "url": {
/// "description": "URL source of this image, if any",
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "version": {
/// "description": "Version of this, if any",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Image {
///size of blocks in bytes
pub block_size: ByteCount,
///human-readable free-form text about a resource
pub description: String,
///Hash of the image contents, if applicable
#[serde(default, skip_serializing_if = "Option::is_none")]
pub digest: Option,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///The project the disk belongs to
pub project_id: uuid::Uuid,
///total size in bytes
pub size: ByteCount,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
///URL source of this image, if any
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option,
///Version of this, if any
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option,
}
impl From<&Image> for Image {
fn from(value: &Image) -> Self {
value.clone()
}
}
///Create-time parameters for an
/// [`Image`](crate::external_api::views::Image)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for an
/// [`Image`](crate::external_api::views::Image)",
/// "type": "object",
/// "required": [
/// "block_size",
/// "description",
/// "name",
/// "source"
/// ],
/// "properties": {
/// "block_size": {
/// "description": "block size in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/BlockSize"
/// }
/// ]
/// },
/// "description": {
/// "type": "string"
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "source": {
/// "description": "The source of the image's contents.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ImageSource"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ImageCreate {
///block size in bytes
pub block_size: BlockSize,
pub description: String,
pub name: Name,
///The source of the image's contents.
pub source: ImageSource,
}
impl From<&ImageCreate> for ImageCreate {
fn from(value: &ImageCreate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Image"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ImageResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&ImageResultsPage> for ImageResultsPage {
fn from(value: &ImageResultsPage) -> Self {
value.clone()
}
}
///The source of the underlying image.
///
/// JSON schema
///
/// ```json
///{
/// "description": "The source of the underlying image.",
/// "oneOf": [
/// {
/// "type": "object",
/// "required": [
/// "type",
/// "url"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "enum": [
/// "url"
/// ]
/// },
/// "url": {
/// "type": "string"
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "id",
/// "type"
/// ],
/// "properties": {
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "snapshot"
/// ]
/// }
/// }
/// },
/// {
/// "description": "Boot the Alpine ISO that ships with the Propolis
/// zone. Intended for development purposes only.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "enum": [
/// "you_can_boot_anything_as_long_as_its_alpine"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum ImageSource {
#[serde(rename = "url")]
Url { url: String },
#[serde(rename = "snapshot")]
Snapshot { id: uuid::Uuid },
#[serde(rename = "you_can_boot_anything_as_long_as_its_alpine")]
YouCanBootAnythingAsLongAsItsAlpine,
}
impl From<&ImageSource> for ImageSource {
fn from(value: &ImageSource) -> Self {
value.clone()
}
}
///Client view of an [`Instance`]
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of an [`Instance`]",
/// "type": "object",
/// "required": [
/// "description",
/// "hostname",
/// "id",
/// "memory",
/// "name",
/// "ncpus",
/// "project_id",
/// "run_state",
/// "time_created",
/// "time_modified",
/// "time_run_state_updated"
/// ],
/// "properties": {
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "hostname": {
/// "description": "RFC1035-compliant hostname for the Instance.",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "memory": {
/// "description": "memory allocated for this Instance",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "ncpus": {
/// "description": "number of CPUs allocated for this Instance",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/InstanceCpuCount"
/// }
/// ]
/// },
/// "project_id": {
/// "description": "id for the project containing this Instance",
/// "type": "string",
/// "format": "uuid"
/// },
/// "run_state": {
/// "$ref": "#/components/schemas/InstanceState"
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_run_state_updated": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Instance {
///human-readable free-form text about a resource
pub description: String,
///RFC1035-compliant hostname for the Instance.
pub hostname: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///memory allocated for this Instance
pub memory: ByteCount,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///number of CPUs allocated for this Instance
pub ncpus: InstanceCpuCount,
///id for the project containing this Instance
pub project_id: uuid::Uuid,
pub run_state: InstanceState,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
pub time_run_state_updated: chrono::DateTime,
}
impl From<&Instance> for Instance {
fn from(value: &Instance) -> Self {
value.clone()
}
}
///The number of CPUs in an Instance
///
/// JSON schema
///
/// ```json
///{
/// "description": "The number of CPUs in an Instance",
/// "type": "integer",
/// "format": "uint16",
/// "minimum": 0.0
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceCpuCount(pub u16);
impl std::ops::Deref for InstanceCpuCount {
type Target = u16;
fn deref(&self) -> &u16 {
&self.0
}
}
impl From for u16 {
fn from(value: InstanceCpuCount) -> Self {
value.0
}
}
impl From<&InstanceCpuCount> for InstanceCpuCount {
fn from(value: &InstanceCpuCount) -> Self {
value.clone()
}
}
impl From for InstanceCpuCount {
fn from(value: u16) -> Self {
Self(value)
}
}
impl std::str::FromStr for InstanceCpuCount {
type Err = ::Err;
fn from_str(value: &str) -> Result {
Ok(Self(value.parse()?))
}
}
impl std::convert::TryFrom<&str> for InstanceCpuCount {
type Error = ::Err;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceCpuCount {
type Error = ::Err;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for InstanceCpuCount {
type Error = ::Err;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl ToString for InstanceCpuCount {
fn to_string(&self) -> String {
self.0.to_string()
}
}
///Create-time parameters for an
/// [`Instance`](omicron_common::api::external::Instance)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for an
/// [`Instance`](omicron_common::api::external::Instance)",
/// "type": "object",
/// "required": [
/// "description",
/// "hostname",
/// "memory",
/// "name",
/// "ncpus"
/// ],
/// "properties": {
/// "description": {
/// "type": "string"
/// },
/// "disks": {
/// "description": "The disks to be created or attached for this
/// instance.",
/// "default": [],
/// "type": "array",
/// "items": {
/// "$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": {
/// "type": "string"
/// },
/// "memory": {
/// "$ref": "#/components/schemas/ByteCount"
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "ncpus": {
/// "$ref": "#/components/schemas/InstanceCpuCount"
/// },
/// "network_interfaces": {
/// "description": "The network interfaces to be created for this
/// instance.",
/// "default": {
/// "type": "default"
/// },
/// "allOf": [
/// {
/// "$ref":
/// "#/components/schemas/InstanceNetworkInterfaceAttachment"
/// }
/// ]
/// },
/// "start": {
/// "description": "Should this instance be started upon creation; true
/// by default.",
/// "default": true,
/// "type": "boolean"
/// },
/// "user_data": {
/// "description": "User data for instance initialization systems (such
/// as cloud-init). Must be a Base64-encoded string, as specified in RFC
/// 4648 § 4 (+ and / characters with padding). Maximum 32 KiB unencoded
/// data.",
/// "default": "",
/// "type": "string",
/// "format": "byte"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceCreate {
pub description: String,
///The disks to be created or attached for this instance.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub disks: Vec,
///The external IP addresses provided to this instance.
///
///By default, all instances have outbound connectivity, but no inbound
/// connectivity. These external addresses can be used to provide a
/// fixed, known IP address for making inbound connections to the
/// instance.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub external_ips: Vec,
pub hostname: String,
pub memory: ByteCount,
pub name: Name,
pub ncpus: InstanceCpuCount,
///The network interfaces to be created for this instance.
#[serde(default = "defaults::instance_create_network_interfaces")]
pub network_interfaces: InstanceNetworkInterfaceAttachment,
///Should this instance be started upon creation; true by default.
#[serde(default = "defaults::default_bool::")]
pub start: bool,
///User data for instance initialization systems (such as cloud-init).
/// Must be a Base64-encoded string, as specified in RFC 4648 § 4 (+ and
/// / characters with padding). Maximum 32 KiB unencoded data.
#[serde(default)]
pub user_data: String,
}
impl From<&InstanceCreate> for InstanceCreate {
fn from(value: &InstanceCreate) -> Self {
value.clone()
}
}
///Describe the instance's disks at creation time
///
/// JSON schema
///
/// ```json
///{
/// "description": "Describe the instance's disks at creation time",
/// "oneOf": [
/// {
/// "description": "During instance creation, create and attach disks",
/// "type": "object",
/// "required": [
/// "description",
/// "disk_source",
/// "name",
/// "size",
/// "type"
/// ],
/// "properties": {
/// "description": {
/// "type": "string"
/// },
/// "disk_source": {
/// "description": "initial source for this disk",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/DiskSource"
/// }
/// ]
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "size": {
/// "description": "total size of the Disk in bytes",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/ByteCount"
/// }
/// ]
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "create"
/// ]
/// }
/// }
/// },
/// {
/// "description": "During instance creation, attach this disk",
/// "type": "object",
/// "required": [
/// "name",
/// "type"
/// ],
/// "properties": {
/// "name": {
/// "description": "A disk name to attach",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "attach"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum InstanceDiskAttachment {
///During instance creation, create and attach disks
#[serde(rename = "create")]
Create {
description: String,
///initial source for this disk
disk_source: DiskSource,
name: Name,
///total size of the Disk in bytes
size: ByteCount,
},
///During instance creation, attach this disk
#[serde(rename = "attach")]
Attach {
///A disk name to attach
name: Name,
},
}
impl From<&InstanceDiskAttachment> for InstanceDiskAttachment {
fn from(value: &InstanceDiskAttachment) -> Self {
value.clone()
}
}
///Migration parameters for an
/// [`Instance`](omicron_common::api::external::Instance)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Migration parameters for an
/// [`Instance`](omicron_common::api::external::Instance)",
/// "type": "object",
/// "required": [
/// "dst_sled_id"
/// ],
/// "properties": {
/// "dst_sled_id": {
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceMigrate {
pub dst_sled_id: uuid::Uuid,
}
impl From<&InstanceMigrate> for InstanceMigrate {
fn from(value: &InstanceMigrate) -> Self {
value.clone()
}
}
///Describes an attachment of a `NetworkInterface` to an `Instance`, at the
/// time the instance is created.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Describes an attachment of a `NetworkInterface` to an
/// `Instance`, at the time the instance is created.",
/// "oneOf": [
/// {
/// "description": "Create one or more `NetworkInterface`s for the
/// `Instance`.\n\nIf more than one interface is provided, then the first
/// will be designated the primary interface for the instance.",
/// "type": "object",
/// "required": [
/// "params",
/// "type"
/// ],
/// "properties": {
/// "params": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/NetworkInterfaceCreate"
/// }
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "create"
/// ]
/// }
/// }
/// },
/// {
/// "description": "The default networking configuration for an
/// instance is to create a single primary interface with an
/// automatically-assigned IP address. The IP will be pulled from the
/// Project's default VPC / VPC Subnet.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "enum": [
/// "default"
/// ]
/// }
/// }
/// },
/// {
/// "description": "No network interfaces at all will be created for
/// the instance.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "enum": [
/// "none"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type", content = "params")]
pub enum InstanceNetworkInterfaceAttachment {
///Create one or more `NetworkInterface`s for the `Instance`.
///
///If more than one interface is provided, then the first will be
/// designated the primary interface for the instance.
#[serde(rename = "create")]
Create(Vec),
#[serde(rename = "default")]
Default,
#[serde(rename = "none")]
None,
}
impl From<&InstanceNetworkInterfaceAttachment> for InstanceNetworkInterfaceAttachment {
fn from(value: &InstanceNetworkInterfaceAttachment) -> Self {
value.clone()
}
}
impl From> for InstanceNetworkInterfaceAttachment {
fn from(value: Vec) -> Self {
Self::Create(value)
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Instance"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&InstanceResultsPage> for InstanceResultsPage {
fn from(value: &InstanceResultsPage) -> Self {
value.clone()
}
}
///Contents of an Instance's serial console buffer.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Contents of an Instance's serial console buffer.",
/// "type": "object",
/// "required": [
/// "data",
/// "last_byte_offset"
/// ],
/// "properties": {
/// "data": {
/// "description": "The bytes starting from the requested offset up to
/// either the end of the buffer or the request's `max_bytes`. Provided as a
/// u8 array rather than a string, as it may not be UTF-8.",
/// "type": "array",
/// "items": {
/// "type": "integer",
/// "format": "uint8",
/// "minimum": 0.0
/// }
/// },
/// "last_byte_offset": {
/// "description": "The absolute offset since boot (suitable for use as
/// `byte_offset` in a subsequent request) of the last byte returned in
/// `data`.",
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceSerialConsoleData {
///The bytes starting from the requested offset up to either the end of
/// the buffer or the request's `max_bytes`. Provided as a u8 array
/// rather than a string, as it may not be UTF-8.
pub data: Vec,
///The absolute offset since boot (suitable for use as `byte_offset` in
/// a subsequent request) of the last byte returned in `data`.
pub last_byte_offset: u64,
}
impl From<&InstanceSerialConsoleData> for InstanceSerialConsoleData {
fn from(value: &InstanceSerialConsoleData) -> Self {
value.clone()
}
}
///Running state of an Instance (primarily: booted or stopped)
///
///This typically reflects whether it's starting, running, stopping, or
/// stopped, but also includes states related to the Instance's lifecycle
///
/// JSON schema
///
/// ```json
///{
/// "description": "Running state of an Instance (primarily: booted or
/// stopped)\n\nThis typically reflects whether it's starting, running,
/// stopping, or stopped, but also includes states related to the Instance's
/// lifecycle",
/// "oneOf": [
/// {
/// "description": "The instance is being created.",
/// "type": "string",
/// "enum": [
/// "creating"
/// ]
/// },
/// {
/// "description": "The instance is currently starting up.",
/// "type": "string",
/// "enum": [
/// "starting"
/// ]
/// },
/// {
/// "description": "The instance is currently running.",
/// "type": "string",
/// "enum": [
/// "running"
/// ]
/// },
/// {
/// "description": "The instance has been requested to stop and a
/// transition to \"Stopped\" is imminent.",
/// "type": "string",
/// "enum": [
/// "stopping"
/// ]
/// },
/// {
/// "description": "The instance is currently stopped.",
/// "type": "string",
/// "enum": [
/// "stopped"
/// ]
/// },
/// {
/// "description": "The instance is in the process of rebooting - it
/// will remain in the \"rebooting\" state until the VM is starting once
/// more.",
/// "type": "string",
/// "enum": [
/// "rebooting"
/// ]
/// },
/// {
/// "description": "The instance is in the process of migrating - it will remain in the \"migrating\" state until the migration process is complete and the destination propolis is ready to continue execution.",
/// "type": "string",
/// "enum": [
/// "migrating"
/// ]
/// },
/// {
/// "description": "The instance is attempting to recover from a
/// failure.",
/// "type": "string",
/// "enum": [
/// "repairing"
/// ]
/// },
/// {
/// "description": "The instance has encountered a failure.",
/// "type": "string",
/// "enum": [
/// "failed"
/// ]
/// },
/// {
/// "description": "The instance has been deleted.",
/// "type": "string",
/// "enum": [
/// "destroyed"
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum InstanceState {
///The instance is being created.
#[serde(rename = "creating")]
Creating,
///The instance is currently starting up.
#[serde(rename = "starting")]
Starting,
///The instance is currently running.
#[serde(rename = "running")]
Running,
///The instance has been requested to stop and a transition to
/// "Stopped" is imminent.
#[serde(rename = "stopping")]
Stopping,
///The instance is currently stopped.
#[serde(rename = "stopped")]
Stopped,
///The instance is in the process of rebooting - it will remain in the
/// "rebooting" state until the VM is starting once more.
#[serde(rename = "rebooting")]
Rebooting,
///The instance is in the process of migrating - it will remain in the
/// "migrating" state until the migration process is complete and the
/// destination propolis is ready to continue execution.
#[serde(rename = "migrating")]
Migrating,
///The instance is attempting to recover from a failure.
#[serde(rename = "repairing")]
Repairing,
///The instance has encountered a failure.
#[serde(rename = "failed")]
Failed,
///The instance has been deleted.
#[serde(rename = "destroyed")]
Destroyed,
}
impl From<&InstanceState> for InstanceState {
fn from(value: &InstanceState) -> Self {
value.clone()
}
}
impl ToString for InstanceState {
fn to_string(&self) -> String {
match *self {
Self::Creating => "creating".to_string(),
Self::Starting => "starting".to_string(),
Self::Running => "running".to_string(),
Self::Stopping => "stopping".to_string(),
Self::Stopped => "stopped".to_string(),
Self::Rebooting => "rebooting".to_string(),
Self::Migrating => "migrating".to_string(),
Self::Repairing => "repairing".to_string(),
Self::Failed => "failed".to_string(),
Self::Destroyed => "destroyed".to_string(),
}
}
}
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"creating" => Ok(Self::Creating),
"starting" => Ok(Self::Starting),
"running" => Ok(Self::Running),
"stopping" => Ok(Self::Stopping),
"stopped" => Ok(Self::Stopped),
"rebooting" => Ok(Self::Rebooting),
"migrating" => Ok(Self::Migrating),
"repairing" => Ok(Self::Repairing),
"failed" => Ok(Self::Failed),
"destroyed" => Ok(Self::Destroyed),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for InstanceState {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///The kind of an external IP address for an instance
///
/// JSON schema
///
/// ```json
///{
/// "description": "The kind of an external IP address for an instance",
/// "type": "string",
/// "enum": [
/// "ephemeral",
/// "floating"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum IpKind {
#[serde(rename = "ephemeral")]
Ephemeral,
#[serde(rename = "floating")]
Floating,
}
impl From<&IpKind> for IpKind {
fn from(value: &IpKind) -> Self {
value.clone()
}
}
impl ToString for IpKind {
fn to_string(&self) -> String {
match *self {
Self::Ephemeral => "ephemeral".to_string(),
Self::Floating => "floating".to_string(),
}
}
}
impl std::str::FromStr for IpKind {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"ephemeral" => Ok(Self::Ephemeral),
"floating" => Ok(Self::Floating),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for IpKind {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for IpKind {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for IpKind {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///IpNet
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "title": "v4",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Ipv4Net"
/// }
/// ]
/// },
/// {
/// "title": "v6",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Ipv6Net"
/// }
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum IpNet {
V4(Ipv4Net),
V6(Ipv6Net),
}
impl From<&IpNet> for IpNet {
fn from(value: &IpNet) -> Self {
value.clone()
}
}
impl std::str::FromStr for IpNet {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if let Ok(v) = value.parse() {
Ok(Self::V4(v))
} else if let Ok(v) = value.parse() {
Ok(Self::V6(v))
} else {
Err("string conversion failed for all variants")
}
}
}
impl std::convert::TryFrom<&str> for IpNet {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for IpNet {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for IpNet {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl ToString for IpNet {
fn to_string(&self) -> String {
match self {
Self::V4(x) => x.to_string(),
Self::V6(x) => x.to_string(),
}
}
}
impl From for IpNet {
fn from(value: Ipv4Net) -> Self {
Self::V4(value)
}
}
impl From for IpNet {
fn from(value: Ipv6Net) -> Self {
Self::V6(value)
}
}
///Identity-related metadata that's included in nearly all public API
/// objects
///
/// JSON schema
///
/// ```json
///{
/// "description": "Identity-related metadata that's included in nearly all
/// public API objects",
/// "type": "object",
/// "required": [
/// "description",
/// "id",
/// "name",
/// "time_created",
/// "time_modified"
/// ],
/// "properties": {
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IpPool {
///human-readable free-form text about a resource
pub description: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
}
impl From<&IpPool> for IpPool {
fn from(value: &IpPool) -> Self {
value.clone()
}
}
///Create-time parameters for an IP Pool.
///
///See [`IpPool`](crate::external_api::views::IpPool)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for an IP Pool.\n\nSee
/// [`IpPool`](crate::external_api::views::IpPool)",
/// "type": "object",
/// "required": [
/// "description",
/// "name"
/// ],
/// "properties": {
/// "description": {
/// "type": "string"
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IpPoolCreate {
pub description: String,
pub name: Name,
}
impl From<&IpPoolCreate> for IpPoolCreate {
fn from(value: &IpPoolCreate) -> Self {
value.clone()
}
}
///IpPoolRange
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "range",
/// "time_created"
/// ],
/// "properties": {
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "range": {
/// "$ref": "#/components/schemas/IpRange"
/// },
/// "time_created": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IpPoolRange {
pub id: uuid::Uuid,
pub range: IpRange,
pub time_created: chrono::DateTime,
}
impl From<&IpPoolRange> for IpPoolRange {
fn from(value: &IpPoolRange) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/IpPoolRange"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IpPoolRangeResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&IpPoolRangeResultsPage> for IpPoolRangeResultsPage {
fn from(value: &IpPoolRangeResultsPage) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/IpPool"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IpPoolResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&IpPoolResultsPage> for IpPoolResultsPage {
fn from(value: &IpPoolResultsPage) -> Self {
value.clone()
}
}
///Parameters for updating an IP Pool
///
/// JSON schema
///
/// ```json
///{
/// "description": "Parameters for updating an IP Pool",
/// "type": "object",
/// "properties": {
/// "description": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "name": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IpPoolUpdate {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option,
}
impl From<&IpPoolUpdate> for IpPoolUpdate {
fn from(value: &IpPoolUpdate) -> Self {
value.clone()
}
}
///IpRange
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "title": "v4",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Ipv4Range"
/// }
/// ]
/// },
/// {
/// "title": "v6",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Ipv6Range"
/// }
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum IpRange {
V4(Ipv4Range),
V6(Ipv6Range),
}
impl From<&IpRange> for IpRange {
fn from(value: &IpRange) -> Self {
value.clone()
}
}
impl From for IpRange {
fn from(value: Ipv4Range) -> Self {
Self::V4(value)
}
}
impl From for IpRange {
fn from(value: Ipv6Range) -> Self {
Self::V6(value)
}
}
///An IPv4 subnet, including prefix and subnet mask
///
/// JSON schema
///
/// ```json
///{
/// "title": "An IPv4 subnet",
/// "description": "An IPv4 subnet, including prefix and subnet mask",
/// "examples": [
/// "192.168.1.0/24"
/// ],
/// "type": "string",
/// "pattern":
/// "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.
/// ){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/
/// ([8-9]|1[0-9]|2[0-9]|3[0-2])$"
///}
/// ```
///
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Ipv4Net(String);
impl std::ops::Deref for Ipv4Net {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From for String {
fn from(value: Ipv4Net) -> Self {
value.0
}
}
impl From<&Ipv4Net> for Ipv4Net {
fn from(value: &Ipv4Net) -> Self {
value.clone()
}
}
impl std::str::FromStr for Ipv4Net {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if regress::Regex::new(
"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.\
){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/\
([8-9]|1[0-9]|2[0-9]|3[0-2])$",
)
.unwrap()
.find(value)
.is_none()
{
return Err("doesn't match pattern \
\"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.\
){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/\
([8-9]|1[0-9]|2[0-9]|3[0-2])$\"");
}
Ok(Self(value.to_string()))
}
}
impl std::convert::TryFrom<&str> for Ipv4Net {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for Ipv4Net {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for Ipv4Net {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl<'de> serde::Deserialize<'de> for Ipv4Net {
fn deserialize(deserializer: D) -> Result
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer)?
.parse()
.map_err(|e: &'static str| ::custom(e.to_string()))
}
}
///A non-decreasing IPv4 address range, inclusive of both ends.
///
///The first address must be less than or equal to the last address.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A non-decreasing IPv4 address range, inclusive of both
/// ends.\n\nThe first address must be less than or equal to the last
/// address.",
/// "type": "object",
/// "required": [
/// "first",
/// "last"
/// ],
/// "properties": {
/// "first": {
/// "type": "string",
/// "format": "ipv4"
/// },
/// "last": {
/// "type": "string",
/// "format": "ipv4"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Ipv4Range {
pub first: std::net::Ipv4Addr,
pub last: std::net::Ipv4Addr,
}
impl From<&Ipv4Range> for Ipv4Range {
fn from(value: &Ipv4Range) -> Self {
value.clone()
}
}
///An IPv6 subnet, including prefix and subnet mask
///
/// JSON schema
///
/// ```json
///{
/// "title": "An IPv6 subnet",
/// "description": "An IPv6 subnet, including prefix and subnet mask",
/// "examples": [
/// "fd12:3456::/64"
/// ],
/// "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}:)\\/([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$"
///}
/// ```
///
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Ipv6Net(String);
impl std::ops::Deref for Ipv6Net {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From for String {
fn from(value: Ipv6Net) -> Self {
value.0
}
}
impl From<&Ipv6Net> for Ipv6Net {
fn from(value: &Ipv6Net) -> Self {
value.clone()
}
}
impl std::str::FromStr for Ipv6Net {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if regress::Regex::new(
"^([fF][dD])[0-9a-fA-F]{2}:(([0-9a-fA-F]{1,4}:){6}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,\
4}:){1,6}:)\\/([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$",
)
.unwrap()
.find(value)
.is_none()
{
return Err("doesn't match pattern \
\"^([fF][dD])[0-9a-fA-F]{2}:(([0-9a-fA-F]{1,4}:){6}[0-9a-fA-F]{1,\
4}|([0-9a-fA-F]{1,4}:){1,6}:)\\/\
([1-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$\"");
}
Ok(Self(value.to_string()))
}
}
impl std::convert::TryFrom<&str> for Ipv6Net {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for Ipv6Net {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for Ipv6Net {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl<'de> serde::Deserialize<'de> for Ipv6Net {
fn deserialize(deserializer: D) -> Result
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer)?
.parse()
.map_err(|e: &'static str| ::custom(e.to_string()))
}
}
///A non-decreasing IPv6 address range, inclusive of both ends.
///
///The first address must be less than or equal to the last address.
///
/// JSON schema
///
/// ```json
///{
/// "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.",
/// "type": "object",
/// "required": [
/// "first",
/// "last"
/// ],
/// "properties": {
/// "first": {
/// "type": "string",
/// "format": "ipv6"
/// },
/// "last": {
/// "type": "string",
/// "format": "ipv6"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Ipv6Range {
pub first: std::net::Ipv6Addr,
pub last: std::net::Ipv6Addr,
}
impl From<&Ipv6Range> for Ipv6Range {
fn from(value: &Ipv6Range) -> Self {
value.clone()
}
}
///An inclusive-inclusive range of IP ports. The second port may be omitted
/// to represent a single port
///
/// JSON schema
///
/// ```json
///{
/// "title": "A range of IP ports",
/// "description": "An inclusive-inclusive range of IP ports. The second
/// port may be omitted to represent a single port",
/// "examples": [
/// "22"
/// ],
/// "type": "string",
/// "maxLength": 11,
/// "minLength": 1,
/// "pattern": "^[0-9]{1,5}(-[0-9]{1,5})?$"
///}
/// ```
///
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct L4PortRange(String);
impl std::ops::Deref for L4PortRange {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From for String {
fn from(value: L4PortRange) -> Self {
value.0
}
}
impl From<&L4PortRange> for L4PortRange {
fn from(value: &L4PortRange) -> Self {
value.clone()
}
}
impl std::str::FromStr for L4PortRange {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if value.len() > 11usize {
return Err("longer than 11 characters");
}
if value.len() < 1usize {
return Err("shorter than 1 characters");
}
if regress::Regex::new("^[0-9]{1,5}(-[0-9]{1,5})?$")
.unwrap()
.find(value)
.is_none()
{
return Err("doesn't match pattern \"^[0-9]{1,5}(-[0-9]{1,5})?$\"");
}
Ok(Self(value.to_string()))
}
}
impl std::convert::TryFrom<&str> for L4PortRange {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for L4PortRange {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for L4PortRange {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl<'de> serde::Deserialize<'de> for L4PortRange {
fn deserialize(deserializer: D) -> Result
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer)?
.parse()
.map_err(|e: &'static str| ::custom(e.to_string()))
}
}
///A Media Access Control address, in EUI-48 format
///
/// JSON schema
///
/// ```json
///{
/// "title": "A MAC address",
/// "description": "A Media Access Control address, in EUI-48 format",
/// "examples": [
/// "ff:ff:ff:ff:ff:ff"
/// ],
/// "type": "string",
/// "maxLength": 17,
/// "minLength": 17,
/// "pattern": "^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$"
///}
/// ```
///
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct MacAddr(String);
impl std::ops::Deref for MacAddr {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From for String {
fn from(value: MacAddr) -> Self {
value.0
}
}
impl From<&MacAddr> for MacAddr {
fn from(value: &MacAddr) -> Self {
value.clone()
}
}
impl std::str::FromStr for MacAddr {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if value.len() > 17usize {
return Err("longer than 17 characters");
}
if value.len() < 17usize {
return Err("shorter than 17 characters");
}
if regress::Regex::new("^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$")
.unwrap()
.find(value)
.is_none()
{
return Err("doesn't match pattern \"^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$\"");
}
Ok(Self(value.to_string()))
}
}
impl std::convert::TryFrom<&str> for MacAddr {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MacAddr {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for MacAddr {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl<'de> serde::Deserialize<'de> for MacAddr {
fn deserialize(deserializer: D) -> Result
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer)?
.parse()
.map_err(|e: &'static str| ::custom(e.to_string()))
}
}
///A `Measurement` is a timestamped datum from a single metric
///
/// JSON schema
///
/// ```json
///{
/// "description": "A `Measurement` is a timestamped datum from a single
/// metric",
/// "type": "object",
/// "required": [
/// "datum",
/// "timestamp"
/// ],
/// "properties": {
/// "datum": {
/// "$ref": "#/components/schemas/Datum"
/// },
/// "timestamp": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Measurement {
pub datum: Datum,
pub timestamp: chrono::DateTime,
}
impl From<&Measurement> for Measurement {
fn from(value: &Measurement) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Measurement"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct MeasurementResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&MeasurementResultsPage> for MeasurementResultsPage {
fn from(value: &MeasurementResultsPage) -> Self {
value.clone()
}
}
///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.
///
/// JSON schema
///
/// ```json
///{
/// "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 '-'. Names cannot be a UUID though they may
/// contain a UUID.",
/// "type": "string",
/// "maxLength": 63,
/// "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]$"
///}
/// ```
///
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Name(String);
impl std::ops::Deref for Name {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From for String {
fn from(value: Name) -> Self {
value.0
}
}
impl From<&Name> for Name {
fn from(value: &Name) -> Self {
value.clone()
}
}
impl std::str::FromStr for Name {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if value.len() > 63usize {
return Err("longer than 63 characters");
}
if regress :: Regex :: new ("^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$") . unwrap () . find (value) . is_none () { return Err ("doesn't match pattern \"^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$\"") ; }
Ok(Self(value.to_string()))
}
}
impl std::convert::TryFrom<&str> for Name {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for Name {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for Name {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl<'de> serde::Deserialize<'de> for Name {
fn deserialize(deserializer: D) -> Result
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer)?
.parse()
.map_err(|e: &'static str| ::custom(e.to_string()))
}
}
///NameOrId
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "title": "id",
/// "allOf": [
/// {
/// "type": "string",
/// "format": "uuid"
/// }
/// ]
/// },
/// {
/// "title": "name",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum NameOrId {
Id(uuid::Uuid),
Name(Name),
}
impl From<&NameOrId> for NameOrId {
fn from(value: &NameOrId) -> Self {
value.clone()
}
}
impl std::str::FromStr for NameOrId {
type Err = &'static str;
fn from_str(value: &str) -> Result {
if let Ok(v) = value.parse() {
Ok(Self::Id(v))
} else if let Ok(v) = value.parse() {
Ok(Self::Name(v))
} else {
Err("string conversion failed for all variants")
}
}
}
impl std::convert::TryFrom<&str> for NameOrId {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for NameOrId {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for NameOrId {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl ToString for NameOrId {
fn to_string(&self) -> String {
match self {
Self::Id(x) => x.to_string(),
Self::Name(x) => x.to_string(),
}
}
}
impl From for NameOrId {
fn from(value: uuid::Uuid) -> Self {
Self::Id(value)
}
}
impl From for NameOrId {
fn from(value: Name) -> Self {
Self::Name(value)
}
}
///Supported set of sort modes for scanning by name or id
///
/// JSON schema
///
/// ```json
///{
/// "description": "Supported set of sort modes for scanning by name or
/// id",
/// "oneOf": [
/// {
/// "description": "sort in increasing order of \"name\"",
/// "type": "string",
/// "enum": [
/// "name_ascending"
/// ]
/// },
/// {
/// "description": "sort in decreasing order of \"name\"",
/// "type": "string",
/// "enum": [
/// "name_descending"
/// ]
/// },
/// {
/// "description": "sort in increasing order of \"id\"",
/// "type": "string",
/// "enum": [
/// "id_ascending"
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum NameOrIdSortMode {
///sort in increasing order of "name"
#[serde(rename = "name_ascending")]
NameAscending,
///sort in decreasing order of "name"
#[serde(rename = "name_descending")]
NameDescending,
///sort in increasing order of "id"
#[serde(rename = "id_ascending")]
IdAscending,
}
impl From<&NameOrIdSortMode> for NameOrIdSortMode {
fn from(value: &NameOrIdSortMode) -> Self {
value.clone()
}
}
impl ToString for NameOrIdSortMode {
fn to_string(&self) -> String {
match *self {
Self::NameAscending => "name_ascending".to_string(),
Self::NameDescending => "name_descending".to_string(),
Self::IdAscending => "id_ascending".to_string(),
}
}
}
impl std::str::FromStr for NameOrIdSortMode {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"name_ascending" => Ok(Self::NameAscending),
"name_descending" => Ok(Self::NameDescending),
"id_ascending" => Ok(Self::IdAscending),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for NameOrIdSortMode {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for NameOrIdSortMode {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for NameOrIdSortMode {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///Supported set of sort modes for scanning by name only
///
///Currently, we only support scanning in ascending order.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Supported set of sort modes for scanning by name
/// only\n\nCurrently, we only support scanning in ascending order.",
/// "oneOf": [
/// {
/// "description": "sort in increasing order of \"name\"",
/// "type": "string",
/// "enum": [
/// "name_ascending"
/// ]
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum NameSortMode {
///sort in increasing order of "name"
#[serde(rename = "name_ascending")]
NameAscending,
}
impl From<&NameSortMode> for NameSortMode {
fn from(value: &NameSortMode) -> Self {
value.clone()
}
}
impl ToString for NameSortMode {
fn to_string(&self) -> String {
match *self {
Self::NameAscending => "name_ascending".to_string(),
}
}
}
impl std::str::FromStr for NameSortMode {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"name_ascending" => Ok(Self::NameAscending),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for NameSortMode {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for NameSortMode {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for NameSortMode {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///A `NetworkInterface` represents a virtual network interface device.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A `NetworkInterface` represents a virtual network
/// interface device.",
/// "type": "object",
/// "required": [
/// "description",
/// "id",
/// "instance_id",
/// "ip",
/// "mac",
/// "name",
/// "primary",
/// "subnet_id",
/// "time_created",
/// "time_modified",
/// "vpc_id"
/// ],
/// "properties": {
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "instance_id": {
/// "description": "The Instance to which the interface belongs.",
/// "type": "string",
/// "format": "uuid"
/// },
/// "ip": {
/// "description": "The IP address assigned to this interface.",
/// "type": "string",
/// "format": "ip"
/// },
/// "mac": {
/// "description": "The MAC address assigned to this interface.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/MacAddr"
/// }
/// ]
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "primary": {
/// "description": "True if this interface is the primary for the
/// instance to which it's attached.",
/// "type": "boolean"
/// },
/// "subnet_id": {
/// "description": "The subnet to which the interface belongs.",
/// "type": "string",
/// "format": "uuid"
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// },
/// "vpc_id": {
/// "description": "The VPC to which the interface belongs.",
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterface {
///human-readable free-form text about a resource
pub description: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///The Instance to which the interface belongs.
pub instance_id: uuid::Uuid,
///The IP address assigned to this interface.
pub ip: std::net::IpAddr,
///The MAC address assigned to this interface.
pub mac: MacAddr,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///True if this interface is the primary for the instance to which it's
/// attached.
pub primary: bool,
///The subnet to which the interface belongs.
pub subnet_id: uuid::Uuid,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
///The VPC to which the interface belongs.
pub vpc_id: uuid::Uuid,
}
impl From<&NetworkInterface> for NetworkInterface {
fn from(value: &NetworkInterface) -> Self {
value.clone()
}
}
///Create-time parameters for a
/// [`NetworkInterface`](omicron_common::api::external::NetworkInterface)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for a [`NetworkInterface`](omicron_common::api::external::NetworkInterface)",
/// "type": "object",
/// "required": [
/// "description",
/// "name",
/// "subnet_name",
/// "vpc_name"
/// ],
/// "properties": {
/// "description": {
/// "type": "string"
/// },
/// "ip": {
/// "description": "The IP address for the interface. One will be
/// auto-assigned if not provided.",
/// "type": [
/// "string",
/// "null"
/// ],
/// "format": "ip"
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// },
/// "subnet_name": {
/// "description": "The VPC Subnet in which to create the interface.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "vpc_name": {
/// "description": "The VPC in which to create the interface.",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterfaceCreate {
pub description: String,
///The IP address for the interface. One will be auto-assigned if not
/// provided.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ip: Option,
pub name: Name,
///The VPC Subnet in which to create the interface.
pub subnet_name: Name,
///The VPC in which to create the interface.
pub vpc_name: Name,
}
impl From<&NetworkInterfaceCreate> for NetworkInterfaceCreate {
fn from(value: &NetworkInterfaceCreate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/NetworkInterface"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterfaceResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&NetworkInterfaceResultsPage> for NetworkInterfaceResultsPage {
fn from(value: &NetworkInterfaceResultsPage) -> Self {
value.clone()
}
}
///Parameters for updating a
/// [`NetworkInterface`](omicron_common::api::external::NetworkInterface).
///
///Note that modifying IP addresses for an interface is not yet supported,
/// a new interface must be created instead.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Parameters for updating a
/// [`NetworkInterface`](omicron_common::api::external::NetworkInterface).\
/// n\nNote that modifying IP addresses for an interface is not yet
/// supported, a new interface must be created instead.",
/// "type": "object",
/// "properties": {
/// "description": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "name": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "primary": {
/// "description": "Make a secondary interface the instance's primary
/// interface.\n\nIf applied to a secondary interface, that interface will
/// become the primary on the next reboot of the instance. Note that this
/// may have implications for routing between instances, as the new primary
/// interface will be on a distinct subnet from the previous primary
/// interface.\n\nNote that this can only be used to select a new primary
/// interface for an instance. Requests to change the primary interface into
/// a secondary will return an error.",
/// "default": false,
/// "type": "boolean"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterfaceUpdate {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option,
///Make a secondary interface the instance's primary interface.
///
///If applied to a secondary interface, that interface will become the
/// primary on the next reboot of the instance. Note that this may have
/// implications for routing between instances, as the new primary
/// interface will be on a distinct subnet from the previous primary
/// interface.
///
///Note that this can only be used to select a new primary interface
/// for an instance. Requests to change the primary interface into a
/// secondary will return an error.
#[serde(default)]
pub primary: bool,
}
impl From<&NetworkInterfaceUpdate> for NetworkInterfaceUpdate {
fn from(value: &NetworkInterfaceUpdate) -> Self {
value.clone()
}
}
///Unique name for a saga [`Node`]
///
///Each node requires a string name that's unique within its DAG. The name
/// is used to identify its output. Nodes that depend on a given node
/// (either directly or indirectly) can access the node's output using its
/// name.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Unique name for a saga [`Node`]\n\nEach node requires a
/// string name that's unique within its DAG. The name is used to identify
/// its output. Nodes that depend on a given node (either directly or
/// indirectly) can access the node's output using its name.",
/// "type": "string"
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct NodeName(pub String);
impl std::ops::Deref for NodeName {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From for String {
fn from(value: NodeName) -> Self {
value.0
}
}
impl From<&NodeName> for NodeName {
fn from(value: &NodeName) -> Self {
value.clone()
}
}
impl From for NodeName {
fn from(value: String) -> Self {
Self(value)
}
}
impl std::str::FromStr for NodeName {
type Err = std::convert::Infallible;
fn from_str(value: &str) -> Result {
Ok(Self(value.to_string()))
}
}
impl ToString for NodeName {
fn to_string(&self) -> String {
self.0.to_string()
}
}
///Client view of an [`Organization`]
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of an [`Organization`]",
/// "type": "object",
/// "required": [
/// "description",
/// "id",
/// "name",
/// "time_created",
/// "time_modified"
/// ],
/// "properties": {
/// "description": {
/// "description": "human-readable free-form text about a resource",
/// "type": "string"
/// },
/// "id": {
/// "description": "unique, immutable, system-controlled identifier for
/// each resource",
/// "type": "string",
/// "format": "uuid"
/// },
/// "name": {
/// "description": "unique, mutable, user-controlled identifier for
/// each resource",
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// },
/// "time_created": {
/// "description": "timestamp when this resource was created",
/// "type": "string",
/// "format": "date-time"
/// },
/// "time_modified": {
/// "description": "timestamp when this resource was last modified",
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Organization {
///human-readable free-form text about a resource
pub description: String,
///unique, immutable, system-controlled identifier for each resource
pub id: uuid::Uuid,
///unique, mutable, user-controlled identifier for each resource
pub name: Name,
///timestamp when this resource was created
pub time_created: chrono::DateTime,
///timestamp when this resource was last modified
pub time_modified: chrono::DateTime,
}
impl From<&Organization> for Organization {
fn from(value: &Organization) -> Self {
value.clone()
}
}
///Create-time parameters for an
/// [`Organization`](crate::external_api::views::Organization)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Create-time parameters for an
/// [`Organization`](crate::external_api::views::Organization)",
/// "type": "object",
/// "required": [
/// "description",
/// "name"
/// ],
/// "properties": {
/// "description": {
/// "type": "string"
/// },
/// "name": {
/// "$ref": "#/components/schemas/Name"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OrganizationCreate {
pub description: String,
pub name: Name,
}
impl From<&OrganizationCreate> for OrganizationCreate {
fn from(value: &OrganizationCreate) -> Self {
value.clone()
}
}
///A single page of results
///
/// JSON schema
///
/// ```json
///{
/// "description": "A single page of results",
/// "type": "object",
/// "required": [
/// "items"
/// ],
/// "properties": {
/// "items": {
/// "description": "list of items on this page of results",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Organization"
/// }
/// },
/// "next_page": {
/// "description": "token used to fetch the next page of results (if
/// any)",
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OrganizationResultsPage {
///list of items on this page of results
pub items: Vec,
///token used to fetch the next page of results (if any)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_page: Option,
}
impl From<&OrganizationResultsPage> for OrganizationResultsPage {
fn from(value: &OrganizationResultsPage) -> Self {
value.clone()
}
}
///OrganizationRole
///
/// JSON schema
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "admin",
/// "collaborator",
/// "viewer"
/// ]
///}
/// ```
///
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum OrganizationRole {
#[serde(rename = "admin")]
Admin,
#[serde(rename = "collaborator")]
Collaborator,
#[serde(rename = "viewer")]
Viewer,
}
impl From<&OrganizationRole> for OrganizationRole {
fn from(value: &OrganizationRole) -> Self {
value.clone()
}
}
impl ToString for OrganizationRole {
fn to_string(&self) -> String {
match *self {
Self::Admin => "admin".to_string(),
Self::Collaborator => "collaborator".to_string(),
Self::Viewer => "viewer".to_string(),
}
}
}
impl std::str::FromStr for OrganizationRole {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"admin" => Ok(Self::Admin),
"collaborator" => Ok(Self::Collaborator),
"viewer" => Ok(Self::Viewer),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for OrganizationRole {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for OrganizationRole {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for OrganizationRole {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///Client view of a [`Policy`], which describes how this resource may be
/// accessed
///
///Note that the Policy only describes access granted explicitly for this
/// resource. The policies of parent resources can also cause a user to
/// have access to this resource.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Client view of a [`Policy`], which describes how this
/// resource may be accessed\n\nNote that the Policy only describes access
/// granted explicitly for this resource. The policies of parent resources
/// can also cause a user to have access to this resource.",
/// "type": "object",
/// "required": [
/// "role_assignments"
/// ],
/// "properties": {
/// "role_assignments": {
/// "description": "Roles directly assigned on this resource",
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/OrganizationRoleRoleAssignment"
/// }
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OrganizationRolePolicy {
///Roles directly assigned on this resource
pub role_assignments: Vec,
}
impl From<&OrganizationRolePolicy> for OrganizationRolePolicy {
fn from(value: &OrganizationRolePolicy) -> Self {
value.clone()
}
}
///Describes the assignment of a particular role on a particular resource
/// to a particular identity (user, group, etc.)
///
///The resource is not part of this structure. Rather, [`RoleAssignment`]s
/// are put into a [`Policy`] and that Policy is applied to a particular
/// resource.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Describes the assignment of a particular role on a
/// particular resource to a particular identity (user, group, etc.)\n\nThe
/// resource is not part of this structure. Rather, [`RoleAssignment`]s are
/// put into a [`Policy`] and that Policy is applied to a particular
/// resource.",
/// "type": "object",
/// "required": [
/// "identity_id",
/// "identity_type",
/// "role_name"
/// ],
/// "properties": {
/// "identity_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "identity_type": {
/// "$ref": "#/components/schemas/IdentityType"
/// },
/// "role_name": {
/// "$ref": "#/components/schemas/OrganizationRole"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OrganizationRoleRoleAssignment {
pub identity_id: uuid::Uuid,
pub identity_type: IdentityType,
pub role_name: OrganizationRole,
}
impl From<&OrganizationRoleRoleAssignment> for OrganizationRoleRoleAssignment {
fn from(value: &OrganizationRoleRoleAssignment) -> Self {
value.clone()
}
}
///Updateable properties of an
/// [`Organization`](crate::external_api::views::Organization)
///
/// JSON schema
///
/// ```json
///{
/// "description": "Updateable properties of an
/// [`Organization`](crate::external_api::views::Organization)",
/// "type": "object",
/// "properties": {
/// "description": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "name": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/Name"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OrganizationUpdate {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option,
}
impl From<&OrganizationUpdate> for OrganizationUpdate {
fn from(value: &OrganizationUpdate) -> Self {
value.clone()
}
}
///Passwords may be subject to additional constraints.
///
///