use body builder types in operation builders (#385)
This commit is contained in:
parent
be9492dadd
commit
d0b9842ce3
|
@ -2122,7 +2122,7 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typify"
|
name = "typify"
|
||||||
version = "0.0.12-dev"
|
version = "0.0.12-dev"
|
||||||
source = "git+https://github.com/oxidecomputer/typify#44f52879905a135d37ed06aaf87dbd9df5d72b2f"
|
source = "git+https://github.com/oxidecomputer/typify#3cda314def8e95043f45c172cfb8851e391ef7ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"typify-impl",
|
"typify-impl",
|
||||||
"typify-macro",
|
"typify-macro",
|
||||||
|
@ -2131,7 +2131,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typify-impl"
|
name = "typify-impl"
|
||||||
version = "0.0.12-dev"
|
version = "0.0.12-dev"
|
||||||
source = "git+https://github.com/oxidecomputer/typify#44f52879905a135d37ed06aaf87dbd9df5d72b2f"
|
source = "git+https://github.com/oxidecomputer/typify#3cda314def8e95043f45c172cfb8851e391ef7ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"log",
|
"log",
|
||||||
|
@ -2148,7 +2148,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typify-macro"
|
name = "typify-macro"
|
||||||
version = "0.0.12-dev"
|
version = "0.0.12-dev"
|
||||||
source = "git+https://github.com/oxidecomputer/typify#44f52879905a135d37ed06aaf87dbd9df5d72b2f"
|
source = "git+https://github.com/oxidecomputer/typify#3cda314def8e95043f45c172cfb8851e391ef7ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -1357,9 +1357,20 @@ impl Generator {
|
||||||
.map(|param| match ¶m.typ {
|
.map(|param| match ¶m.typ {
|
||||||
OperationParameterType::Type(type_id) => {
|
OperationParameterType::Type(type_id) => {
|
||||||
let ty = self.type_space.get_type(type_id)?;
|
let ty = self.type_space.get_type(type_id)?;
|
||||||
|
|
||||||
|
// For body parameters only, if there's a builder we'll
|
||||||
|
// nest that within this builder.
|
||||||
|
if let (
|
||||||
|
OperationParameterKind::Body(_),
|
||||||
|
Some(builder_name),
|
||||||
|
) = (¶m.kind, ty.builder())
|
||||||
|
{
|
||||||
|
Ok(quote! { Result<#builder_name, String> })
|
||||||
|
} else {
|
||||||
let t = ty.ident();
|
let t = ty.ident();
|
||||||
Ok(quote! { Result<#t, String> })
|
Ok(quote! { Result<#t, String> })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OperationParameterType::RawBody => {
|
OperationParameterType::RawBody => {
|
||||||
cloneable = false;
|
cloneable = false;
|
||||||
|
@ -1372,24 +1383,52 @@ impl Generator {
|
||||||
let param_values = method
|
let param_values = method
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.map(|param| {
|
.map(|param| match ¶m.typ {
|
||||||
let opt = match ¶m.typ {
|
|
||||||
OperationParameterType::Type(type_id) => {
|
OperationParameterType::Type(type_id) => {
|
||||||
let ty = self.type_space.get_type(type_id)?;
|
let ty = self.type_space.get_type(type_id)?;
|
||||||
let details = ty.details();
|
let details = ty.details();
|
||||||
matches!(&details, typify::TypeDetails::Option(_))
|
let optional =
|
||||||
}
|
matches!(&details, typify::TypeDetails::Option(_));
|
||||||
OperationParameterType::RawBody => false,
|
if optional {
|
||||||
};
|
|
||||||
if opt {
|
|
||||||
Ok(quote! { Ok(None) })
|
Ok(quote! { Ok(None) })
|
||||||
|
} else if let (
|
||||||
|
OperationParameterKind::Body(_),
|
||||||
|
Some(builder_name),
|
||||||
|
) = (¶m.kind, ty.builder())
|
||||||
|
{
|
||||||
|
Ok(quote! { Ok(#builder_name :: default()) })
|
||||||
} else {
|
} else {
|
||||||
|
let err_msg =
|
||||||
|
format!("{} was not initialized", param.name);
|
||||||
|
Ok(quote! { Err(#err_msg.to_string()) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OperationParameterType::RawBody => {
|
||||||
let err_msg = format!("{} was not initialized", param.name);
|
let err_msg = format!("{} was not initialized", param.name);
|
||||||
Ok(quote! { Err(#err_msg.to_string()) })
|
Ok(quote! { Err(#err_msg.to_string()) })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect::<Result<Vec<_>>>()?;
|
.collect::<Result<Vec<_>>>()?;
|
||||||
|
|
||||||
|
let param_xxx = method
|
||||||
|
.params
|
||||||
|
.iter()
|
||||||
|
.map(|param| match ¶m.typ {
|
||||||
|
OperationParameterType::Type(type_id) => {
|
||||||
|
let ty = self.type_space.get_type(type_id)?;
|
||||||
|
if let Some(_) = ty.builder() {
|
||||||
|
let type_name = ty.ident();
|
||||||
|
Ok(quote! {
|
||||||
|
.and_then(#type_name :: try_from)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok(quote! {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OperationParameterType::RawBody => Ok(quote! {}),
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<_>>>()?;
|
||||||
|
|
||||||
// For each parameter, we need an impl for the builder to let consumers
|
// For each parameter, we need an impl for the builder to let consumers
|
||||||
// provide a value.
|
// provide a value.
|
||||||
let param_impls = method
|
let param_impls = method
|
||||||
|
@ -1401,8 +1440,13 @@ impl Generator {
|
||||||
OperationParameterType::Type(type_id) => {
|
OperationParameterType::Type(type_id) => {
|
||||||
let ty = self.type_space.get_type(type_id)?;
|
let ty = self.type_space.get_type(type_id)?;
|
||||||
let details = ty.details();
|
let details = ty.details();
|
||||||
match &details {
|
match (&details, ty.builder()) {
|
||||||
typify::TypeDetails::Option(opt_id) => {
|
// TODO right now optional body paramters are not
|
||||||
|
// addressed
|
||||||
|
(typify::TypeDetails::Option(_), Some(_)) => {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
(typify::TypeDetails::Option(opt_id), None) => {
|
||||||
// TODO currently we explicitly turn optional
|
// TODO currently we explicitly turn optional
|
||||||
// parameters into Option types; we could
|
// parameters into Option types; we could
|
||||||
// probably defer this to the code generation
|
// probably defer this to the code generation
|
||||||
|
@ -1429,7 +1473,7 @@ impl Generator {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => {
|
(_, None) => {
|
||||||
let typ = ty.ident();
|
let typ = ty.ident();
|
||||||
let err_msg = format!(
|
let err_msg = format!(
|
||||||
"conversion to `{}` for {} failed",
|
"conversion to `{}` for {} failed",
|
||||||
|
@ -1449,6 +1493,35 @@ impl Generator {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
(_, Some(builder_name)) => {
|
||||||
|
assert_eq!(param.name, "body");
|
||||||
|
let typ = ty.ident();
|
||||||
|
let err_msg = format!(
|
||||||
|
"conversion to `{}` for {} failed",
|
||||||
|
ty.name(),
|
||||||
|
param.name,
|
||||||
|
);
|
||||||
|
Ok(quote! {
|
||||||
|
pub fn body<V>(mut self, value: V) -> Self
|
||||||
|
where
|
||||||
|
V: std::convert::TryInto<#typ>,
|
||||||
|
{
|
||||||
|
self.body = value.try_into()
|
||||||
|
.map(From::from)
|
||||||
|
.map_err(|_| #err_msg.to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(#builder_name)
|
||||||
|
-> #builder_name,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,6 +1556,35 @@ impl Generator {
|
||||||
method.method.as_str().to_ascii_uppercase(),
|
method.method.as_str().to_ascii_uppercase(),
|
||||||
method.path.to_string(),
|
method.path.to_string(),
|
||||||
);
|
);
|
||||||
|
let send_impl = quote! {
|
||||||
|
#[doc = #send_doc]
|
||||||
|
pub async fn send(self) -> Result<
|
||||||
|
ResponseValue<#success>,
|
||||||
|
Error<#error>,
|
||||||
|
> {
|
||||||
|
// Destructure the builder for convenience.
|
||||||
|
let Self {
|
||||||
|
client,
|
||||||
|
#( #param_names, )*
|
||||||
|
} = self;
|
||||||
|
|
||||||
|
// Extract parameters into variables, returning an error if
|
||||||
|
// a value has not been provided or there was a conversion
|
||||||
|
// error.
|
||||||
|
//
|
||||||
|
// TODO we could do something a bit nicer by collecting all
|
||||||
|
// errors rather than just reporting the first one.
|
||||||
|
#(
|
||||||
|
let #param_names =
|
||||||
|
#param_names
|
||||||
|
#param_xxx
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
|
)*
|
||||||
|
|
||||||
|
// Do the work.
|
||||||
|
#body
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let stream_impl = method.dropshot_paginated.as_ref().map(|page_data| {
|
let stream_impl = method.dropshot_paginated.as_ref().map(|page_data| {
|
||||||
// We're now using futures.
|
// We're now using futures.
|
||||||
|
@ -1668,33 +1770,7 @@ impl Generator {
|
||||||
}
|
}
|
||||||
|
|
||||||
#( #param_impls )*
|
#( #param_impls )*
|
||||||
|
#send_impl
|
||||||
#[doc = #send_doc]
|
|
||||||
pub async fn send(self) -> Result<
|
|
||||||
ResponseValue<#success>,
|
|
||||||
Error<#error>,
|
|
||||||
> {
|
|
||||||
// Destructure the builder for convenience.
|
|
||||||
let Self {
|
|
||||||
client,
|
|
||||||
#( #param_names, )*
|
|
||||||
} = self;
|
|
||||||
|
|
||||||
// Extract parameters into variables, returning an error if
|
|
||||||
// a value has not been provided or there was a conversion
|
|
||||||
// error.
|
|
||||||
//
|
|
||||||
// TODO we could do something a bit nicer by collecting all
|
|
||||||
// errors rather than just reporting the first one.
|
|
||||||
#(
|
|
||||||
let #param_names =
|
|
||||||
#param_names.map_err(Error::InvalidRequest)?;
|
|
||||||
)*
|
|
||||||
|
|
||||||
// Do the work.
|
|
||||||
#body
|
|
||||||
}
|
|
||||||
|
|
||||||
#stream_impl
|
#stream_impl
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -363,7 +363,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Task {
|
pub struct Task {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -462,6 +463,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskEvent {
|
pub struct TaskEvent {
|
||||||
payload: Result<String, String>,
|
payload: Result<String, String>,
|
||||||
seq: Result<u32, String>,
|
seq: Result<u32, String>,
|
||||||
|
@ -546,6 +548,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskOutput {
|
pub struct TaskOutput {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
path: Result<String, String>,
|
path: Result<String, String>,
|
||||||
|
@ -616,6 +619,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskSubmit {
|
pub struct TaskSubmit {
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
output_rules: Result<Vec<String>, String>,
|
output_rules: Result<Vec<String>, String>,
|
||||||
|
@ -686,6 +690,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskSubmitResult {
|
pub struct TaskSubmitResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -724,6 +729,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct UploadedChunk {
|
pub struct UploadedChunk {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -762,6 +768,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct UserCreate {
|
pub struct UserCreate {
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -802,6 +809,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct UserCreateResult {
|
pub struct UserCreateResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -872,6 +880,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WhoamiResult {
|
pub struct WhoamiResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -928,6 +937,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Worker {
|
pub struct Worker {
|
||||||
deleted: Result<bool, String>,
|
deleted: Result<bool, String>,
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
|
@ -1040,6 +1050,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerAddOutput {
|
pub struct WorkerAddOutput {
|
||||||
chunks: Result<Vec<String>, String>,
|
chunks: Result<Vec<String>, String>,
|
||||||
path: Result<String, String>,
|
path: Result<String, String>,
|
||||||
|
@ -1110,6 +1121,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerAppendTask {
|
pub struct WorkerAppendTask {
|
||||||
payload: Result<String, String>,
|
payload: Result<String, String>,
|
||||||
stream: Result<String, String>,
|
stream: Result<String, String>,
|
||||||
|
@ -1180,6 +1192,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerBootstrap {
|
pub struct WorkerBootstrap {
|
||||||
bootstrap: Result<String, String>,
|
bootstrap: Result<String, String>,
|
||||||
token: Result<String, String>,
|
token: Result<String, String>,
|
||||||
|
@ -1236,6 +1249,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerBootstrapResult {
|
pub struct WorkerBootstrapResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -1274,6 +1288,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerCompleteTask {
|
pub struct WorkerCompleteTask {
|
||||||
failed: Result<bool, String>,
|
failed: Result<bool, String>,
|
||||||
}
|
}
|
||||||
|
@ -1316,6 +1331,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerPingResult {
|
pub struct WorkerPingResult {
|
||||||
poweroff: Result<bool, String>,
|
poweroff: Result<bool, String>,
|
||||||
task: Result<Option<super::WorkerPingTask>, String>,
|
task: Result<Option<super::WorkerPingTask>, String>,
|
||||||
|
@ -1372,6 +1388,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerPingTask {
|
pub struct WorkerPingTask {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
output_rules: Result<Vec<String>, String>,
|
output_rules: Result<Vec<String>, String>,
|
||||||
|
@ -1442,6 +1459,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerTask {
|
pub struct WorkerTask {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -1512,6 +1530,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkersResult {
|
pub struct WorkersResult {
|
||||||
workers: Result<Vec<super::Worker>, String>,
|
workers: Result<Vec<super::Worker>, String>,
|
||||||
}
|
}
|
||||||
|
@ -1959,14 +1978,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TaskSubmit<'a> {
|
pub struct TaskSubmit<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::TaskSubmit, String>,
|
body: Result<types::builder::TaskSubmit, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TaskSubmit<'a> {
|
impl<'a> TaskSubmit<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::TaskSubmit::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1976,14 +1995,25 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `TaskSubmit` for body failed".to_string());
|
.map_err(|_| "conversion to `TaskSubmit` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::TaskSubmit) -> types::builder::TaskSubmit,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/tasks`
|
///Sends a `POST` request to `/v1/tasks`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::TaskSubmit::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/v1/tasks", client.baseurl,);
|
let url = format!("{}/v1/tasks", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2179,14 +2209,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct UserCreate<'a> {
|
pub struct UserCreate<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::UserCreate, String>,
|
body: Result<types::builder::UserCreate, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UserCreate<'a> {
|
impl<'a> UserCreate<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::UserCreate::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2196,14 +2226,25 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `UserCreate` for body failed".to_string());
|
.map_err(|_| "conversion to `UserCreate` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::UserCreate) -> types::builder::UserCreate,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/users`
|
///Sends a `POST` request to `/v1/users`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::UserCreate::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/v1/users", client.baseurl,);
|
let url = format!("{}/v1/users", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2248,14 +2289,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct WorkerBootstrap<'a> {
|
pub struct WorkerBootstrap<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::WorkerBootstrap, String>,
|
body: Result<types::builder::WorkerBootstrap, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerBootstrap<'a> {
|
impl<'a> WorkerBootstrap<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerBootstrap::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2265,14 +2306,25 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerBootstrap` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerBootstrap` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::WorkerBootstrap) -> types::builder::WorkerBootstrap,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/bootstrap`
|
///Sends a `POST` request to `/v1/worker/bootstrap`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerBootstrap::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
|
let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2318,7 +2370,7 @@ pub mod builder {
|
||||||
pub struct WorkerTaskAppend<'a> {
|
pub struct WorkerTaskAppend<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
task: Result<String, String>,
|
task: Result<String, String>,
|
||||||
body: Result<types::WorkerAppendTask, String>,
|
body: Result<types::builder::WorkerAppendTask, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerTaskAppend<'a> {
|
impl<'a> WorkerTaskAppend<'a> {
|
||||||
|
@ -2326,7 +2378,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
task: Err("task was not initialized".to_string()),
|
task: Err("task was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerAppendTask::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2346,15 +2398,28 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerAppendTask` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerAppendTask` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::WorkerAppendTask,
|
||||||
|
) -> types::builder::WorkerAppendTask,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/task/{task}/append`
|
///Sends a `POST` request to `/v1/worker/task/{task}/append`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self { client, task, body } = self;
|
let Self { client, task, body } = self;
|
||||||
let task = task.map_err(Error::InvalidRequest)?;
|
let task = task.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerAppendTask::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/v1/worker/task/{}/append",
|
"{}/v1/worker/task/{}/append",
|
||||||
client.baseurl,
|
client.baseurl,
|
||||||
|
@ -2444,7 +2509,7 @@ pub mod builder {
|
||||||
pub struct WorkerTaskComplete<'a> {
|
pub struct WorkerTaskComplete<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
task: Result<String, String>,
|
task: Result<String, String>,
|
||||||
body: Result<types::WorkerCompleteTask, String>,
|
body: Result<types::builder::WorkerCompleteTask, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerTaskComplete<'a> {
|
impl<'a> WorkerTaskComplete<'a> {
|
||||||
|
@ -2452,7 +2517,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
task: Err("task was not initialized".to_string()),
|
task: Err("task was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerCompleteTask::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2472,15 +2537,28 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerCompleteTask` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerCompleteTask` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::WorkerCompleteTask,
|
||||||
|
) -> types::builder::WorkerCompleteTask,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/task/{task}/complete`
|
///Sends a `POST` request to `/v1/worker/task/{task}/complete`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self { client, task, body } = self;
|
let Self { client, task, body } = self;
|
||||||
let task = task.map_err(Error::InvalidRequest)?;
|
let task = task.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerCompleteTask::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/v1/worker/task/{}/complete",
|
"{}/v1/worker/task/{}/complete",
|
||||||
client.baseurl,
|
client.baseurl,
|
||||||
|
@ -2503,7 +2581,7 @@ pub mod builder {
|
||||||
pub struct WorkerTaskAddOutput<'a> {
|
pub struct WorkerTaskAddOutput<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
task: Result<String, String>,
|
task: Result<String, String>,
|
||||||
body: Result<types::WorkerAddOutput, String>,
|
body: Result<types::builder::WorkerAddOutput, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerTaskAddOutput<'a> {
|
impl<'a> WorkerTaskAddOutput<'a> {
|
||||||
|
@ -2511,7 +2589,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
task: Err("task was not initialized".to_string()),
|
task: Err("task was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerAddOutput::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2531,15 +2609,26 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerAddOutput` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerAddOutput` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::WorkerAddOutput) -> types::builder::WorkerAddOutput,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/task/{task}/output`
|
///Sends a `POST` request to `/v1/worker/task/{task}/output`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self { client, task, body } = self;
|
let Self { client, task, body } = self;
|
||||||
let task = task.map_err(Error::InvalidRequest)?;
|
let task = task.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerAddOutput::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/v1/worker/task/{}/output",
|
"{}/v1/worker/task/{}/output",
|
||||||
client.baseurl,
|
client.baseurl,
|
||||||
|
|
|
@ -363,7 +363,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Task {
|
pub struct Task {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -462,6 +463,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskEvent {
|
pub struct TaskEvent {
|
||||||
payload: Result<String, String>,
|
payload: Result<String, String>,
|
||||||
seq: Result<u32, String>,
|
seq: Result<u32, String>,
|
||||||
|
@ -546,6 +548,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskOutput {
|
pub struct TaskOutput {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
path: Result<String, String>,
|
path: Result<String, String>,
|
||||||
|
@ -616,6 +619,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskSubmit {
|
pub struct TaskSubmit {
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
output_rules: Result<Vec<String>, String>,
|
output_rules: Result<Vec<String>, String>,
|
||||||
|
@ -686,6 +690,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TaskSubmitResult {
|
pub struct TaskSubmitResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -724,6 +729,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct UploadedChunk {
|
pub struct UploadedChunk {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -762,6 +768,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct UserCreate {
|
pub struct UserCreate {
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -802,6 +809,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct UserCreateResult {
|
pub struct UserCreateResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -872,6 +880,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WhoamiResult {
|
pub struct WhoamiResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -928,6 +937,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Worker {
|
pub struct Worker {
|
||||||
deleted: Result<bool, String>,
|
deleted: Result<bool, String>,
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
|
@ -1040,6 +1050,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerAddOutput {
|
pub struct WorkerAddOutput {
|
||||||
chunks: Result<Vec<String>, String>,
|
chunks: Result<Vec<String>, String>,
|
||||||
path: Result<String, String>,
|
path: Result<String, String>,
|
||||||
|
@ -1110,6 +1121,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerAppendTask {
|
pub struct WorkerAppendTask {
|
||||||
payload: Result<String, String>,
|
payload: Result<String, String>,
|
||||||
stream: Result<String, String>,
|
stream: Result<String, String>,
|
||||||
|
@ -1180,6 +1192,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerBootstrap {
|
pub struct WorkerBootstrap {
|
||||||
bootstrap: Result<String, String>,
|
bootstrap: Result<String, String>,
|
||||||
token: Result<String, String>,
|
token: Result<String, String>,
|
||||||
|
@ -1236,6 +1249,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerBootstrapResult {
|
pub struct WorkerBootstrapResult {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
}
|
}
|
||||||
|
@ -1274,6 +1288,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerCompleteTask {
|
pub struct WorkerCompleteTask {
|
||||||
failed: Result<bool, String>,
|
failed: Result<bool, String>,
|
||||||
}
|
}
|
||||||
|
@ -1316,6 +1331,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerPingResult {
|
pub struct WorkerPingResult {
|
||||||
poweroff: Result<bool, String>,
|
poweroff: Result<bool, String>,
|
||||||
task: Result<Option<super::WorkerPingTask>, String>,
|
task: Result<Option<super::WorkerPingTask>, String>,
|
||||||
|
@ -1372,6 +1388,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerPingTask {
|
pub struct WorkerPingTask {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
output_rules: Result<Vec<String>, String>,
|
output_rules: Result<Vec<String>, String>,
|
||||||
|
@ -1442,6 +1459,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkerTask {
|
pub struct WorkerTask {
|
||||||
id: Result<String, String>,
|
id: Result<String, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -1512,6 +1530,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct WorkersResult {
|
pub struct WorkersResult {
|
||||||
workers: Result<Vec<super::Worker>, String>,
|
workers: Result<Vec<super::Worker>, String>,
|
||||||
}
|
}
|
||||||
|
@ -1959,14 +1978,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TaskSubmit<'a> {
|
pub struct TaskSubmit<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::TaskSubmit, String>,
|
body: Result<types::builder::TaskSubmit, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TaskSubmit<'a> {
|
impl<'a> TaskSubmit<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::TaskSubmit::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1976,14 +1995,25 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `TaskSubmit` for body failed".to_string());
|
.map_err(|_| "conversion to `TaskSubmit` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::TaskSubmit) -> types::builder::TaskSubmit,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/tasks`
|
///Sends a `POST` request to `/v1/tasks`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::TaskSubmit::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/v1/tasks", client.baseurl,);
|
let url = format!("{}/v1/tasks", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2179,14 +2209,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct UserCreate<'a> {
|
pub struct UserCreate<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::UserCreate, String>,
|
body: Result<types::builder::UserCreate, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UserCreate<'a> {
|
impl<'a> UserCreate<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::UserCreate::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2196,14 +2226,25 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `UserCreate` for body failed".to_string());
|
.map_err(|_| "conversion to `UserCreate` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::UserCreate) -> types::builder::UserCreate,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/users`
|
///Sends a `POST` request to `/v1/users`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::UserCreate::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/v1/users", client.baseurl,);
|
let url = format!("{}/v1/users", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2248,14 +2289,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct WorkerBootstrap<'a> {
|
pub struct WorkerBootstrap<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::WorkerBootstrap, String>,
|
body: Result<types::builder::WorkerBootstrap, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerBootstrap<'a> {
|
impl<'a> WorkerBootstrap<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerBootstrap::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2265,14 +2306,25 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerBootstrap` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerBootstrap` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::WorkerBootstrap) -> types::builder::WorkerBootstrap,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/bootstrap`
|
///Sends a `POST` request to `/v1/worker/bootstrap`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerBootstrap::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
|
let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2318,7 +2370,7 @@ pub mod builder {
|
||||||
pub struct WorkerTaskAppend<'a> {
|
pub struct WorkerTaskAppend<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
task: Result<String, String>,
|
task: Result<String, String>,
|
||||||
body: Result<types::WorkerAppendTask, String>,
|
body: Result<types::builder::WorkerAppendTask, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerTaskAppend<'a> {
|
impl<'a> WorkerTaskAppend<'a> {
|
||||||
|
@ -2326,7 +2378,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
task: Err("task was not initialized".to_string()),
|
task: Err("task was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerAppendTask::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2346,15 +2398,28 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerAppendTask` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerAppendTask` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::WorkerAppendTask,
|
||||||
|
) -> types::builder::WorkerAppendTask,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/task/{task}/append`
|
///Sends a `POST` request to `/v1/worker/task/{task}/append`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self { client, task, body } = self;
|
let Self { client, task, body } = self;
|
||||||
let task = task.map_err(Error::InvalidRequest)?;
|
let task = task.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerAppendTask::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/v1/worker/task/{}/append",
|
"{}/v1/worker/task/{}/append",
|
||||||
client.baseurl,
|
client.baseurl,
|
||||||
|
@ -2444,7 +2509,7 @@ pub mod builder {
|
||||||
pub struct WorkerTaskComplete<'a> {
|
pub struct WorkerTaskComplete<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
task: Result<String, String>,
|
task: Result<String, String>,
|
||||||
body: Result<types::WorkerCompleteTask, String>,
|
body: Result<types::builder::WorkerCompleteTask, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerTaskComplete<'a> {
|
impl<'a> WorkerTaskComplete<'a> {
|
||||||
|
@ -2452,7 +2517,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
task: Err("task was not initialized".to_string()),
|
task: Err("task was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerCompleteTask::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2472,15 +2537,28 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerCompleteTask` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerCompleteTask` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::WorkerCompleteTask,
|
||||||
|
) -> types::builder::WorkerCompleteTask,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/task/{task}/complete`
|
///Sends a `POST` request to `/v1/worker/task/{task}/complete`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self { client, task, body } = self;
|
let Self { client, task, body } = self;
|
||||||
let task = task.map_err(Error::InvalidRequest)?;
|
let task = task.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerCompleteTask::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/v1/worker/task/{}/complete",
|
"{}/v1/worker/task/{}/complete",
|
||||||
client.baseurl,
|
client.baseurl,
|
||||||
|
@ -2503,7 +2581,7 @@ pub mod builder {
|
||||||
pub struct WorkerTaskAddOutput<'a> {
|
pub struct WorkerTaskAddOutput<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
task: Result<String, String>,
|
task: Result<String, String>,
|
||||||
body: Result<types::WorkerAddOutput, String>,
|
body: Result<types::builder::WorkerAddOutput, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerTaskAddOutput<'a> {
|
impl<'a> WorkerTaskAddOutput<'a> {
|
||||||
|
@ -2511,7 +2589,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
task: Err("task was not initialized".to_string()),
|
task: Err("task was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::WorkerAddOutput::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2531,15 +2609,26 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `WorkerAddOutput` for body failed".to_string());
|
.map_err(|_| "conversion to `WorkerAddOutput` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::WorkerAddOutput) -> types::builder::WorkerAddOutput,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/v1/worker/task/{task}/output`
|
///Sends a `POST` request to `/v1/worker/task/{task}/output`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self { client, task, body } = self;
|
let Self { client, task, body } = self;
|
||||||
let task = task.map_err(Error::InvalidRequest)?;
|
let task = task.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::WorkerAddOutput::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/v1/worker/task/{}/output",
|
"{}/v1/worker/task/{}/output",
|
||||||
client.baseurl,
|
client.baseurl,
|
||||||
|
|
|
@ -196,7 +196,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct EnrolBody {
|
pub struct EnrolBody {
|
||||||
host: Result<String, String>,
|
host: Result<String, String>,
|
||||||
key: Result<String, String>,
|
key: Result<String, String>,
|
||||||
|
@ -253,6 +254,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct GlobalJobsResult {
|
pub struct GlobalJobsResult {
|
||||||
summary: Result<Vec<super::ReportSummary>, String>,
|
summary: Result<Vec<super::ReportSummary>, String>,
|
||||||
}
|
}
|
||||||
|
@ -295,6 +297,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct OutputRecord {
|
pub struct OutputRecord {
|
||||||
msg: Result<String, String>,
|
msg: Result<String, String>,
|
||||||
stream: Result<String, String>,
|
stream: Result<String, String>,
|
||||||
|
@ -365,6 +368,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct PingResult {
|
pub struct PingResult {
|
||||||
host: Result<String, String>,
|
host: Result<String, String>,
|
||||||
ok: Result<bool, String>,
|
ok: Result<bool, String>,
|
||||||
|
@ -421,6 +425,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportFinishBody {
|
pub struct ReportFinishBody {
|
||||||
duration_millis: Result<i32, String>,
|
duration_millis: Result<i32, String>,
|
||||||
end_time: Result<chrono::DateTime<chrono::offset::Utc>, String>,
|
end_time: Result<chrono::DateTime<chrono::offset::Utc>, String>,
|
||||||
|
@ -505,6 +510,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportId {
|
pub struct ReportId {
|
||||||
host: Result<String, String>,
|
host: Result<String, String>,
|
||||||
job: Result<String, String>,
|
job: Result<String, String>,
|
||||||
|
@ -603,6 +609,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportOutputBody {
|
pub struct ReportOutputBody {
|
||||||
id: Result<super::ReportId, String>,
|
id: Result<super::ReportId, String>,
|
||||||
record: Result<super::OutputRecord, String>,
|
record: Result<super::OutputRecord, String>,
|
||||||
|
@ -659,6 +666,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportResult {
|
pub struct ReportResult {
|
||||||
existed_already: Result<bool, String>,
|
existed_already: Result<bool, String>,
|
||||||
}
|
}
|
||||||
|
@ -701,6 +709,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportStartBody {
|
pub struct ReportStartBody {
|
||||||
id: Result<super::ReportId, String>,
|
id: Result<super::ReportId, String>,
|
||||||
script: Result<String, String>,
|
script: Result<String, String>,
|
||||||
|
@ -771,6 +780,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportSummary {
|
pub struct ReportSummary {
|
||||||
age_seconds: Result<i32, String>,
|
age_seconds: Result<i32, String>,
|
||||||
duration_seconds: Result<i32, String>,
|
duration_seconds: Result<i32, String>,
|
||||||
|
@ -1044,7 +1054,7 @@ pub mod builder {
|
||||||
pub struct Enrol<'a> {
|
pub struct Enrol<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::EnrolBody, String>,
|
body: Result<types::builder::EnrolBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Enrol<'a> {
|
impl<'a> Enrol<'a> {
|
||||||
|
@ -1052,7 +1062,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::EnrolBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,10 +1082,19 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `EnrolBody` for body failed".to_string());
|
.map_err(|_| "conversion to `EnrolBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::EnrolBody) -> types::builder::EnrolBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/enrol`
|
///Sends a `POST` request to `/enrol`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1084,7 +1103,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::EnrolBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/enrol", client.baseurl,);
|
let url = format!("{}/enrol", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
@ -1204,7 +1225,7 @@ pub mod builder {
|
||||||
pub struct ReportFinish<'a> {
|
pub struct ReportFinish<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::ReportFinishBody, String>,
|
body: Result<types::builder::ReportFinishBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReportFinish<'a> {
|
impl<'a> ReportFinish<'a> {
|
||||||
|
@ -1212,7 +1233,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::ReportFinishBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1232,10 +1253,21 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `ReportFinishBody` for body failed".to_string());
|
.map_err(|_| "conversion to `ReportFinishBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::ReportFinishBody,
|
||||||
|
) -> types::builder::ReportFinishBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/report/finish`
|
///Sends a `POST` request to `/report/finish`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1244,7 +1276,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::ReportFinishBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/report/finish", client.baseurl,);
|
let url = format!("{}/report/finish", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
@ -1270,7 +1304,7 @@ pub mod builder {
|
||||||
pub struct ReportOutput<'a> {
|
pub struct ReportOutput<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::ReportOutputBody, String>,
|
body: Result<types::builder::ReportOutputBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReportOutput<'a> {
|
impl<'a> ReportOutput<'a> {
|
||||||
|
@ -1278,7 +1312,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::ReportOutputBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,10 +1332,21 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `ReportOutputBody` for body failed".to_string());
|
.map_err(|_| "conversion to `ReportOutputBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::ReportOutputBody,
|
||||||
|
) -> types::builder::ReportOutputBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/report/output`
|
///Sends a `POST` request to `/report/output`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1310,7 +1355,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::ReportOutputBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/report/output", client.baseurl,);
|
let url = format!("{}/report/output", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
@ -1336,7 +1383,7 @@ pub mod builder {
|
||||||
pub struct ReportStart<'a> {
|
pub struct ReportStart<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::ReportStartBody, String>,
|
body: Result<types::builder::ReportStartBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReportStart<'a> {
|
impl<'a> ReportStart<'a> {
|
||||||
|
@ -1344,7 +1391,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::ReportStartBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1364,10 +1411,19 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `ReportStartBody` for body failed".to_string());
|
.map_err(|_| "conversion to `ReportStartBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::ReportStartBody) -> types::builder::ReportStartBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/report/start`
|
///Sends a `POST` request to `/report/start`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1376,7 +1432,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::ReportStartBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/report/start", client.baseurl,);
|
let url = format!("{}/report/start", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
|
|
@ -196,7 +196,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct EnrolBody {
|
pub struct EnrolBody {
|
||||||
host: Result<String, String>,
|
host: Result<String, String>,
|
||||||
key: Result<String, String>,
|
key: Result<String, String>,
|
||||||
|
@ -253,6 +254,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct GlobalJobsResult {
|
pub struct GlobalJobsResult {
|
||||||
summary: Result<Vec<super::ReportSummary>, String>,
|
summary: Result<Vec<super::ReportSummary>, String>,
|
||||||
}
|
}
|
||||||
|
@ -295,6 +297,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct OutputRecord {
|
pub struct OutputRecord {
|
||||||
msg: Result<String, String>,
|
msg: Result<String, String>,
|
||||||
stream: Result<String, String>,
|
stream: Result<String, String>,
|
||||||
|
@ -365,6 +368,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct PingResult {
|
pub struct PingResult {
|
||||||
host: Result<String, String>,
|
host: Result<String, String>,
|
||||||
ok: Result<bool, String>,
|
ok: Result<bool, String>,
|
||||||
|
@ -421,6 +425,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportFinishBody {
|
pub struct ReportFinishBody {
|
||||||
duration_millis: Result<usize, String>,
|
duration_millis: Result<usize, String>,
|
||||||
end_time: Result<chrono::DateTime<chrono::offset::Utc>, String>,
|
end_time: Result<chrono::DateTime<chrono::offset::Utc>, String>,
|
||||||
|
@ -505,6 +510,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportId {
|
pub struct ReportId {
|
||||||
host: Result<String, String>,
|
host: Result<String, String>,
|
||||||
job: Result<String, String>,
|
job: Result<String, String>,
|
||||||
|
@ -603,6 +609,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportOutputBody {
|
pub struct ReportOutputBody {
|
||||||
id: Result<super::ReportId, String>,
|
id: Result<super::ReportId, String>,
|
||||||
record: Result<super::OutputRecord, String>,
|
record: Result<super::OutputRecord, String>,
|
||||||
|
@ -659,6 +666,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportResult {
|
pub struct ReportResult {
|
||||||
existed_already: Result<bool, String>,
|
existed_already: Result<bool, String>,
|
||||||
}
|
}
|
||||||
|
@ -701,6 +709,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportStartBody {
|
pub struct ReportStartBody {
|
||||||
id: Result<super::ReportId, String>,
|
id: Result<super::ReportId, String>,
|
||||||
script: Result<String, String>,
|
script: Result<String, String>,
|
||||||
|
@ -771,6 +780,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct ReportSummary {
|
pub struct ReportSummary {
|
||||||
age_seconds: Result<usize, String>,
|
age_seconds: Result<usize, String>,
|
||||||
duration_seconds: Result<usize, String>,
|
duration_seconds: Result<usize, String>,
|
||||||
|
@ -1044,7 +1054,7 @@ pub mod builder {
|
||||||
pub struct Enrol<'a> {
|
pub struct Enrol<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::EnrolBody, String>,
|
body: Result<types::builder::EnrolBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Enrol<'a> {
|
impl<'a> Enrol<'a> {
|
||||||
|
@ -1052,7 +1062,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::EnrolBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,10 +1082,19 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `EnrolBody` for body failed".to_string());
|
.map_err(|_| "conversion to `EnrolBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::EnrolBody) -> types::builder::EnrolBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/enrol`
|
///Sends a `POST` request to `/enrol`
|
||||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1084,7 +1103,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::EnrolBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/enrol", client.baseurl,);
|
let url = format!("{}/enrol", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
@ -1204,7 +1225,7 @@ pub mod builder {
|
||||||
pub struct ReportFinish<'a> {
|
pub struct ReportFinish<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::ReportFinishBody, String>,
|
body: Result<types::builder::ReportFinishBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReportFinish<'a> {
|
impl<'a> ReportFinish<'a> {
|
||||||
|
@ -1212,7 +1233,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::ReportFinishBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1232,10 +1253,21 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `ReportFinishBody` for body failed".to_string());
|
.map_err(|_| "conversion to `ReportFinishBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::ReportFinishBody,
|
||||||
|
) -> types::builder::ReportFinishBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/report/finish`
|
///Sends a `POST` request to `/report/finish`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1244,7 +1276,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::ReportFinishBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/report/finish", client.baseurl,);
|
let url = format!("{}/report/finish", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
@ -1270,7 +1304,7 @@ pub mod builder {
|
||||||
pub struct ReportOutput<'a> {
|
pub struct ReportOutput<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::ReportOutputBody, String>,
|
body: Result<types::builder::ReportOutputBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReportOutput<'a> {
|
impl<'a> ReportOutput<'a> {
|
||||||
|
@ -1278,7 +1312,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::ReportOutputBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,10 +1332,21 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `ReportOutputBody` for body failed".to_string());
|
.map_err(|_| "conversion to `ReportOutputBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::ReportOutputBody,
|
||||||
|
) -> types::builder::ReportOutputBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/report/output`
|
///Sends a `POST` request to `/report/output`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1310,7 +1355,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::ReportOutputBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/report/output", client.baseurl,);
|
let url = format!("{}/report/output", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
@ -1336,7 +1383,7 @@ pub mod builder {
|
||||||
pub struct ReportStart<'a> {
|
pub struct ReportStart<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
authorization: Result<String, String>,
|
authorization: Result<String, String>,
|
||||||
body: Result<types::ReportStartBody, String>,
|
body: Result<types::builder::ReportStartBody, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReportStart<'a> {
|
impl<'a> ReportStart<'a> {
|
||||||
|
@ -1344,7 +1391,7 @@ pub mod builder {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
authorization: Err("authorization was not initialized".to_string()),
|
authorization: Err("authorization was not initialized".to_string()),
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::ReportStartBody::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1364,10 +1411,19 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `ReportStartBody` for body failed".to_string());
|
.map_err(|_| "conversion to `ReportStartBody` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(types::builder::ReportStartBody) -> types::builder::ReportStartBody,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/report/start`
|
///Sends a `POST` request to `/report/start`
|
||||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||||
let Self {
|
let Self {
|
||||||
|
@ -1376,7 +1432,9 @@ pub mod builder {
|
||||||
body,
|
body,
|
||||||
} = self;
|
} = self;
|
||||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::ReportStartBody::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/report/start", client.baseurl,);
|
let url = format!("{}/report/start", client.baseurl,);
|
||||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -5846,7 +5846,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod defaults {
|
pub mod defaults {
|
||||||
pub(super) fn default_bool<const V: bool>() -> bool {
|
pub(super) fn default_bool<const V: bool>() -> bool {
|
||||||
V
|
V
|
||||||
}
|
}
|
||||||
|
|
|
@ -705,7 +705,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct CrucibleOpts {
|
pub struct CrucibleOpts {
|
||||||
cert_pem: Result<Option<String>, String>,
|
cert_pem: Result<Option<String>, String>,
|
||||||
control: Result<Option<String>, String>,
|
control: Result<Option<String>, String>,
|
||||||
|
@ -874,6 +875,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct DiskAttachment {
|
pub struct DiskAttachment {
|
||||||
disk_id: Result<uuid::Uuid, String>,
|
disk_id: Result<uuid::Uuid, String>,
|
||||||
generation_id: Result<u64, String>,
|
generation_id: Result<u64, String>,
|
||||||
|
@ -944,6 +946,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct DiskRequest {
|
pub struct DiskRequest {
|
||||||
device: Result<String, String>,
|
device: Result<String, String>,
|
||||||
gen: Result<u64, String>,
|
gen: Result<u64, String>,
|
||||||
|
@ -1061,6 +1064,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
error_code: Result<Option<String>, String>,
|
error_code: Result<Option<String>, String>,
|
||||||
message: Result<String, String>,
|
message: Result<String, String>,
|
||||||
|
@ -1131,6 +1135,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Instance {
|
pub struct Instance {
|
||||||
disks: Result<Vec<super::DiskAttachment>, String>,
|
disks: Result<Vec<super::DiskAttachment>, String>,
|
||||||
nics: Result<Vec<super::NetworkInterface>, String>,
|
nics: Result<Vec<super::NetworkInterface>, String>,
|
||||||
|
@ -1215,6 +1220,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceEnsureRequest {
|
pub struct InstanceEnsureRequest {
|
||||||
cloud_init_bytes: Result<Option<String>, String>,
|
cloud_init_bytes: Result<Option<String>, String>,
|
||||||
disks: Result<Vec<super::DiskRequest>, String>,
|
disks: Result<Vec<super::DiskRequest>, String>,
|
||||||
|
@ -1316,6 +1322,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceEnsureResponse {
|
pub struct InstanceEnsureResponse {
|
||||||
migrate: Result<Option<super::InstanceMigrateInitiateResponse>, String>,
|
migrate: Result<Option<super::InstanceMigrateInitiateResponse>, String>,
|
||||||
}
|
}
|
||||||
|
@ -1358,6 +1365,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceGetResponse {
|
pub struct InstanceGetResponse {
|
||||||
instance: Result<super::Instance, String>,
|
instance: Result<super::Instance, String>,
|
||||||
}
|
}
|
||||||
|
@ -1400,6 +1408,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateInitiateRequest {
|
pub struct InstanceMigrateInitiateRequest {
|
||||||
migration_id: Result<uuid::Uuid, String>,
|
migration_id: Result<uuid::Uuid, String>,
|
||||||
src_addr: Result<String, String>,
|
src_addr: Result<String, String>,
|
||||||
|
@ -1472,6 +1481,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateInitiateResponse {
|
pub struct InstanceMigrateInitiateResponse {
|
||||||
migration_id: Result<uuid::Uuid, String>,
|
migration_id: Result<uuid::Uuid, String>,
|
||||||
}
|
}
|
||||||
|
@ -1516,6 +1526,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateStatusRequest {
|
pub struct InstanceMigrateStatusRequest {
|
||||||
migration_id: Result<uuid::Uuid, String>,
|
migration_id: Result<uuid::Uuid, String>,
|
||||||
}
|
}
|
||||||
|
@ -1558,6 +1569,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateStatusResponse {
|
pub struct InstanceMigrateStatusResponse {
|
||||||
state: Result<super::MigrationState, String>,
|
state: Result<super::MigrationState, String>,
|
||||||
}
|
}
|
||||||
|
@ -1600,6 +1612,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceProperties {
|
pub struct InstanceProperties {
|
||||||
bootrom_id: Result<uuid::Uuid, String>,
|
bootrom_id: Result<uuid::Uuid, String>,
|
||||||
description: Result<String, String>,
|
description: Result<String, String>,
|
||||||
|
@ -1726,6 +1739,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceStateMonitorRequest {
|
pub struct InstanceStateMonitorRequest {
|
||||||
gen: Result<u64, String>,
|
gen: Result<u64, String>,
|
||||||
}
|
}
|
||||||
|
@ -1764,6 +1778,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceStateMonitorResponse {
|
pub struct InstanceStateMonitorResponse {
|
||||||
gen: Result<u64, String>,
|
gen: Result<u64, String>,
|
||||||
state: Result<super::InstanceState, String>,
|
state: Result<super::InstanceState, String>,
|
||||||
|
@ -1820,6 +1835,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct NetworkInterface {
|
pub struct NetworkInterface {
|
||||||
attachment: Result<super::NetworkInterfaceAttachmentState, String>,
|
attachment: Result<super::NetworkInterfaceAttachmentState, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -1876,6 +1892,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct NetworkInterfaceRequest {
|
pub struct NetworkInterfaceRequest {
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
slot: Result<super::Slot, String>,
|
slot: Result<super::Slot, String>,
|
||||||
|
@ -2119,14 +2136,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct InstanceEnsure<'a> {
|
pub struct InstanceEnsure<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::InstanceEnsureRequest, String>,
|
body: Result<types::builder::InstanceEnsureRequest, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InstanceEnsure<'a> {
|
impl<'a> InstanceEnsure<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::InstanceEnsureRequest::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2136,16 +2153,29 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `InstanceEnsureRequest` for body failed".to_string());
|
.map_err(|_| "conversion to `InstanceEnsureRequest` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::InstanceEnsureRequest,
|
||||||
|
) -> types::builder::InstanceEnsureRequest,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `PUT` request to `/instance`
|
///Sends a `PUT` request to `/instance`
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
self,
|
self,
|
||||||
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::InstanceEnsureRequest::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/instance", client.baseurl,);
|
let url = format!("{}/instance", client.baseurl,);
|
||||||
let request = client.client.put(url).json(&body).build()?;
|
let request = client.client.put(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2240,14 +2270,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct InstanceMigrateStatus<'a> {
|
pub struct InstanceMigrateStatus<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::InstanceMigrateStatusRequest, String>,
|
body: Result<types::builder::InstanceMigrateStatusRequest, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InstanceMigrateStatus<'a> {
|
impl<'a> InstanceMigrateStatus<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::InstanceMigrateStatusRequest::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2255,19 +2285,31 @@ pub mod builder {
|
||||||
where
|
where
|
||||||
V: std::convert::TryInto<types::InstanceMigrateStatusRequest>,
|
V: std::convert::TryInto<types::InstanceMigrateStatusRequest>,
|
||||||
{
|
{
|
||||||
self.body = value.try_into().map_err(|_| {
|
self.body = value.try_into().map(From::from).map_err(|_| {
|
||||||
"conversion to `InstanceMigrateStatusRequest` for body failed".to_string()
|
"conversion to `InstanceMigrateStatusRequest` for body failed".to_string()
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::InstanceMigrateStatusRequest,
|
||||||
|
) -> types::builder::InstanceMigrateStatusRequest,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `GET` request to `/instance/migrate/status`
|
///Sends a `GET` request to `/instance/migrate/status`
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
self,
|
self,
|
||||||
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
|
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
|
||||||
{
|
{
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::InstanceMigrateStatusRequest::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/instance/migrate/status", client.baseurl,);
|
let url = format!("{}/instance/migrate/status", client.baseurl,);
|
||||||
let request = client.client.get(url).json(&body).build()?;
|
let request = client.client.get(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2382,14 +2424,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct InstanceStateMonitor<'a> {
|
pub struct InstanceStateMonitor<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::InstanceStateMonitorRequest, String>,
|
body: Result<types::builder::InstanceStateMonitorRequest, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InstanceStateMonitor<'a> {
|
impl<'a> InstanceStateMonitor<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::InstanceStateMonitorRequest::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2397,19 +2439,31 @@ pub mod builder {
|
||||||
where
|
where
|
||||||
V: std::convert::TryInto<types::InstanceStateMonitorRequest>,
|
V: std::convert::TryInto<types::InstanceStateMonitorRequest>,
|
||||||
{
|
{
|
||||||
self.body = value.try_into().map_err(|_| {
|
self.body = value.try_into().map(From::from).map_err(|_| {
|
||||||
"conversion to `InstanceStateMonitorRequest` for body failed".to_string()
|
"conversion to `InstanceStateMonitorRequest` for body failed".to_string()
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::InstanceStateMonitorRequest,
|
||||||
|
) -> types::builder::InstanceStateMonitorRequest,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `GET` request to `/instance/state-monitor`
|
///Sends a `GET` request to `/instance/state-monitor`
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
self,
|
self,
|
||||||
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
|
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
|
||||||
{
|
{
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::InstanceStateMonitorRequest::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/instance/state-monitor", client.baseurl,);
|
let url = format!("{}/instance/state-monitor", client.baseurl,);
|
||||||
let request = client.client.get(url).json(&body).build()?;
|
let request = client.client.get(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
|
|
@ -711,7 +711,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct CrucibleOpts {
|
pub struct CrucibleOpts {
|
||||||
cert_pem: Result<Option<String>, String>,
|
cert_pem: Result<Option<String>, String>,
|
||||||
control: Result<Option<String>, String>,
|
control: Result<Option<String>, String>,
|
||||||
|
@ -880,6 +881,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct DiskAttachment {
|
pub struct DiskAttachment {
|
||||||
disk_id: Result<uuid::Uuid, String>,
|
disk_id: Result<uuid::Uuid, String>,
|
||||||
generation_id: Result<u64, String>,
|
generation_id: Result<u64, String>,
|
||||||
|
@ -950,6 +952,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct DiskRequest {
|
pub struct DiskRequest {
|
||||||
device: Result<String, String>,
|
device: Result<String, String>,
|
||||||
gen: Result<u64, String>,
|
gen: Result<u64, String>,
|
||||||
|
@ -1067,6 +1070,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
error_code: Result<Option<String>, String>,
|
error_code: Result<Option<String>, String>,
|
||||||
message: Result<String, String>,
|
message: Result<String, String>,
|
||||||
|
@ -1137,6 +1141,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Instance {
|
pub struct Instance {
|
||||||
disks: Result<Vec<super::DiskAttachment>, String>,
|
disks: Result<Vec<super::DiskAttachment>, String>,
|
||||||
nics: Result<Vec<super::NetworkInterface>, String>,
|
nics: Result<Vec<super::NetworkInterface>, String>,
|
||||||
|
@ -1221,6 +1226,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceEnsureRequest {
|
pub struct InstanceEnsureRequest {
|
||||||
cloud_init_bytes: Result<Option<String>, String>,
|
cloud_init_bytes: Result<Option<String>, String>,
|
||||||
disks: Result<Vec<super::DiskRequest>, String>,
|
disks: Result<Vec<super::DiskRequest>, String>,
|
||||||
|
@ -1322,6 +1328,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceEnsureResponse {
|
pub struct InstanceEnsureResponse {
|
||||||
migrate: Result<Option<super::InstanceMigrateInitiateResponse>, String>,
|
migrate: Result<Option<super::InstanceMigrateInitiateResponse>, String>,
|
||||||
}
|
}
|
||||||
|
@ -1364,6 +1371,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceGetResponse {
|
pub struct InstanceGetResponse {
|
||||||
instance: Result<super::Instance, String>,
|
instance: Result<super::Instance, String>,
|
||||||
}
|
}
|
||||||
|
@ -1406,6 +1414,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateInitiateRequest {
|
pub struct InstanceMigrateInitiateRequest {
|
||||||
migration_id: Result<uuid::Uuid, String>,
|
migration_id: Result<uuid::Uuid, String>,
|
||||||
src_addr: Result<String, String>,
|
src_addr: Result<String, String>,
|
||||||
|
@ -1478,6 +1487,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateInitiateResponse {
|
pub struct InstanceMigrateInitiateResponse {
|
||||||
migration_id: Result<uuid::Uuid, String>,
|
migration_id: Result<uuid::Uuid, String>,
|
||||||
}
|
}
|
||||||
|
@ -1522,6 +1532,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateStatusRequest {
|
pub struct InstanceMigrateStatusRequest {
|
||||||
migration_id: Result<uuid::Uuid, String>,
|
migration_id: Result<uuid::Uuid, String>,
|
||||||
}
|
}
|
||||||
|
@ -1564,6 +1575,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceMigrateStatusResponse {
|
pub struct InstanceMigrateStatusResponse {
|
||||||
state: Result<super::MigrationState, String>,
|
state: Result<super::MigrationState, String>,
|
||||||
}
|
}
|
||||||
|
@ -1606,6 +1618,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceProperties {
|
pub struct InstanceProperties {
|
||||||
bootrom_id: Result<uuid::Uuid, String>,
|
bootrom_id: Result<uuid::Uuid, String>,
|
||||||
description: Result<String, String>,
|
description: Result<String, String>,
|
||||||
|
@ -1732,6 +1745,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceStateMonitorRequest {
|
pub struct InstanceStateMonitorRequest {
|
||||||
gen: Result<u64, String>,
|
gen: Result<u64, String>,
|
||||||
}
|
}
|
||||||
|
@ -1770,6 +1784,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct InstanceStateMonitorResponse {
|
pub struct InstanceStateMonitorResponse {
|
||||||
gen: Result<u64, String>,
|
gen: Result<u64, String>,
|
||||||
state: Result<super::InstanceState, String>,
|
state: Result<super::InstanceState, String>,
|
||||||
|
@ -1826,6 +1841,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct NetworkInterface {
|
pub struct NetworkInterface {
|
||||||
attachment: Result<super::NetworkInterfaceAttachmentState, String>,
|
attachment: Result<super::NetworkInterfaceAttachmentState, String>,
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
|
@ -1882,6 +1898,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct NetworkInterfaceRequest {
|
pub struct NetworkInterfaceRequest {
|
||||||
name: Result<String, String>,
|
name: Result<String, String>,
|
||||||
slot: Result<super::Slot, String>,
|
slot: Result<super::Slot, String>,
|
||||||
|
@ -2125,14 +2142,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct InstanceEnsure<'a> {
|
pub struct InstanceEnsure<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::InstanceEnsureRequest, String>,
|
body: Result<types::builder::InstanceEnsureRequest, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InstanceEnsure<'a> {
|
impl<'a> InstanceEnsure<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::InstanceEnsureRequest::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2142,16 +2159,29 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `InstanceEnsureRequest` for body failed".to_string());
|
.map_err(|_| "conversion to `InstanceEnsureRequest` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::InstanceEnsureRequest,
|
||||||
|
) -> types::builder::InstanceEnsureRequest,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `PUT` request to `/instance`
|
///Sends a `PUT` request to `/instance`
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
self,
|
self,
|
||||||
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::InstanceEnsureRequest::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/instance", client.baseurl,);
|
let url = format!("{}/instance", client.baseurl,);
|
||||||
let request = client.client.put(url).json(&body).build()?;
|
let request = client.client.put(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2246,14 +2276,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct InstanceMigrateStatus<'a> {
|
pub struct InstanceMigrateStatus<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::InstanceMigrateStatusRequest, String>,
|
body: Result<types::builder::InstanceMigrateStatusRequest, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InstanceMigrateStatus<'a> {
|
impl<'a> InstanceMigrateStatus<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::InstanceMigrateStatusRequest::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2261,19 +2291,31 @@ pub mod builder {
|
||||||
where
|
where
|
||||||
V: std::convert::TryInto<types::InstanceMigrateStatusRequest>,
|
V: std::convert::TryInto<types::InstanceMigrateStatusRequest>,
|
||||||
{
|
{
|
||||||
self.body = value.try_into().map_err(|_| {
|
self.body = value.try_into().map(From::from).map_err(|_| {
|
||||||
"conversion to `InstanceMigrateStatusRequest` for body failed".to_string()
|
"conversion to `InstanceMigrateStatusRequest` for body failed".to_string()
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::InstanceMigrateStatusRequest,
|
||||||
|
) -> types::builder::InstanceMigrateStatusRequest,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `GET` request to `/instance/migrate/status`
|
///Sends a `GET` request to `/instance/migrate/status`
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
self,
|
self,
|
||||||
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
|
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
|
||||||
{
|
{
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::InstanceMigrateStatusRequest::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/instance/migrate/status", client.baseurl,);
|
let url = format!("{}/instance/migrate/status", client.baseurl,);
|
||||||
let request = client.client.get(url).json(&body).build()?;
|
let request = client.client.get(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
@ -2388,14 +2430,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct InstanceStateMonitor<'a> {
|
pub struct InstanceStateMonitor<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::InstanceStateMonitorRequest, String>,
|
body: Result<types::builder::InstanceStateMonitorRequest, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InstanceStateMonitor<'a> {
|
impl<'a> InstanceStateMonitor<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::InstanceStateMonitorRequest::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2403,19 +2445,31 @@ pub mod builder {
|
||||||
where
|
where
|
||||||
V: std::convert::TryInto<types::InstanceStateMonitorRequest>,
|
V: std::convert::TryInto<types::InstanceStateMonitorRequest>,
|
||||||
{
|
{
|
||||||
self.body = value.try_into().map_err(|_| {
|
self.body = value.try_into().map(From::from).map_err(|_| {
|
||||||
"conversion to `InstanceStateMonitorRequest` for body failed".to_string()
|
"conversion to `InstanceStateMonitorRequest` for body failed".to_string()
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::InstanceStateMonitorRequest,
|
||||||
|
) -> types::builder::InstanceStateMonitorRequest,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `GET` request to `/instance/state-monitor`
|
///Sends a `GET` request to `/instance/state-monitor`
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
self,
|
self,
|
||||||
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
|
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
|
||||||
{
|
{
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::InstanceStateMonitorRequest::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/instance/state-monitor", client.baseurl,);
|
let url = format!("{}/instance/state-monitor", client.baseurl,);
|
||||||
let request = client.client.get(url).json(&body).build()?;
|
let request = client.client.get(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
|
|
@ -51,7 +51,8 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod builder {
|
pub mod builder {
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct BodyWithDefaults {
|
pub struct BodyWithDefaults {
|
||||||
forty_two: Result<u32, String>,
|
forty_two: Result<u32, String>,
|
||||||
s: Result<String, String>,
|
s: Result<String, String>,
|
||||||
|
@ -136,6 +137,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
error_code: Result<Option<String>, String>,
|
error_code: Result<Option<String>, String>,
|
||||||
message: Result<String, String>,
|
message: Result<String, String>,
|
||||||
|
@ -207,7 +209,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod defaults {
|
pub mod defaults {
|
||||||
pub(super) fn default_u64<T, const V: u64>() -> T
|
pub(super) fn default_u64<T, const V: u64>() -> T
|
||||||
where
|
where
|
||||||
T: std::convert::TryFrom<u64>,
|
T: std::convert::TryFrom<u64>,
|
||||||
|
@ -295,14 +297,14 @@ pub mod builder {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DefaultParams<'a> {
|
pub struct DefaultParams<'a> {
|
||||||
client: &'a super::Client,
|
client: &'a super::Client,
|
||||||
body: Result<types::BodyWithDefaults, String>,
|
body: Result<types::builder::BodyWithDefaults, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DefaultParams<'a> {
|
impl<'a> DefaultParams<'a> {
|
||||||
pub fn new(client: &'a super::Client) -> Self {
|
pub fn new(client: &'a super::Client) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
body: Err("body was not initialized".to_string()),
|
body: Ok(types::builder::BodyWithDefaults::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,14 +314,27 @@ pub mod builder {
|
||||||
{
|
{
|
||||||
self.body = value
|
self.body = value
|
||||||
.try_into()
|
.try_into()
|
||||||
|
.map(From::from)
|
||||||
.map_err(|_| "conversion to `BodyWithDefaults` for body failed".to_string());
|
.map_err(|_| "conversion to `BodyWithDefaults` for body failed".to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn body_map<F>(mut self, f: F) -> Self
|
||||||
|
where
|
||||||
|
F: std::ops::FnOnce(
|
||||||
|
types::builder::BodyWithDefaults,
|
||||||
|
) -> types::builder::BodyWithDefaults,
|
||||||
|
{
|
||||||
|
self.body = self.body.map(f);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
///Sends a `POST` request to `/`
|
///Sends a `POST` request to `/`
|
||||||
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
|
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
|
||||||
let Self { client, body } = self;
|
let Self { client, body } = self;
|
||||||
let body = body.map_err(Error::InvalidRequest)?;
|
let body = body
|
||||||
|
.and_then(types::BodyWithDefaults::try_from)
|
||||||
|
.map_err(Error::InvalidRequest)?;
|
||||||
let url = format!("{}/", client.baseurl,);
|
let url = format!("{}/", client.baseurl,);
|
||||||
let request = client.client.post(url).json(&body).build()?;
|
let request = client.client.post(url).json(&body).build()?;
|
||||||
let result = client.client.execute(request).await;
|
let result = client.client.execute(request).await;
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod defaults {
|
pub mod defaults {
|
||||||
pub(super) fn default_u64<T, const V: u64>() -> T
|
pub(super) fn default_u64<T, const V: u64>() -> T
|
||||||
where
|
where
|
||||||
T: std::convert::TryFrom<u64>,
|
T: std::convert::TryFrom<u64>,
|
||||||
|
|
Loading…
Reference in New Issue