use super::ResponseContent;
use super::{ContentType, Error, configuration};
use crate::models;
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CancelWorkflowError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ClaimJobsBasedOnResourcesError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ClaimNextJobsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateWorkflowError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteWorkflowError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetReadyJobRequirementsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetWorkflowError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetWorkflowStatusError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeJobsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IsWorkflowCompleteError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IsWorkflowUninitializedError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListJobDependenciesError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListJobFileRelationshipsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListJobIdsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListJobUserDataRelationshipsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListMissingUserDataError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListRequiredExistingFilesError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListWorkflowsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ProcessChangedJobInputsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResetJobStatusError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResetWorkflowStatusError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateWorkflowError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateWorkflowStatusError {
UnknownValue(serde_json::Value),
}
pub fn cancel_workflow(
configuration: &configuration::Configuration,
id: i64,
) -> Result<serde_json::Value, Error<CancelWorkflowError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/cancel",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `serde_json::Value`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<CancelWorkflowError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn claim_jobs_based_on_resources(
configuration: &configuration::Configuration,
id: i64,
limit: i64,
compute_nodes_resources: models::ComputeNodesResources,
strict_scheduler_match: Option<bool>,
) -> Result<models::ClaimJobsBasedOnResources, Error<ClaimJobsBasedOnResourcesError>> {
let p_path_id = id;
let p_path_limit = limit;
let p_body_compute_nodes_resources = compute_nodes_resources;
let p_query_strict_scheduler_match = strict_scheduler_match;
let uri_str = format!(
"{}/workflows/{id}/claim_jobs_based_on_resources/{limit}",
configuration.base_path,
id = p_path_id,
limit = p_path_limit
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_strict_scheduler_match {
req_builder = req_builder.query(&[("strict_scheduler_match", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
req_builder = req_builder.json(&p_body_compute_nodes_resources);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClaimJobsBasedOnResources`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClaimJobsBasedOnResources`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ClaimJobsBasedOnResourcesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn claim_next_jobs(
configuration: &configuration::Configuration,
id: i64,
limit: Option<i64>,
) -> Result<models::ClaimNextJobsResponse, Error<ClaimNextJobsError>> {
let p_path_id = id;
let p_query_limit = limit;
let uri_str = format!(
"{}/workflows/{id}/claim_next_jobs",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClaimNextJobsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClaimNextJobsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ClaimNextJobsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn create_workflow(
configuration: &configuration::Configuration,
workflow_model: models::WorkflowModel,
) -> Result<models::WorkflowModel, Error<CreateWorkflowError>> {
let p_body_workflow_model = workflow_model;
let uri_str = format!("{}/workflows", configuration.base_path);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
req_builder = req_builder.json(&p_body_workflow_model);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::WorkflowModel`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowModel`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<CreateWorkflowError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn delete_workflow(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::WorkflowModel, Error<DeleteWorkflowError>> {
let p_path_id = id;
let uri_str = format!("{}/workflows/{id}", configuration.base_path, id = p_path_id);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::WorkflowModel`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowModel`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<DeleteWorkflowError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn get_ready_job_requirements(
configuration: &configuration::Configuration,
id: i64,
scheduler_config_id: Option<i64>,
) -> Result<models::GetReadyJobRequirementsResponse, Error<GetReadyJobRequirementsError>> {
let p_path_id = id;
let p_query_scheduler_config_id = scheduler_config_id;
let uri_str = format!(
"{}/workflows/{id}/ready_job_requirements",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_scheduler_config_id {
req_builder = req_builder.query(&[("scheduler_config_id", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::GetReadyJobRequirementsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::GetReadyJobRequirementsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<GetReadyJobRequirementsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn get_workflow(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::WorkflowModel, Error<GetWorkflowError>> {
let p_path_id = id;
let uri_str = format!("{}/workflows/{id}", configuration.base_path, id = p_path_id);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::WorkflowModel`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowModel`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<GetWorkflowError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn get_workflow_status(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::WorkflowStatusModel, Error<GetWorkflowStatusError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/status",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::WorkflowStatusModel`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowStatusModel`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<GetWorkflowStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn initialize_jobs(
configuration: &configuration::Configuration,
id: i64,
only_uninitialized: Option<bool>,
clear_ephemeral_user_data: Option<bool>,
) -> Result<serde_json::Value, Error<InitializeJobsError>> {
let p_path_id = id;
let p_query_only_uninitialized = only_uninitialized;
let p_query_clear_ephemeral_user_data = clear_ephemeral_user_data;
let uri_str = format!(
"{}/workflows/{id}/initialize_jobs",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_only_uninitialized {
req_builder = req_builder.query(&[("only_uninitialized", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_clear_ephemeral_user_data {
req_builder = req_builder.query(&[("clear_ephemeral_user_data", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `serde_json::Value`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<InitializeJobsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn is_workflow_complete(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::IsCompleteResponse, Error<IsWorkflowCompleteError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/is_complete",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::IsCompleteResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::IsCompleteResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<IsWorkflowCompleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn is_workflow_uninitialized(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::IsUninitializedResponse, Error<IsWorkflowUninitializedError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/is_uninitialized",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::IsUninitializedResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::IsUninitializedResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<IsWorkflowUninitializedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_job_dependencies(
configuration: &configuration::Configuration,
id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<&str>,
reverse_sort: Option<bool>,
) -> Result<models::ListJobDependenciesResponse, Error<ListJobDependenciesError>> {
let p_path_id = id;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort_by = sort_by;
let p_query_reverse_sort = reverse_sort;
let uri_str = format!(
"{}/workflows/{id}/job_dependencies",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort_by {
req_builder = req_builder.query(&[("sort_by", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_reverse_sort {
req_builder = req_builder.query(&[("reverse_sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListJobDependenciesResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListJobDependenciesResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListJobDependenciesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_job_file_relationships(
configuration: &configuration::Configuration,
id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<&str>,
reverse_sort: Option<bool>,
) -> Result<models::ListJobFileRelationshipsResponse, Error<ListJobFileRelationshipsError>> {
let p_path_id = id;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort_by = sort_by;
let p_query_reverse_sort = reverse_sort;
let uri_str = format!(
"{}/workflows/{id}/job_file_relationships",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort_by {
req_builder = req_builder.query(&[("sort_by", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_reverse_sort {
req_builder = req_builder.query(&[("reverse_sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListJobFileRelationshipsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListJobFileRelationshipsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListJobFileRelationshipsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_job_ids(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::ListJobIdsResponse, Error<ListJobIdsError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/job_ids",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListJobIdsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListJobIdsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListJobIdsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_job_user_data_relationships(
configuration: &configuration::Configuration,
id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<&str>,
reverse_sort: Option<bool>,
) -> Result<models::ListJobUserDataRelationshipsResponse, Error<ListJobUserDataRelationshipsError>>
{
let p_path_id = id;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort_by = sort_by;
let p_query_reverse_sort = reverse_sort;
let uri_str = format!(
"{}/workflows/{id}/job_user_data_relationships",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort_by {
req_builder = req_builder.query(&[("sort_by", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_reverse_sort {
req_builder = req_builder.query(&[("reverse_sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListJobUserDataRelationshipsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListJobUserDataRelationshipsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListJobUserDataRelationshipsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_missing_user_data(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::ListMissingUserDataResponse, Error<ListMissingUserDataError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/missing_user_data",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListMissingUserDataResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListMissingUserDataResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListMissingUserDataError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_required_existing_files(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::ListRequiredExistingFilesResponse, Error<ListRequiredExistingFilesError>> {
let p_path_id = id;
let uri_str = format!(
"{}/workflows/{id}/required_existing_files",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListRequiredExistingFilesResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListRequiredExistingFilesResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListRequiredExistingFilesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn list_workflows(
configuration: &configuration::Configuration,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<&str>,
reverse_sort: Option<bool>,
name: Option<&str>,
user: Option<&str>,
description: Option<&str>,
is_archived: Option<bool>,
) -> Result<models::ListWorkflowsResponse, Error<ListWorkflowsError>> {
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort_by = sort_by;
let p_query_reverse_sort = reverse_sort;
let p_query_name = name;
let p_query_user = user;
let p_query_description = description;
let p_query_is_archived = is_archived;
let uri_str = format!("{}/workflows", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort_by {
req_builder = req_builder.query(&[("sort_by", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_reverse_sort {
req_builder = req_builder.query(&[("reverse_sort", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_user {
req_builder = req_builder.query(&[("user", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_description {
req_builder = req_builder.query(&[("description", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_is_archived {
req_builder = req_builder.query(&[("is_archived", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ListWorkflowsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ListWorkflowsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ListWorkflowsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn process_changed_job_inputs(
configuration: &configuration::Configuration,
id: i64,
dry_run: Option<bool>,
) -> Result<models::ProcessChangedJobInputsResponse, Error<ProcessChangedJobInputsError>> {
let p_path_id = id;
let p_query_dry_run = dry_run;
let uri_str = format!(
"{}/workflows/{id}/process_changed_job_inputs",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_dry_run {
req_builder = req_builder.query(&[("dry_run", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ProcessChangedJobInputsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ProcessChangedJobInputsResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ProcessChangedJobInputsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn reset_job_status(
configuration: &configuration::Configuration,
id: i64,
failed_only: Option<bool>,
) -> Result<models::ResetJobStatusResponse, Error<ResetJobStatusError>> {
let p_path_id = id;
let p_query_failed_only = failed_only;
let uri_str = format!(
"{}/workflows/{id}/reset_job_status",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_failed_only {
req_builder = req_builder.query(&[("failed_only", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ResetJobStatusResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ResetJobStatusResponse`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ResetJobStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn reset_workflow_status(
configuration: &configuration::Configuration,
id: i64,
force: Option<bool>,
) -> Result<serde_json::Value, Error<ResetWorkflowStatusError>> {
let p_path_id = id;
let p_query_force = force;
let uri_str = format!(
"{}/workflows/{id}/reset_status",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_force {
req_builder = req_builder.query(&[("force", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `serde_json::Value`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<ResetWorkflowStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn update_workflow(
configuration: &configuration::Configuration,
id: i64,
workflow_model: models::WorkflowModel,
) -> Result<models::WorkflowModel, Error<UpdateWorkflowError>> {
let p_path_id = id;
let p_body_workflow_model = workflow_model;
let uri_str = format!("{}/workflows/{id}", configuration.base_path, id = p_path_id);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
req_builder = req_builder.json(&p_body_workflow_model);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::WorkflowModel`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowModel`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<UpdateWorkflowError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub fn update_workflow_status(
configuration: &configuration::Configuration,
id: i64,
workflow_status_model: models::WorkflowStatusModel,
) -> Result<models::WorkflowStatusModel, Error<UpdateWorkflowStatusError>> {
let p_path_id = id;
let p_body_workflow_status_model = workflow_status_model;
let uri_str = format!(
"{}/workflows/{id}/status",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = configuration.apply_auth(req_builder);
req_builder = req_builder.json(&p_body_workflow_status_model);
let req = req_builder.build()?;
let resp = configuration.client.execute(req)?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text()?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::WorkflowStatusModel`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowStatusModel`"
))));
}
}
} else {
let content = resp.text()?;
let entity: Option<UpdateWorkflowStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}