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

View File

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

View File

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

View File

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

View File

@ -176,7 +176,7 @@ pub mod types {
impl std::convert::TryFrom<EnrolBody> for super::EnrolBody { impl std::convert::TryFrom<EnrolBody> for super::EnrolBody {
type Error = String; type Error = String;
fn try_from(value: EnrolBody) -> Result<Self, Self::Error> { fn try_from(value: EnrolBody) -> Result<Self, String> {
Ok(Self { Ok(Self {
host: value.host?, host: value.host?,
key: value.key?, key: value.key?,
@ -211,7 +211,7 @@ pub mod types {
impl std::convert::TryFrom<GlobalJobsResult> for super::GlobalJobsResult { impl std::convert::TryFrom<GlobalJobsResult> for super::GlobalJobsResult {
type Error = String; type Error = String;
fn try_from(value: GlobalJobsResult) -> Result<Self, Self::Error> { fn try_from(value: GlobalJobsResult) -> Result<Self, String> {
Ok(Self { Ok(Self {
summary: value.summary?, summary: value.summary?,
}) })
@ -269,7 +269,7 @@ pub mod types {
impl std::convert::TryFrom<OutputRecord> for super::OutputRecord { impl std::convert::TryFrom<OutputRecord> for super::OutputRecord {
type Error = String; type Error = String;
fn try_from(value: OutputRecord) -> Result<Self, Self::Error> { fn try_from(value: OutputRecord) -> Result<Self, String> {
Ok(Self { Ok(Self {
msg: value.msg?, msg: value.msg?,
stream: value.stream?, stream: value.stream?,
@ -317,7 +317,7 @@ pub mod types {
impl std::convert::TryFrom<PingResult> for super::PingResult { impl std::convert::TryFrom<PingResult> for super::PingResult {
type Error = String; type Error = String;
fn try_from(value: PingResult) -> Result<Self, Self::Error> { fn try_from(value: PingResult) -> Result<Self, String> {
Ok(Self { Ok(Self {
host: value.host?, host: value.host?,
ok: value.ok?, ok: value.ok?,
@ -388,7 +388,7 @@ pub mod types {
impl std::convert::TryFrom<ReportFinishBody> for super::ReportFinishBody { impl std::convert::TryFrom<ReportFinishBody> for super::ReportFinishBody {
type Error = String; type Error = String;
fn try_from(value: ReportFinishBody) -> Result<Self, Self::Error> { fn try_from(value: ReportFinishBody) -> Result<Self, String> {
Ok(Self { Ok(Self {
duration_millis: value.duration_millis?, duration_millis: value.duration_millis?,
end_time: value.end_time?, end_time: value.end_time?,
@ -473,7 +473,7 @@ pub mod types {
impl std::convert::TryFrom<ReportId> for super::ReportId { impl std::convert::TryFrom<ReportId> for super::ReportId {
type Error = String; type Error = String;
fn try_from(value: ReportId) -> Result<Self, Self::Error> { fn try_from(value: ReportId) -> Result<Self, String> {
Ok(Self { Ok(Self {
host: value.host?, host: value.host?,
job: value.job?, job: value.job?,
@ -523,7 +523,7 @@ pub mod types {
impl std::convert::TryFrom<ReportOutputBody> for super::ReportOutputBody { impl std::convert::TryFrom<ReportOutputBody> for super::ReportOutputBody {
type Error = String; type Error = String;
fn try_from(value: ReportOutputBody) -> Result<Self, Self::Error> { fn try_from(value: ReportOutputBody) -> Result<Self, String> {
Ok(Self { Ok(Self {
id: value.id?, id: value.id?,
record: value.record?, record: value.record?,
@ -558,7 +558,7 @@ pub mod types {
impl std::convert::TryFrom<ReportResult> for super::ReportResult { impl std::convert::TryFrom<ReportResult> for super::ReportResult {
type Error = String; type Error = String;
fn try_from(value: ReportResult) -> Result<Self, Self::Error> { fn try_from(value: ReportResult) -> Result<Self, String> {
Ok(Self { Ok(Self {
existed_already: value.existed_already?, existed_already: value.existed_already?,
}) })
@ -616,7 +616,7 @@ pub mod types {
impl std::convert::TryFrom<ReportStartBody> for super::ReportStartBody { impl std::convert::TryFrom<ReportStartBody> for super::ReportStartBody {
type Error = String; type Error = String;
fn try_from(value: ReportStartBody) -> Result<Self, Self::Error> { fn try_from(value: ReportStartBody) -> Result<Self, String> {
Ok(Self { Ok(Self {
id: value.id?, id: value.id?,
script: value.script?, script: value.script?,
@ -715,7 +715,7 @@ pub mod types {
impl std::convert::TryFrom<ReportSummary> for super::ReportSummary { impl std::convert::TryFrom<ReportSummary> for super::ReportSummary {
type Error = String; type Error = String;
fn try_from(value: ReportSummary) -> Result<Self, Self::Error> { fn try_from(value: ReportSummary) -> Result<Self, String> {
Ok(Self { Ok(Self {
age_seconds: value.age_seconds?, age_seconds: value.age_seconds?,
duration_seconds: value.duration_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 { impl std::str::FromStr for InstanceState {
type Err = &'static str; type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> { fn from_str(value: &str) -> Result<Self, &'static str> {
match value { match value {
"Creating" => Ok(Self::Creating), "Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting), "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)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InstanceStateMonitorRequest { pub struct InstanceStateMonitorRequest {
pub gen: u64, pub gen: u64,
@ -306,7 +320,7 @@ pub mod types {
impl std::str::FromStr for InstanceStateRequested { impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str; type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> { fn from_str(value: &str) -> Result<Self, &'static str> {
match value { match value {
"Run" => Ok(Self::Run), "Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop), "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)] #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum MigrationState { pub enum MigrationState {
Sync, Sync,
@ -350,7 +378,7 @@ pub mod types {
impl std::str::FromStr for MigrationState { impl std::str::FromStr for MigrationState {
type Err = &'static str; type Err = &'static str;
fn from_str(value: &str) -> Result<Self, Self::Err> { fn from_str(value: &str) -> Result<Self, &'static str> {
match value { match value {
"Sync" => Ok(Self::Sync), "Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush), "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)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkInterface { pub struct NetworkInterface {
pub attachment: NetworkInterfaceAttachmentState, pub attachment: NetworkInterfaceAttachmentState,
@ -404,7 +446,7 @@ pub mod types {
pub struct Slot(pub u8); pub struct Slot(pub u8);
impl std::ops::Deref for Slot { impl std::ops::Deref for Slot {
type Target = u8; type Target = u8;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &u8 {
&self.0 &self.0
} }
} }
@ -576,7 +618,7 @@ pub mod types {
impl std::convert::TryFrom<CrucibleOpts> for super::CrucibleOpts { impl std::convert::TryFrom<CrucibleOpts> for super::CrucibleOpts {
type Error = String; type Error = String;
fn try_from(value: CrucibleOpts) -> Result<Self, Self::Error> { fn try_from(value: CrucibleOpts) -> Result<Self, String> {
Ok(Self { Ok(Self {
cert_pem: value.cert_pem?, cert_pem: value.cert_pem?,
control: value.control?, control: value.control?,
@ -643,7 +685,7 @@ pub mod types {
impl std::convert::TryFrom<DiskAttachment> for super::DiskAttachment { impl std::convert::TryFrom<DiskAttachment> for super::DiskAttachment {
type Error = String; type Error = String;
fn try_from(value: DiskAttachment) -> Result<Self, Self::Error> { fn try_from(value: DiskAttachment) -> Result<Self, String> {
Ok(Self { Ok(Self {
disk_id: value.disk_id?, disk_id: value.disk_id?,
generation_id: value.generation_id?, generation_id: value.generation_id?,
@ -744,7 +786,7 @@ pub mod types {
impl std::convert::TryFrom<DiskRequest> for super::DiskRequest { impl std::convert::TryFrom<DiskRequest> for super::DiskRequest {
type Error = String; type Error = String;
fn try_from(value: DiskRequest) -> Result<Self, Self::Error> { fn try_from(value: DiskRequest) -> Result<Self, String> {
Ok(Self { Ok(Self {
device: value.device?, device: value.device?,
gen: value.gen?, gen: value.gen?,
@ -807,7 +849,7 @@ pub mod types {
impl std::convert::TryFrom<Error> for super::Error { impl std::convert::TryFrom<Error> for super::Error {
type Error = String; type Error = String;
fn try_from(value: Error) -> Result<Self, Self::Error> { fn try_from(value: Error) -> Result<Self, String> {
Ok(Self { Ok(Self {
error_code: value.error_code?, error_code: value.error_code?,
message: value.message?, message: value.message?,
@ -879,7 +921,7 @@ pub mod types {
impl std::convert::TryFrom<Instance> for super::Instance { impl std::convert::TryFrom<Instance> for super::Instance {
type Error = String; type Error = String;
fn try_from(value: Instance) -> Result<Self, Self::Error> { fn try_from(value: Instance) -> Result<Self, String> {
Ok(Self { Ok(Self {
disks: value.disks?, disks: value.disks?,
nics: value.nics?, nics: value.nics?,
@ -967,7 +1009,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceEnsureRequest> for super::InstanceEnsureRequest { impl std::convert::TryFrom<InstanceEnsureRequest> for super::InstanceEnsureRequest {
type Error = String; type Error = String;
fn try_from(value: InstanceEnsureRequest) -> Result<Self, Self::Error> { fn try_from(value: InstanceEnsureRequest) -> Result<Self, String> {
Ok(Self { Ok(Self {
cloud_init_bytes: value.cloud_init_bytes?, cloud_init_bytes: value.cloud_init_bytes?,
disks: value.disks?, disks: value.disks?,
@ -1005,7 +1047,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceEnsureResponse> for super::InstanceEnsureResponse { impl std::convert::TryFrom<InstanceEnsureResponse> for super::InstanceEnsureResponse {
type Error = String; type Error = String;
fn try_from(value: InstanceEnsureResponse) -> Result<Self, Self::Error> { fn try_from(value: InstanceEnsureResponse) -> Result<Self, String> {
Ok(Self { Ok(Self {
migrate: value.migrate?, migrate: value.migrate?,
}) })
@ -1039,7 +1081,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceGetResponse> for super::InstanceGetResponse { impl std::convert::TryFrom<InstanceGetResponse> for super::InstanceGetResponse {
type Error = String; type Error = String;
fn try_from(value: InstanceGetResponse) -> Result<Self, Self::Error> { fn try_from(value: InstanceGetResponse) -> Result<Self, String> {
Ok(Self { Ok(Self {
instance: value.instance?, instance: value.instance?,
}) })
@ -1099,7 +1141,7 @@ pub mod types {
for super::InstanceMigrateInitiateRequest for super::InstanceMigrateInitiateRequest
{ {
type Error = String; type Error = String;
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, Self::Error> { fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, String> {
Ok(Self { Ok(Self {
migration_id: value.migration_id?, migration_id: value.migration_id?,
src_addr: value.src_addr?, src_addr: value.src_addr?,
@ -1137,7 +1179,7 @@ pub mod types {
for super::InstanceMigrateInitiateResponse for super::InstanceMigrateInitiateResponse
{ {
type Error = String; type Error = String;
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, Self::Error> { fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, String> {
Ok(Self { Ok(Self {
migration_id: value.migration_id?, migration_id: value.migration_id?,
}) })
@ -1171,7 +1213,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateStatusRequest> for super::InstanceMigrateStatusRequest { impl std::convert::TryFrom<InstanceMigrateStatusRequest> for super::InstanceMigrateStatusRequest {
type Error = String; type Error = String;
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, Self::Error> { fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, String> {
Ok(Self { Ok(Self {
migration_id: value.migration_id?, migration_id: value.migration_id?,
}) })
@ -1205,7 +1247,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateStatusResponse> for super::InstanceMigrateStatusResponse { impl std::convert::TryFrom<InstanceMigrateStatusResponse> for super::InstanceMigrateStatusResponse {
type Error = String; type Error = String;
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, Self::Error> { fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, String> {
Ok(Self { Ok(Self {
state: value.state?, state: value.state?,
}) })
@ -1311,7 +1353,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceProperties> for super::InstanceProperties { impl std::convert::TryFrom<InstanceProperties> for super::InstanceProperties {
type Error = String; type Error = String;
fn try_from(value: InstanceProperties) -> Result<Self, Self::Error> { fn try_from(value: InstanceProperties) -> Result<Self, String> {
Ok(Self { Ok(Self {
bootrom_id: value.bootrom_id?, bootrom_id: value.bootrom_id?,
description: value.description?, description: value.description?,
@ -1351,7 +1393,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceStateMonitorRequest> for super::InstanceStateMonitorRequest { impl std::convert::TryFrom<InstanceStateMonitorRequest> for super::InstanceStateMonitorRequest {
type Error = String; 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? }) Ok(Self { gen: value.gen? })
} }
} }
@ -1395,7 +1437,7 @@ pub mod types {
impl std::convert::TryFrom<InstanceStateMonitorResponse> for super::InstanceStateMonitorResponse { impl std::convert::TryFrom<InstanceStateMonitorResponse> for super::InstanceStateMonitorResponse {
type Error = String; type Error = String;
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, Self::Error> { fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, String> {
Ok(Self { Ok(Self {
gen: value.gen?, gen: value.gen?,
state: value.state?, state: value.state?,
@ -1442,7 +1484,7 @@ pub mod types {
impl std::convert::TryFrom<NetworkInterface> for super::NetworkInterface { impl std::convert::TryFrom<NetworkInterface> for super::NetworkInterface {
type Error = String; type Error = String;
fn try_from(value: NetworkInterface) -> Result<Self, Self::Error> { fn try_from(value: NetworkInterface) -> Result<Self, String> {
Ok(Self { Ok(Self {
attachment: value.attachment?, attachment: value.attachment?,
name: value.name?, name: value.name?,
@ -1489,7 +1531,7 @@ pub mod types {
impl std::convert::TryFrom<NetworkInterfaceRequest> for super::NetworkInterfaceRequest { impl std::convert::TryFrom<NetworkInterfaceRequest> for super::NetworkInterfaceRequest {
type Error = String; type Error = String;
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, Self::Error> { fn try_from(value: NetworkInterfaceRequest) -> Result<Self, String> {
Ok(Self { Ok(Self {
name: value.name?, name: value.name?,
slot: value.slot?, slot: value.slot?,

View File

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

View File

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

View File

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