update typify + fixture data (#318)

This commit is contained in:
Adam Leventhal 2023-01-25 09:19:15 -08:00 committed by GitHub
parent 9f0a9910ab
commit 32f2089f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1779 additions and 699 deletions

6
Cargo.lock generated
View File

@ -2025,7 +2025,7 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "typify"
version = "0.0.11-dev"
source = "git+https://github.com/oxidecomputer/typify#2790d798ea650c08686d014fdd87c25d942806b1"
source = "git+https://github.com/oxidecomputer/typify#c18d0452db86d57318eec40a14c5aca5a079e6f8"
dependencies = [
"typify-impl",
"typify-macro",
@ -2034,7 +2034,7 @@ dependencies = [
[[package]]
name = "typify-impl"
version = "0.0.11-dev"
source = "git+https://github.com/oxidecomputer/typify#2790d798ea650c08686d014fdd87c25d942806b1"
source = "git+https://github.com/oxidecomputer/typify#c18d0452db86d57318eec40a14c5aca5a079e6f8"
dependencies = [
"heck",
"log",
@ -2052,7 +2052,7 @@ dependencies = [
[[package]]
name = "typify-macro"
version = "0.0.11-dev"
source = "git+https://github.com/oxidecomputer/typify#2790d798ea650c08686d014fdd87c25d942806b1"
source = "git+https://github.com/oxidecomputer/typify#c18d0452db86d57318eec40a14c5aca5a079e6f8"
dependencies = [
"proc-macro2",
"quote",

View File

@ -325,7 +325,7 @@ pub mod types {
impl std::convert::TryFrom<Task> for super::Task {
type Error = String;
fn try_from(value: Task) -> Result<Self, Self::Error> {
fn try_from(value: Task) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -399,7 +399,7 @@ pub mod types {
impl std::convert::TryFrom<TaskEvent> for super::TaskEvent {
type Error = String;
fn try_from(value: TaskEvent) -> Result<Self, Self::Error> {
fn try_from(value: TaskEvent) -> Result<Self, String> {
Ok(Self {
payload: value.payload?,
seq: value.seq?,
@ -460,7 +460,7 @@ pub mod types {
impl std::convert::TryFrom<TaskOutput> for super::TaskOutput {
type Error = String;
fn try_from(value: TaskOutput) -> Result<Self, Self::Error> {
fn try_from(value: TaskOutput) -> Result<Self, String> {
Ok(Self {
id: value.id?,
path: value.path?,
@ -520,7 +520,7 @@ pub mod types {
impl std::convert::TryFrom<TaskSubmit> for super::TaskSubmit {
type Error = String;
fn try_from(value: TaskSubmit) -> Result<Self, Self::Error> {
fn try_from(value: TaskSubmit) -> Result<Self, String> {
Ok(Self {
name: value.name?,
output_rules: value.output_rules?,
@ -556,7 +556,7 @@ pub mod types {
impl std::convert::TryFrom<TaskSubmitResult> for super::TaskSubmitResult {
type Error = String;
fn try_from(value: TaskSubmitResult) -> Result<Self, Self::Error> {
fn try_from(value: TaskSubmitResult) -> Result<Self, String> {
Ok(Self { id: value.id? })
}
}
@ -588,7 +588,7 @@ pub mod types {
impl std::convert::TryFrom<UploadedChunk> for super::UploadedChunk {
type Error = String;
fn try_from(value: UploadedChunk) -> Result<Self, Self::Error> {
fn try_from(value: UploadedChunk) -> Result<Self, String> {
Ok(Self { id: value.id? })
}
}
@ -620,7 +620,7 @@ pub mod types {
impl std::convert::TryFrom<UserCreate> for super::UserCreate {
type Error = String;
fn try_from(value: UserCreate) -> Result<Self, Self::Error> {
fn try_from(value: UserCreate) -> Result<Self, String> {
Ok(Self { name: value.name? })
}
}
@ -676,7 +676,7 @@ pub mod types {
impl std::convert::TryFrom<UserCreateResult> for super::UserCreateResult {
type Error = String;
fn try_from(value: UserCreateResult) -> Result<Self, Self::Error> {
fn try_from(value: UserCreateResult) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -724,7 +724,7 @@ pub mod types {
impl std::convert::TryFrom<WhoamiResult> for super::WhoamiResult {
type Error = String;
fn try_from(value: WhoamiResult) -> Result<Self, Self::Error> {
fn try_from(value: WhoamiResult) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -819,7 +819,7 @@ pub mod types {
impl std::convert::TryFrom<Worker> for super::Worker {
type Error = String;
fn try_from(value: Worker) -> Result<Self, Self::Error> {
fn try_from(value: Worker) -> Result<Self, String> {
Ok(Self {
deleted: value.deleted?,
id: value.id?,
@ -882,7 +882,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerAddOutput> for super::WorkerAddOutput {
type Error = String;
fn try_from(value: WorkerAddOutput) -> Result<Self, Self::Error> {
fn try_from(value: WorkerAddOutput) -> Result<Self, String> {
Ok(Self {
chunks: value.chunks?,
path: value.path?,
@ -942,7 +942,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerAppendTask> for super::WorkerAppendTask {
type Error = String;
fn try_from(value: WorkerAppendTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerAppendTask) -> Result<Self, String> {
Ok(Self {
payload: value.payload?,
stream: value.stream?,
@ -990,7 +990,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerBootstrap> for super::WorkerBootstrap {
type Error = String;
fn try_from(value: WorkerBootstrap) -> Result<Self, Self::Error> {
fn try_from(value: WorkerBootstrap) -> Result<Self, String> {
Ok(Self {
bootstrap: value.bootstrap?,
token: value.token?,
@ -1025,7 +1025,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerBootstrapResult> for super::WorkerBootstrapResult {
type Error = String;
fn try_from(value: WorkerBootstrapResult) -> Result<Self, Self::Error> {
fn try_from(value: WorkerBootstrapResult) -> Result<Self, String> {
Ok(Self { id: value.id? })
}
}
@ -1057,7 +1057,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerCompleteTask> for super::WorkerCompleteTask {
type Error = String;
fn try_from(value: WorkerCompleteTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerCompleteTask) -> Result<Self, String> {
Ok(Self {
failed: value.failed?,
})
@ -1103,7 +1103,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerPingResult> for super::WorkerPingResult {
type Error = String;
fn try_from(value: WorkerPingResult) -> Result<Self, Self::Error> {
fn try_from(value: WorkerPingResult) -> Result<Self, String> {
Ok(Self {
poweroff: value.poweroff?,
task: value.task?,
@ -1162,7 +1162,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerPingTask> for super::WorkerPingTask {
type Error = String;
fn try_from(value: WorkerPingTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerPingTask) -> Result<Self, String> {
Ok(Self {
id: value.id?,
output_rules: value.output_rules?,
@ -1222,7 +1222,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerTask> for super::WorkerTask {
type Error = String;
fn try_from(value: WorkerTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerTask) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1258,7 +1258,7 @@ pub mod types {
impl std::convert::TryFrom<WorkersResult> for super::WorkersResult {
type Error = String;
fn try_from(value: WorkersResult) -> Result<Self, Self::Error> {
fn try_from(value: WorkersResult) -> Result<Self, String> {
Ok(Self {
workers: value.workers?,
})

View File

@ -325,7 +325,7 @@ pub mod types {
impl std::convert::TryFrom<Task> for super::Task {
type Error = String;
fn try_from(value: Task) -> Result<Self, Self::Error> {
fn try_from(value: Task) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -399,7 +399,7 @@ pub mod types {
impl std::convert::TryFrom<TaskEvent> for super::TaskEvent {
type Error = String;
fn try_from(value: TaskEvent) -> Result<Self, Self::Error> {
fn try_from(value: TaskEvent) -> Result<Self, String> {
Ok(Self {
payload: value.payload?,
seq: value.seq?,
@ -460,7 +460,7 @@ pub mod types {
impl std::convert::TryFrom<TaskOutput> for super::TaskOutput {
type Error = String;
fn try_from(value: TaskOutput) -> Result<Self, Self::Error> {
fn try_from(value: TaskOutput) -> Result<Self, String> {
Ok(Self {
id: value.id?,
path: value.path?,
@ -520,7 +520,7 @@ pub mod types {
impl std::convert::TryFrom<TaskSubmit> for super::TaskSubmit {
type Error = String;
fn try_from(value: TaskSubmit) -> Result<Self, Self::Error> {
fn try_from(value: TaskSubmit) -> Result<Self, String> {
Ok(Self {
name: value.name?,
output_rules: value.output_rules?,
@ -556,7 +556,7 @@ pub mod types {
impl std::convert::TryFrom<TaskSubmitResult> for super::TaskSubmitResult {
type Error = String;
fn try_from(value: TaskSubmitResult) -> Result<Self, Self::Error> {
fn try_from(value: TaskSubmitResult) -> Result<Self, String> {
Ok(Self { id: value.id? })
}
}
@ -588,7 +588,7 @@ pub mod types {
impl std::convert::TryFrom<UploadedChunk> for super::UploadedChunk {
type Error = String;
fn try_from(value: UploadedChunk) -> Result<Self, Self::Error> {
fn try_from(value: UploadedChunk) -> Result<Self, String> {
Ok(Self { id: value.id? })
}
}
@ -620,7 +620,7 @@ pub mod types {
impl std::convert::TryFrom<UserCreate> for super::UserCreate {
type Error = String;
fn try_from(value: UserCreate) -> Result<Self, Self::Error> {
fn try_from(value: UserCreate) -> Result<Self, String> {
Ok(Self { name: value.name? })
}
}
@ -676,7 +676,7 @@ pub mod types {
impl std::convert::TryFrom<UserCreateResult> for super::UserCreateResult {
type Error = String;
fn try_from(value: UserCreateResult) -> Result<Self, Self::Error> {
fn try_from(value: UserCreateResult) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -724,7 +724,7 @@ pub mod types {
impl std::convert::TryFrom<WhoamiResult> for super::WhoamiResult {
type Error = String;
fn try_from(value: WhoamiResult) -> Result<Self, Self::Error> {
fn try_from(value: WhoamiResult) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -819,7 +819,7 @@ pub mod types {
impl std::convert::TryFrom<Worker> for super::Worker {
type Error = String;
fn try_from(value: Worker) -> Result<Self, Self::Error> {
fn try_from(value: Worker) -> Result<Self, String> {
Ok(Self {
deleted: value.deleted?,
id: value.id?,
@ -882,7 +882,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerAddOutput> for super::WorkerAddOutput {
type Error = String;
fn try_from(value: WorkerAddOutput) -> Result<Self, Self::Error> {
fn try_from(value: WorkerAddOutput) -> Result<Self, String> {
Ok(Self {
chunks: value.chunks?,
path: value.path?,
@ -942,7 +942,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerAppendTask> for super::WorkerAppendTask {
type Error = String;
fn try_from(value: WorkerAppendTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerAppendTask) -> Result<Self, String> {
Ok(Self {
payload: value.payload?,
stream: value.stream?,
@ -990,7 +990,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerBootstrap> for super::WorkerBootstrap {
type Error = String;
fn try_from(value: WorkerBootstrap) -> Result<Self, Self::Error> {
fn try_from(value: WorkerBootstrap) -> Result<Self, String> {
Ok(Self {
bootstrap: value.bootstrap?,
token: value.token?,
@ -1025,7 +1025,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerBootstrapResult> for super::WorkerBootstrapResult {
type Error = String;
fn try_from(value: WorkerBootstrapResult) -> Result<Self, Self::Error> {
fn try_from(value: WorkerBootstrapResult) -> Result<Self, String> {
Ok(Self { id: value.id? })
}
}
@ -1057,7 +1057,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerCompleteTask> for super::WorkerCompleteTask {
type Error = String;
fn try_from(value: WorkerCompleteTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerCompleteTask) -> Result<Self, String> {
Ok(Self {
failed: value.failed?,
})
@ -1103,7 +1103,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerPingResult> for super::WorkerPingResult {
type Error = String;
fn try_from(value: WorkerPingResult) -> Result<Self, Self::Error> {
fn try_from(value: WorkerPingResult) -> Result<Self, String> {
Ok(Self {
poweroff: value.poweroff?,
task: value.task?,
@ -1162,7 +1162,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerPingTask> for super::WorkerPingTask {
type Error = String;
fn try_from(value: WorkerPingTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerPingTask) -> Result<Self, String> {
Ok(Self {
id: value.id?,
output_rules: value.output_rules?,
@ -1222,7 +1222,7 @@ pub mod types {
impl std::convert::TryFrom<WorkerTask> for super::WorkerTask {
type Error = String;
fn try_from(value: WorkerTask) -> Result<Self, Self::Error> {
fn try_from(value: WorkerTask) -> Result<Self, String> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1258,7 +1258,7 @@ pub mod types {
impl std::convert::TryFrom<WorkersResult> for super::WorkersResult {
type Error = String;
fn try_from(value: WorkersResult) -> Result<Self, Self::Error> {
fn try_from(value: WorkersResult) -> Result<Self, String> {
Ok(Self {
workers: value.workers?,
})

View File

@ -176,7 +176,7 @@ pub mod types {
impl std::convert::TryFrom<EnrolBody> for super::EnrolBody {
type Error = String;
fn try_from(value: EnrolBody) -> Result<Self, Self::Error> {
fn try_from(value: EnrolBody) -> Result<Self, String> {
Ok(Self {
host: value.host?,
key: value.key?,
@ -211,7 +211,7 @@ pub mod types {
impl std::convert::TryFrom<GlobalJobsResult> for super::GlobalJobsResult {
type Error = String;
fn try_from(value: GlobalJobsResult) -> Result<Self, Self::Error> {
fn try_from(value: GlobalJobsResult) -> Result<Self, String> {
Ok(Self {
summary: value.summary?,
})
@ -269,7 +269,7 @@ pub mod types {
impl std::convert::TryFrom<OutputRecord> for super::OutputRecord {
type Error = String;
fn try_from(value: OutputRecord) -> Result<Self, Self::Error> {
fn try_from(value: OutputRecord) -> Result<Self, String> {
Ok(Self {
msg: value.msg?,
stream: value.stream?,
@ -317,7 +317,7 @@ pub mod types {
impl std::convert::TryFrom<PingResult> for super::PingResult {
type Error = String;
fn try_from(value: PingResult) -> Result<Self, Self::Error> {
fn try_from(value: PingResult) -> Result<Self, String> {
Ok(Self {
host: value.host?,
ok: value.ok?,
@ -388,7 +388,7 @@ pub mod types {
impl std::convert::TryFrom<ReportFinishBody> for super::ReportFinishBody {
type Error = String;
fn try_from(value: ReportFinishBody) -> Result<Self, Self::Error> {
fn try_from(value: ReportFinishBody) -> Result<Self, String> {
Ok(Self {
duration_millis: value.duration_millis?,
end_time: value.end_time?,
@ -473,7 +473,7 @@ pub mod types {
impl std::convert::TryFrom<ReportId> for super::ReportId {
type Error = String;
fn try_from(value: ReportId) -> Result<Self, Self::Error> {
fn try_from(value: ReportId) -> Result<Self, String> {
Ok(Self {
host: value.host?,
job: value.job?,
@ -523,7 +523,7 @@ pub mod types {
impl std::convert::TryFrom<ReportOutputBody> for super::ReportOutputBody {
type Error = String;
fn try_from(value: ReportOutputBody) -> Result<Self, Self::Error> {
fn try_from(value: ReportOutputBody) -> Result<Self, String> {
Ok(Self {
id: value.id?,
record: value.record?,
@ -558,7 +558,7 @@ pub mod types {
impl std::convert::TryFrom<ReportResult> for super::ReportResult {
type Error = String;
fn try_from(value: ReportResult) -> Result<Self, Self::Error> {
fn try_from(value: ReportResult) -> Result<Self, String> {
Ok(Self {
existed_already: value.existed_already?,
})
@ -616,7 +616,7 @@ pub mod types {
impl std::convert::TryFrom<ReportStartBody> for super::ReportStartBody {
type Error = String;
fn try_from(value: ReportStartBody) -> Result<Self, Self::Error> {
fn try_from(value: ReportStartBody) -> Result<Self, String> {
Ok(Self {
id: value.id?,
script: value.script?,
@ -715,7 +715,7 @@ pub mod types {
impl std::convert::TryFrom<ReportSummary> for super::ReportSummary {
type Error = String;
fn try_from(value: ReportSummary) -> Result<Self, Self::Error> {
fn try_from(value: ReportSummary) -> Result<Self, String> {
Ok(Self {
age_seconds: value.age_seconds?,
duration_seconds: value.duration_seconds?,

View File

@ -176,7 +176,7 @@ pub mod types {
impl std::convert::TryFrom<EnrolBody> for super::EnrolBody {
type Error = String;
fn try_from(value: EnrolBody) -> Result<Self, Self::Error> {
fn try_from(value: EnrolBody) -> Result<Self, String> {
Ok(Self {
host: value.host?,
key: value.key?,
@ -211,7 +211,7 @@ pub mod types {
impl std::convert::TryFrom<GlobalJobsResult> for super::GlobalJobsResult {
type Error = String;
fn try_from(value: GlobalJobsResult) -> Result<Self, Self::Error> {
fn try_from(value: GlobalJobsResult) -> Result<Self, String> {
Ok(Self {
summary: value.summary?,
})
@ -269,7 +269,7 @@ pub mod types {
impl std::convert::TryFrom<OutputRecord> for super::OutputRecord {
type Error = String;
fn try_from(value: OutputRecord) -> Result<Self, Self::Error> {
fn try_from(value: OutputRecord) -> Result<Self, String> {
Ok(Self {
msg: value.msg?,
stream: value.stream?,
@ -317,7 +317,7 @@ pub mod types {
impl std::convert::TryFrom<PingResult> for super::PingResult {
type Error = String;
fn try_from(value: PingResult) -> Result<Self, Self::Error> {
fn try_from(value: PingResult) -> Result<Self, String> {
Ok(Self {
host: value.host?,
ok: value.ok?,
@ -388,7 +388,7 @@ pub mod types {
impl std::convert::TryFrom<ReportFinishBody> for super::ReportFinishBody {
type Error = String;
fn try_from(value: ReportFinishBody) -> Result<Self, Self::Error> {
fn try_from(value: ReportFinishBody) -> Result<Self, String> {
Ok(Self {
duration_millis: value.duration_millis?,
end_time: value.end_time?,
@ -473,7 +473,7 @@ pub mod types {
impl std::convert::TryFrom<ReportId> for super::ReportId {
type Error = String;
fn try_from(value: ReportId) -> Result<Self, Self::Error> {
fn try_from(value: ReportId) -> Result<Self, String> {
Ok(Self {
host: value.host?,
job: value.job?,
@ -523,7 +523,7 @@ pub mod types {
impl std::convert::TryFrom<ReportOutputBody> for super::ReportOutputBody {
type Error = String;
fn try_from(value: ReportOutputBody) -> Result<Self, Self::Error> {
fn try_from(value: ReportOutputBody) -> Result<Self, String> {
Ok(Self {
id: value.id?,
record: value.record?,
@ -558,7 +558,7 @@ pub mod types {
impl std::convert::TryFrom<ReportResult> for super::ReportResult {
type Error = String;
fn try_from(value: ReportResult) -> Result<Self, Self::Error> {
fn try_from(value: ReportResult) -> Result<Self, String> {
Ok(Self {
existed_already: value.existed_already?,
})
@ -616,7 +616,7 @@ pub mod types {
impl std::convert::TryFrom<ReportStartBody> for super::ReportStartBody {
type Error = String;
fn try_from(value: ReportStartBody) -> Result<Self, Self::Error> {
fn try_from(value: ReportStartBody) -> Result<Self, String> {
Ok(Self {
id: value.id?,
script: value.script?,
@ -715,7 +715,7 @@ pub mod types {
impl std::convert::TryFrom<ReportSummary> for super::ReportSummary {
type Error = String;
fn try_from(value: ReportSummary) -> Result<Self, Self::Error> {
fn try_from(value: ReportSummary) -> Result<Self, String> {
Ok(Self {
age_seconds: value.age_seconds?,
duration_seconds: value.duration_seconds?,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -245,7 +245,7 @@ pub mod types {
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting),
@ -262,6 +262,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceStateMonitorRequest {
pub gen: u64,
@ -306,7 +320,7 @@ pub mod types {
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
@ -317,6 +331,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum MigrationState {
Sync,
@ -350,7 +378,7 @@ pub mod types {
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
@ -367,6 +395,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterface {
pub attachment: NetworkInterfaceAttachmentState,
@ -404,7 +446,7 @@ pub mod types {
pub struct Slot(pub u8);
impl std::ops::Deref for Slot {
type Target = u8;
fn deref(&self) -> &Self::Target {
fn deref(&self) -> &u8 {
&self.0
}
}
@ -576,7 +618,7 @@ pub mod types {
impl std::convert::TryFrom<CrucibleOpts> for super::CrucibleOpts {
type Error = String;
fn try_from(value: CrucibleOpts) -> Result<Self, Self::Error> {
fn try_from(value: CrucibleOpts) -> Result<Self, String> {
Ok(Self {
cert_pem: value.cert_pem?,
control: value.control?,
@ -643,7 +685,7 @@ pub mod types {
impl std::convert::TryFrom<DiskAttachment> for super::DiskAttachment {
type Error = String;
fn try_from(value: DiskAttachment) -> Result<Self, Self::Error> {
fn try_from(value: DiskAttachment) -> Result<Self, String> {
Ok(Self {
disk_id: value.disk_id?,
generation_id: value.generation_id?,
@ -744,7 +786,7 @@ pub mod types {
impl std::convert::TryFrom<DiskRequest> for super::DiskRequest {
type Error = String;
fn try_from(value: DiskRequest) -> Result<Self, Self::Error> {
fn try_from(value: DiskRequest) -> Result<Self, String> {
Ok(Self {
device: value.device?,
gen: value.gen?,
@ -807,7 +849,7 @@ pub mod types {
impl std::convert::TryFrom<Error> for super::Error {
type Error = String;
fn try_from(value: Error) -> Result<Self, Self::Error> {
fn try_from(value: Error) -> Result<Self, String> {
Ok(Self {
error_code: value.error_code?,
message: value.message?,
@ -879,7 +921,7 @@ pub mod types {
impl std::convert::TryFrom<Instance> for super::Instance {
type Error = String;
fn try_from(value: Instance) -> Result<Self, Self::Error> {
fn try_from(value: Instance) -> Result<Self, String> {
Ok(Self {
disks: value.disks?,
nics: value.nics?,
@ -967,7 +1009,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceEnsureRequest> for super::InstanceEnsureRequest {
type Error = String;
fn try_from(value: InstanceEnsureRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceEnsureRequest) -> Result<Self, String> {
Ok(Self {
cloud_init_bytes: value.cloud_init_bytes?,
disks: value.disks?,
@ -1005,7 +1047,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceEnsureResponse> for super::InstanceEnsureResponse {
type Error = String;
fn try_from(value: InstanceEnsureResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceEnsureResponse) -> Result<Self, String> {
Ok(Self {
migrate: value.migrate?,
})
@ -1039,7 +1081,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceGetResponse> for super::InstanceGetResponse {
type Error = String;
fn try_from(value: InstanceGetResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceGetResponse) -> Result<Self, String> {
Ok(Self {
instance: value.instance?,
})
@ -1099,7 +1141,7 @@ pub mod types {
for super::InstanceMigrateInitiateRequest
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, String> {
Ok(Self {
migration_id: value.migration_id?,
src_addr: value.src_addr?,
@ -1137,7 +1179,7 @@ pub mod types {
for super::InstanceMigrateInitiateResponse
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, String> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -1171,7 +1213,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateStatusRequest> for super::InstanceMigrateStatusRequest {
type Error = String;
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, String> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -1205,7 +1247,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateStatusResponse> for super::InstanceMigrateStatusResponse {
type Error = String;
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, String> {
Ok(Self {
state: value.state?,
})
@ -1311,7 +1353,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceProperties> for super::InstanceProperties {
type Error = String;
fn try_from(value: InstanceProperties) -> Result<Self, Self::Error> {
fn try_from(value: InstanceProperties) -> Result<Self, String> {
Ok(Self {
bootrom_id: value.bootrom_id?,
description: value.description?,
@ -1351,7 +1393,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceStateMonitorRequest> for super::InstanceStateMonitorRequest {
type Error = String;
fn try_from(value: InstanceStateMonitorRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceStateMonitorRequest) -> Result<Self, String> {
Ok(Self { gen: value.gen? })
}
}
@ -1395,7 +1437,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceStateMonitorResponse> for super::InstanceStateMonitorResponse {
type Error = String;
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, String> {
Ok(Self {
gen: value.gen?,
state: value.state?,
@ -1442,7 +1484,7 @@ pub mod types {
impl std::convert::TryFrom<NetworkInterface> for super::NetworkInterface {
type Error = String;
fn try_from(value: NetworkInterface) -> Result<Self, Self::Error> {
fn try_from(value: NetworkInterface) -> Result<Self, String> {
Ok(Self {
attachment: value.attachment?,
name: value.name?,
@ -1489,7 +1531,7 @@ pub mod types {
impl std::convert::TryFrom<NetworkInterfaceRequest> for super::NetworkInterfaceRequest {
type Error = String;
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, Self::Error> {
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, String> {
Ok(Self {
name: value.name?,
slot: value.slot?,

View File

@ -247,7 +247,7 @@ pub mod types {
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting),
@ -264,6 +264,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
pub struct InstanceStateMonitorRequest {
pub gen: u64,
@ -310,7 +324,7 @@ pub mod types {
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
@ -321,6 +335,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(
Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
)]
@ -356,7 +384,7 @@ pub mod types {
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
@ -373,6 +401,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
pub struct NetworkInterface {
pub attachment: NetworkInterfaceAttachmentState,
@ -410,7 +452,7 @@ pub mod types {
pub struct Slot(pub u8);
impl std::ops::Deref for Slot {
type Target = u8;
fn deref(&self) -> &Self::Target {
fn deref(&self) -> &u8 {
&self.0
}
}
@ -582,7 +624,7 @@ pub mod types {
impl std::convert::TryFrom<CrucibleOpts> for super::CrucibleOpts {
type Error = String;
fn try_from(value: CrucibleOpts) -> Result<Self, Self::Error> {
fn try_from(value: CrucibleOpts) -> Result<Self, String> {
Ok(Self {
cert_pem: value.cert_pem?,
control: value.control?,
@ -649,7 +691,7 @@ pub mod types {
impl std::convert::TryFrom<DiskAttachment> for super::DiskAttachment {
type Error = String;
fn try_from(value: DiskAttachment) -> Result<Self, Self::Error> {
fn try_from(value: DiskAttachment) -> Result<Self, String> {
Ok(Self {
disk_id: value.disk_id?,
generation_id: value.generation_id?,
@ -750,7 +792,7 @@ pub mod types {
impl std::convert::TryFrom<DiskRequest> for super::DiskRequest {
type Error = String;
fn try_from(value: DiskRequest) -> Result<Self, Self::Error> {
fn try_from(value: DiskRequest) -> Result<Self, String> {
Ok(Self {
device: value.device?,
gen: value.gen?,
@ -813,7 +855,7 @@ pub mod types {
impl std::convert::TryFrom<Error> for super::Error {
type Error = String;
fn try_from(value: Error) -> Result<Self, Self::Error> {
fn try_from(value: Error) -> Result<Self, String> {
Ok(Self {
error_code: value.error_code?,
message: value.message?,
@ -885,7 +927,7 @@ pub mod types {
impl std::convert::TryFrom<Instance> for super::Instance {
type Error = String;
fn try_from(value: Instance) -> Result<Self, Self::Error> {
fn try_from(value: Instance) -> Result<Self, String> {
Ok(Self {
disks: value.disks?,
nics: value.nics?,
@ -973,7 +1015,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceEnsureRequest> for super::InstanceEnsureRequest {
type Error = String;
fn try_from(value: InstanceEnsureRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceEnsureRequest) -> Result<Self, String> {
Ok(Self {
cloud_init_bytes: value.cloud_init_bytes?,
disks: value.disks?,
@ -1011,7 +1053,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceEnsureResponse> for super::InstanceEnsureResponse {
type Error = String;
fn try_from(value: InstanceEnsureResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceEnsureResponse) -> Result<Self, String> {
Ok(Self {
migrate: value.migrate?,
})
@ -1045,7 +1087,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceGetResponse> for super::InstanceGetResponse {
type Error = String;
fn try_from(value: InstanceGetResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceGetResponse) -> Result<Self, String> {
Ok(Self {
instance: value.instance?,
})
@ -1105,7 +1147,7 @@ pub mod types {
for super::InstanceMigrateInitiateRequest
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, String> {
Ok(Self {
migration_id: value.migration_id?,
src_addr: value.src_addr?,
@ -1143,7 +1185,7 @@ pub mod types {
for super::InstanceMigrateInitiateResponse
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, String> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -1177,7 +1219,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateStatusRequest> for super::InstanceMigrateStatusRequest {
type Error = String;
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, String> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -1211,7 +1253,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateStatusResponse> for super::InstanceMigrateStatusResponse {
type Error = String;
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, String> {
Ok(Self {
state: value.state?,
})
@ -1317,7 +1359,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceProperties> for super::InstanceProperties {
type Error = String;
fn try_from(value: InstanceProperties) -> Result<Self, Self::Error> {
fn try_from(value: InstanceProperties) -> Result<Self, String> {
Ok(Self {
bootrom_id: value.bootrom_id?,
description: value.description?,
@ -1357,7 +1399,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceStateMonitorRequest> for super::InstanceStateMonitorRequest {
type Error = String;
fn try_from(value: InstanceStateMonitorRequest) -> Result<Self, Self::Error> {
fn try_from(value: InstanceStateMonitorRequest) -> Result<Self, String> {
Ok(Self { gen: value.gen? })
}
}
@ -1401,7 +1443,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceStateMonitorResponse> for super::InstanceStateMonitorResponse {
type Error = String;
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, Self::Error> {
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, String> {
Ok(Self {
gen: value.gen?,
state: value.state?,
@ -1448,7 +1490,7 @@ pub mod types {
impl std::convert::TryFrom<NetworkInterface> for super::NetworkInterface {
type Error = String;
fn try_from(value: NetworkInterface) -> Result<Self, Self::Error> {
fn try_from(value: NetworkInterface) -> Result<Self, String> {
Ok(Self {
attachment: value.attachment?,
name: value.name?,
@ -1495,7 +1537,7 @@ pub mod types {
impl std::convert::TryFrom<NetworkInterfaceRequest> for super::NetworkInterfaceRequest {
type Error = String;
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, Self::Error> {
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, String> {
Ok(Self {
name: value.name?,
slot: value.slot?,

View File

@ -167,7 +167,7 @@ pub mod types {
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting),
@ -184,6 +184,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceStateMonitorRequest {
pub gen: u64,
@ -216,7 +230,7 @@ pub mod types {
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
@ -227,6 +241,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum MigrationState {
Sync,
@ -260,7 +288,7 @@ pub mod types {
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> {
fn from_str(value: &str) -> Result<Self, &'static str> {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
@ -277,6 +305,20 @@ pub mod types {
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
value.parse()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterface {
pub attachment: NetworkInterfaceAttachmentState,
@ -302,7 +344,7 @@ pub mod types {
pub struct Slot(pub u8);
impl std::ops::Deref for Slot {
type Target = u8;
fn deref(&self) -> &Self::Target {
fn deref(&self) -> &u8 {
&self.0
}
}

View File

@ -103,7 +103,7 @@ pub mod types {
impl std::convert::TryFrom<BodyWithDefaults> for super::BodyWithDefaults {
type Error = String;
fn try_from(value: BodyWithDefaults) -> Result<Self, Self::Error> {
fn try_from(value: BodyWithDefaults) -> Result<Self, String> {
Ok(Self {
forty_two: value.forty_two?,
s: value.s?,
@ -164,7 +164,7 @@ pub mod types {
impl std::convert::TryFrom<Error> for super::Error {
type Error = String;
fn try_from(value: Error) -> Result<Self, Self::Error> {
fn try_from(value: Error) -> Result<Self, String> {
Ok(Self {
error_code: value.error_code?,
message: value.message?,