#[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;
///CrucibleOpts
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "lossy",
/// "read_only",
/// "target"
/// ],
/// "properties": {
/// "cert_pem": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "control": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "flush_timeout": {
/// "type": [
/// "integer",
/// "null"
/// ],
/// "format": "uint32",
/// "minimum": 0.0
/// },
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "key": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "key_pem": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "lossy": {
/// "type": "boolean"
/// },
/// "read_only": {
/// "type": "boolean"
/// },
/// "root_cert_pem": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "target": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct CrucibleOpts {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cert_pem: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub control: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub flush_timeout: Option,
pub id: uuid::Uuid,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub key: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub key_pem: Option,
pub lossy: bool,
pub read_only: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub root_cert_pem: Option,
pub target: Vec,
}
impl From<&CrucibleOpts> for CrucibleOpts {
fn from(value: &CrucibleOpts) -> Self {
value.clone()
}
}
impl CrucibleOpts {
pub fn builder() -> builder::CrucibleOpts {
Default::default()
}
}
///DiskAttachment
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "disk_id",
/// "generation_id",
/// "state"
/// ],
/// "properties": {
/// "disk_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "generation_id": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "state": {
/// "$ref": "#/components/schemas/DiskAttachmentState"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct DiskAttachment {
pub disk_id: uuid::Uuid,
pub generation_id: u64,
pub state: DiskAttachmentState,
}
impl From<&DiskAttachment> for DiskAttachment {
fn from(value: &DiskAttachment) -> Self {
value.clone()
}
}
impl DiskAttachment {
pub fn builder() -> builder::DiskAttachment {
Default::default()
}
}
///DiskAttachmentState
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "type": "string",
/// "enum": [
/// "Detached",
/// "Destroyed",
/// "Faulted"
/// ]
/// },
/// {
/// "type": "object",
/// "required": [
/// "Attached"
/// ],
/// "properties": {
/// "Attached": {
/// "type": "string",
/// "format": "uuid"
/// }
/// },
/// "additionalProperties": false
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub enum DiskAttachmentState {
Detached,
Destroyed,
Faulted,
Attached(uuid::Uuid),
}
impl From<&DiskAttachmentState> for DiskAttachmentState {
fn from(value: &DiskAttachmentState) -> Self {
value.clone()
}
}
impl From for DiskAttachmentState {
fn from(value: uuid::Uuid) -> Self {
Self::Attached(value)
}
}
///DiskRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "device",
/// "gen",
/// "name",
/// "read_only",
/// "slot",
/// "volume_construction_request"
/// ],
/// "properties": {
/// "device": {
/// "type": "string"
/// },
/// "gen": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "name": {
/// "type": "string"
/// },
/// "read_only": {
/// "type": "boolean"
/// },
/// "slot": {
/// "$ref": "#/components/schemas/Slot"
/// },
/// "volume_construction_request": {
/// "$ref": "#/components/schemas/VolumeConstructionRequest"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct DiskRequest {
pub device: String,
pub gen: u64,
pub name: String,
pub read_only: bool,
pub slot: Slot,
pub volume_construction_request: VolumeConstructionRequest,
}
impl From<&DiskRequest> for DiskRequest {
fn from(value: &DiskRequest) -> Self {
value.clone()
}
}
impl DiskRequest {
pub fn builder() -> builder::DiskRequest {
Default::default()
}
}
///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, schemars :: JsonSchema)]
pub struct Error {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error_code: Option,
pub message: String,
pub request_id: String,
}
impl From<&Error> for Error {
fn from(value: &Error) -> Self {
value.clone()
}
}
impl Error {
pub fn builder() -> builder::Error {
Default::default()
}
}
///Instance
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "disks",
/// "nics",
/// "properties",
/// "state"
/// ],
/// "properties": {
/// "disks": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/DiskAttachment"
/// }
/// },
/// "nics": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/NetworkInterface"
/// }
/// },
/// "properties": {
/// "$ref": "#/components/schemas/InstanceProperties"
/// },
/// "state": {
/// "$ref": "#/components/schemas/InstanceState"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct Instance {
pub disks: Vec,
pub nics: Vec,
pub properties: InstanceProperties,
pub state: InstanceState,
}
impl From<&Instance> for Instance {
fn from(value: &Instance) -> Self {
value.clone()
}
}
impl Instance {
pub fn builder() -> builder::Instance {
Default::default()
}
}
///InstanceEnsureRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "properties"
/// ],
/// "properties": {
/// "cloud_init_bytes": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "disks": {
/// "default": [],
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/DiskRequest"
/// }
/// },
/// "migrate": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/InstanceMigrateInitiateRequest"
/// }
/// ]
/// },
/// "nics": {
/// "default": [],
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/NetworkInterfaceRequest"
/// }
/// },
/// "properties": {
/// "$ref": "#/components/schemas/InstanceProperties"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceEnsureRequest {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cloud_init_bytes: Option,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub disks: Vec,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub migrate: Option,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub nics: Vec,
pub properties: InstanceProperties,
}
impl From<&InstanceEnsureRequest> for InstanceEnsureRequest {
fn from(value: &InstanceEnsureRequest) -> Self {
value.clone()
}
}
impl InstanceEnsureRequest {
pub fn builder() -> builder::InstanceEnsureRequest {
Default::default()
}
}
///InstanceEnsureResponse
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "properties": {
/// "migrate": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/InstanceMigrateInitiateResponse"
/// }
/// ]
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceEnsureResponse {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub migrate: Option,
}
impl From<&InstanceEnsureResponse> for InstanceEnsureResponse {
fn from(value: &InstanceEnsureResponse) -> Self {
value.clone()
}
}
impl InstanceEnsureResponse {
pub fn builder() -> builder::InstanceEnsureResponse {
Default::default()
}
}
///InstanceGetResponse
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "instance"
/// ],
/// "properties": {
/// "instance": {
/// "$ref": "#/components/schemas/Instance"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceGetResponse {
pub instance: Instance,
}
impl From<&InstanceGetResponse> for InstanceGetResponse {
fn from(value: &InstanceGetResponse) -> Self {
value.clone()
}
}
impl InstanceGetResponse {
pub fn builder() -> builder::InstanceGetResponse {
Default::default()
}
}
///InstanceMigrateInitiateRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "migration_id",
/// "src_addr",
/// "src_uuid"
/// ],
/// "properties": {
/// "migration_id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "src_addr": {
/// "type": "string"
/// },
/// "src_uuid": {
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceMigrateInitiateRequest {
pub migration_id: uuid::Uuid,
pub src_addr: String,
pub src_uuid: uuid::Uuid,
}
impl From<&InstanceMigrateInitiateRequest> for InstanceMigrateInitiateRequest {
fn from(value: &InstanceMigrateInitiateRequest) -> Self {
value.clone()
}
}
impl InstanceMigrateInitiateRequest {
pub fn builder() -> builder::InstanceMigrateInitiateRequest {
Default::default()
}
}
///InstanceMigrateInitiateResponse
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "migration_id"
/// ],
/// "properties": {
/// "migration_id": {
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceMigrateInitiateResponse {
pub migration_id: uuid::Uuid,
}
impl From<&InstanceMigrateInitiateResponse> for InstanceMigrateInitiateResponse {
fn from(value: &InstanceMigrateInitiateResponse) -> Self {
value.clone()
}
}
impl InstanceMigrateInitiateResponse {
pub fn builder() -> builder::InstanceMigrateInitiateResponse {
Default::default()
}
}
///InstanceMigrateStatusRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "migration_id"
/// ],
/// "properties": {
/// "migration_id": {
/// "type": "string",
/// "format": "uuid"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceMigrateStatusRequest {
pub migration_id: uuid::Uuid,
}
impl From<&InstanceMigrateStatusRequest> for InstanceMigrateStatusRequest {
fn from(value: &InstanceMigrateStatusRequest) -> Self {
value.clone()
}
}
impl InstanceMigrateStatusRequest {
pub fn builder() -> builder::InstanceMigrateStatusRequest {
Default::default()
}
}
///InstanceMigrateStatusResponse
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "state"
/// ],
/// "properties": {
/// "state": {
/// "$ref": "#/components/schemas/MigrationState"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceMigrateStatusResponse {
pub state: MigrationState,
}
impl From<&InstanceMigrateStatusResponse> for InstanceMigrateStatusResponse {
fn from(value: &InstanceMigrateStatusResponse) -> Self {
value.clone()
}
}
impl InstanceMigrateStatusResponse {
pub fn builder() -> builder::InstanceMigrateStatusResponse {
Default::default()
}
}
///InstanceProperties
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "bootrom_id",
/// "description",
/// "id",
/// "image_id",
/// "memory",
/// "name",
/// "vcpus"
/// ],
/// "properties": {
/// "bootrom_id": {
/// "description": "ID of the bootrom used to initialize this
/// Instance.",
/// "type": "string",
/// "format": "uuid"
/// },
/// "description": {
/// "description": "Free-form text description of an Instance.",
/// "type": "string"
/// },
/// "id": {
/// "description": "Unique identifier for this Instance.",
/// "type": "string",
/// "format": "uuid"
/// },
/// "image_id": {
/// "description": "ID of the image used to initialize this Instance.",
/// "type": "string",
/// "format": "uuid"
/// },
/// "memory": {
/// "description": "Size of memory allocated to the Instance, in MiB.",
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "name": {
/// "description": "Human-readable name of the Instance.",
/// "type": "string"
/// },
/// "vcpus": {
/// "description": "Number of vCPUs to be allocated to the Instance.",
/// "type": "integer",
/// "format": "uint8",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceProperties {
///ID of the bootrom used to initialize this Instance.
pub bootrom_id: uuid::Uuid,
///Free-form text description of an Instance.
pub description: String,
///Unique identifier for this Instance.
pub id: uuid::Uuid,
///ID of the image used to initialize this Instance.
pub image_id: uuid::Uuid,
///Size of memory allocated to the Instance, in MiB.
pub memory: u64,
///Human-readable name of the Instance.
pub name: String,
///Number of vCPUs to be allocated to the Instance.
pub vcpus: u8,
}
impl From<&InstanceProperties> for InstanceProperties {
fn from(value: &InstanceProperties) -> Self {
value.clone()
}
}
impl InstanceProperties {
pub fn builder() -> builder::InstanceProperties {
Default::default()
}
}
///Current state of an Instance.
///
/// JSON schema
///
/// ```json
///{
/// "description": "Current state of an Instance.",
/// "type": "string",
/// "enum": [
/// "Creating",
/// "Starting",
/// "Running",
/// "Stopping",
/// "Stopped",
/// "Rebooting",
/// "Migrating",
/// "Repairing",
/// "Failed",
/// "Destroyed"
/// ]
///}
/// ```
///
#[derive(
Clone,
Copy,
Debug,
Deserialize,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
Serialize,
schemars :: JsonSchema,
)]
pub enum InstanceState {
Creating,
Starting,
Running,
Stopping,
Stopped,
Rebooting,
Migrating,
Repairing,
Failed,
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()
}
}
///InstanceStateMonitorRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "gen"
/// ],
/// "properties": {
/// "gen": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceStateMonitorRequest {
pub gen: u64,
}
impl From<&InstanceStateMonitorRequest> for InstanceStateMonitorRequest {
fn from(value: &InstanceStateMonitorRequest) -> Self {
value.clone()
}
}
impl InstanceStateMonitorRequest {
pub fn builder() -> builder::InstanceStateMonitorRequest {
Default::default()
}
}
///InstanceStateMonitorResponse
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "gen",
/// "state"
/// ],
/// "properties": {
/// "gen": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "state": {
/// "$ref": "#/components/schemas/InstanceState"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct InstanceStateMonitorResponse {
pub gen: u64,
pub state: InstanceState,
}
impl From<&InstanceStateMonitorResponse> for InstanceStateMonitorResponse {
fn from(value: &InstanceStateMonitorResponse) -> Self {
value.clone()
}
}
impl InstanceStateMonitorResponse {
pub fn builder() -> builder::InstanceStateMonitorResponse {
Default::default()
}
}
///InstanceStateRequested
///
/// JSON schema
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "Run",
/// "Stop",
/// "Reboot",
/// "MigrateStart"
/// ]
///}
/// ```
///
#[derive(
Clone,
Copy,
Debug,
Deserialize,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
Serialize,
schemars :: JsonSchema,
)]
pub enum InstanceStateRequested {
Run,
Stop,
Reboot,
MigrateStart,
}
impl From<&InstanceStateRequested> for InstanceStateRequested {
fn from(value: &InstanceStateRequested) -> Self {
value.clone()
}
}
impl ToString for InstanceStateRequested {
fn to_string(&self) -> String {
match *self {
Self::Run => "Run".to_string(),
Self::Stop => "Stop".to_string(),
Self::Reboot => "Reboot".to_string(),
Self::MigrateStart => "MigrateStart".to_string(),
}
}
}
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
"Reboot" => Ok(Self::Reboot),
"MigrateStart" => Ok(Self::MigrateStart),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///MigrationState
///
/// JSON schema
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "Sync",
/// "RamPush",
/// "Pause",
/// "RamPushDirty",
/// "Device",
/// "Arch",
/// "Resume",
/// "RamPull",
/// "Finish",
/// "Error"
/// ]
///}
/// ```
///
#[derive(
Clone,
Copy,
Debug,
Deserialize,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
Serialize,
schemars :: JsonSchema,
)]
pub enum MigrationState {
Sync,
RamPush,
Pause,
RamPushDirty,
Device,
Arch,
Resume,
RamPull,
Finish,
Error,
}
impl From<&MigrationState> for MigrationState {
fn from(value: &MigrationState) -> Self {
value.clone()
}
}
impl ToString for MigrationState {
fn to_string(&self) -> String {
match *self {
Self::Sync => "Sync".to_string(),
Self::RamPush => "RamPush".to_string(),
Self::Pause => "Pause".to_string(),
Self::RamPushDirty => "RamPushDirty".to_string(),
Self::Device => "Device".to_string(),
Self::Arch => "Arch".to_string(),
Self::Resume => "Resume".to_string(),
Self::RamPull => "RamPull".to_string(),
Self::Finish => "Finish".to_string(),
Self::Error => "Error".to_string(),
}
}
}
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
"Pause" => Ok(Self::Pause),
"RamPushDirty" => Ok(Self::RamPushDirty),
"Device" => Ok(Self::Device),
"Arch" => Ok(Self::Arch),
"Resume" => Ok(Self::Resume),
"RamPull" => Ok(Self::RamPull),
"Finish" => Ok(Self::Finish),
"Error" => Ok(Self::Error),
_ => Err("invalid value"),
}
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for MigrationState {
type Error = &'static str;
fn try_from(value: String) -> Result {
value.parse()
}
}
///NetworkInterface
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "attachment",
/// "name"
/// ],
/// "properties": {
/// "attachment": {
/// "$ref": "#/components/schemas/NetworkInterfaceAttachmentState"
/// },
/// "name": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct NetworkInterface {
pub attachment: NetworkInterfaceAttachmentState,
pub name: String,
}
impl From<&NetworkInterface> for NetworkInterface {
fn from(value: &NetworkInterface) -> Self {
value.clone()
}
}
impl NetworkInterface {
pub fn builder() -> builder::NetworkInterface {
Default::default()
}
}
///NetworkInterfaceAttachmentState
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "type": "string",
/// "enum": [
/// "Detached",
/// "Faulted"
/// ]
/// },
/// {
/// "type": "object",
/// "required": [
/// "Attached"
/// ],
/// "properties": {
/// "Attached": {
/// "$ref": "#/components/schemas/Slot"
/// }
/// },
/// "additionalProperties": false
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub enum NetworkInterfaceAttachmentState {
Detached,
Faulted,
Attached(Slot),
}
impl From<&NetworkInterfaceAttachmentState> for NetworkInterfaceAttachmentState {
fn from(value: &NetworkInterfaceAttachmentState) -> Self {
value.clone()
}
}
impl From for NetworkInterfaceAttachmentState {
fn from(value: Slot) -> Self {
Self::Attached(value)
}
}
///NetworkInterfaceRequest
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "name",
/// "slot"
/// ],
/// "properties": {
/// "name": {
/// "type": "string"
/// },
/// "slot": {
/// "$ref": "#/components/schemas/Slot"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct NetworkInterfaceRequest {
pub name: String,
pub slot: Slot,
}
impl From<&NetworkInterfaceRequest> for NetworkInterfaceRequest {
fn from(value: &NetworkInterfaceRequest) -> Self {
value.clone()
}
}
impl NetworkInterfaceRequest {
pub fn builder() -> builder::NetworkInterfaceRequest {
Default::default()
}
}
///A stable index which is translated by Propolis into a PCI BDF, visible
/// to the guest.
///
/// JSON schema
///
/// ```json
///{
/// "description": "A stable index which is translated by Propolis into a
/// PCI BDF, visible to the guest.",
/// "type": "integer",
/// "format": "uint8",
/// "minimum": 0.0
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct Slot(pub u8);
impl std::ops::Deref for Slot {
type Target = u8;
fn deref(&self) -> &u8 {
&self.0
}
}
impl From for u8 {
fn from(value: Slot) -> Self {
value.0
}
}
impl From<&Slot> for Slot {
fn from(value: &Slot) -> Self {
value.clone()
}
}
impl From for Slot {
fn from(value: u8) -> Self {
Self(value)
}
}
impl std::str::FromStr for Slot {
type Err = ::Err;
fn from_str(value: &str) -> Result {
Ok(Self(value.parse()?))
}
}
impl std::convert::TryFrom<&str> for Slot {
type Error = ::Err;
fn try_from(value: &str) -> Result {
value.parse()
}
}
impl std::convert::TryFrom<&String> for Slot {
type Error = ::Err;
fn try_from(value: &String) -> Result {
value.parse()
}
}
impl std::convert::TryFrom for Slot {
type Error = ::Err;
fn try_from(value: String) -> Result {
value.parse()
}
}
impl ToString for Slot {
fn to_string(&self) -> String {
self.0.to_string()
}
}
///VolumeConstructionRequest
///
/// JSON schema
///
/// ```json
///{
/// "oneOf": [
/// {
/// "type": "object",
/// "required": [
/// "block_size",
/// "id",
/// "sub_volumes",
/// "type"
/// ],
/// "properties": {
/// "block_size": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "read_only_parent": {
/// "allOf": [
/// {
/// "$ref": "#/components/schemas/VolumeConstructionRequest"
/// }
/// ]
/// },
/// "sub_volumes": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/VolumeConstructionRequest"
/// }
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "volume"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "block_size",
/// "id",
/// "type",
/// "url"
/// ],
/// "properties": {
/// "block_size": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "url"
/// ]
/// },
/// "url": {
/// "type": "string"
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "block_size",
/// "gen",
/// "opts",
/// "type"
/// ],
/// "properties": {
/// "block_size": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "gen": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "opts": {
/// "$ref": "#/components/schemas/CrucibleOpts"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "region"
/// ]
/// }
/// }
/// },
/// {
/// "type": "object",
/// "required": [
/// "block_size",
/// "id",
/// "path",
/// "type"
/// ],
/// "properties": {
/// "block_size": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// },
/// "id": {
/// "type": "string",
/// "format": "uuid"
/// },
/// "path": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "file"
/// ]
/// }
/// }
/// }
/// ]
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
#[serde(tag = "type")]
pub enum VolumeConstructionRequest {
#[serde(rename = "volume")]
Volume {
block_size: u64,
id: uuid::Uuid,
#[serde(default, skip_serializing_if = "Option::is_none")]
read_only_parent: Option>,
sub_volumes: Vec,
},
#[serde(rename = "url")]
Url {
block_size: u64,
id: uuid::Uuid,
url: String,
},
#[serde(rename = "region")]
Region {
block_size: u64,
gen: u64,
opts: CrucibleOpts,
},
#[serde(rename = "file")]
File {
block_size: u64,
id: uuid::Uuid,
path: String,
},
}
impl From<&VolumeConstructionRequest> for VolumeConstructionRequest {
fn from(value: &VolumeConstructionRequest) -> Self {
value.clone()
}
}
pub mod builder {
#[derive(Clone, Debug)]
pub struct CrucibleOpts {
cert_pem: Result