|
|
|
|
@@ -8,44 +8,51 @@
|
|
|
|
|
* Generated by: https://openapi-generator.tech
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use super::{configuration, Error};
|
|
|
|
|
use crate::apis::ContentType;
|
|
|
|
|
use crate::{apis::ResponseContent, models};
|
|
|
|
|
use async_trait::async_trait;
|
|
|
|
|
#[cfg(feature = "mockall")]
|
|
|
|
|
use mockall::automock;
|
|
|
|
|
use reqwest;
|
|
|
|
|
use serde::{de::Error as _, Deserialize, Serialize};
|
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
use serde::{Deserialize, Serialize, de::Error as _};
|
|
|
|
|
use crate::{apis::ResponseContent, models};
|
|
|
|
|
use super::{Error, configuration};
|
|
|
|
|
use crate::apis::ContentType;
|
|
|
|
|
|
|
|
|
|
#[cfg_attr(feature = "mockall", automock)]
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait NginxAgentApi: Send + Sync {
|
|
|
|
|
|
|
|
|
|
/// GET /status
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
async fn status(&self, ) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>>;
|
|
|
|
|
async fn status(&self) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>>;
|
|
|
|
|
|
|
|
|
|
/// POST /validate
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
async fn validate(&self, params: ValidateParams ) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>>;
|
|
|
|
|
async fn validate(
|
|
|
|
|
&self,
|
|
|
|
|
params: ValidateParams,
|
|
|
|
|
) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>>;
|
|
|
|
|
|
|
|
|
|
/// POST /validate_and_reload
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
async fn validate_and_reload(&self, params: ValidateAndReloadParams ) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>>;
|
|
|
|
|
async fn validate_and_reload(
|
|
|
|
|
&self,
|
|
|
|
|
params: ValidateAndReloadParams,
|
|
|
|
|
) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>>;
|
|
|
|
|
|
|
|
|
|
/// POST /write_config
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
async fn write_config(&self, params: WriteConfigParams ) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>>;
|
|
|
|
|
async fn write_config(
|
|
|
|
|
&self,
|
|
|
|
|
params: WriteConfigParams,
|
|
|
|
|
) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct NginxAgentApiClient {
|
|
|
|
|
configuration: Arc<configuration::Configuration>
|
|
|
|
|
configuration: Arc<configuration::Configuration>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl NginxAgentApiClient {
|
|
|
|
|
@@ -54,40 +61,38 @@ impl NginxAgentApiClient {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// struct for passing parameters to the method [`NginxAgentApi::validate`]
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
|
pub struct ValidateParams {
|
|
|
|
|
pub validate_body: models::ValidateBody
|
|
|
|
|
pub validate_body: models::ValidateBody,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// struct for passing parameters to the method [`NginxAgentApi::validate_and_reload`]
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
|
pub struct ValidateAndReloadParams {
|
|
|
|
|
pub validate_and_reload_body: models::ValidateAndReloadBody
|
|
|
|
|
pub validate_and_reload_body: models::ValidateAndReloadBody,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// struct for passing parameters to the method [`NginxAgentApi::write_config`]
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
|
pub struct WriteConfigParams {
|
|
|
|
|
pub write_config_body: models::WriteConfigBody
|
|
|
|
|
pub write_config_body: models::WriteConfigBody,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
|
impl NginxAgentApi for NginxAgentApiClient {
|
|
|
|
|
async fn status(&self, ) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async fn status(&self) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>> {
|
|
|
|
|
let local_var_configuration = &self.configuration;
|
|
|
|
|
|
|
|
|
|
let local_var_client = &local_var_configuration.client;
|
|
|
|
|
|
|
|
|
|
let local_var_uri_str = format!("{}/status", local_var_configuration.base_path);
|
|
|
|
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
|
|
|
|
|
let mut local_var_req_builder =
|
|
|
|
|
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
|
|
|
|
|
|
|
|
|
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
|
|
|
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
local_var_req_builder = local_var_req_builder
|
|
|
|
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let local_var_req = local_var_req_builder.build()?;
|
|
|
|
|
@@ -97,32 +102,43 @@ impl NginxAgentApi for NginxAgentApiClient {
|
|
|
|
|
let local_var_content = local_var_resp.text().await?;
|
|
|
|
|
|
|
|
|
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
|
|
|
|
let local_var_entity: Option<StatusSuccess> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<StatusSuccess> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Ok(local_var_result)
|
|
|
|
|
} else {
|
|
|
|
|
let local_var_entity: Option<StatusError> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<StatusError> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Err(Error::ResponseError(local_var_error))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn validate(&self, params: ValidateParams ) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>> {
|
|
|
|
|
|
|
|
|
|
let ValidateParams {
|
|
|
|
|
validate_body,
|
|
|
|
|
} = params;
|
|
|
|
|
|
|
|
|
|
async fn validate(
|
|
|
|
|
&self,
|
|
|
|
|
params: ValidateParams,
|
|
|
|
|
) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>> {
|
|
|
|
|
let ValidateParams { validate_body } = params;
|
|
|
|
|
|
|
|
|
|
let local_var_configuration = &self.configuration;
|
|
|
|
|
|
|
|
|
|
let local_var_client = &local_var_configuration.client;
|
|
|
|
|
|
|
|
|
|
let local_var_uri_str = format!("{}/validate", local_var_configuration.base_path);
|
|
|
|
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
|
|
|
|
let mut local_var_req_builder =
|
|
|
|
|
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
|
|
|
|
|
|
|
|
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
|
|
|
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
local_var_req_builder = local_var_req_builder
|
|
|
|
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
}
|
|
|
|
|
local_var_req_builder = local_var_req_builder.json(&validate_body);
|
|
|
|
|
|
|
|
|
|
@@ -133,32 +149,46 @@ impl NginxAgentApi for NginxAgentApiClient {
|
|
|
|
|
let local_var_content = local_var_resp.text().await?;
|
|
|
|
|
|
|
|
|
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
|
|
|
|
let local_var_entity: Option<ValidateSuccess> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<ValidateSuccess> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Ok(local_var_result)
|
|
|
|
|
} else {
|
|
|
|
|
let local_var_entity: Option<ValidateError> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<ValidateError> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Err(Error::ResponseError(local_var_error))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn validate_and_reload(&self, params: ValidateAndReloadParams ) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>> {
|
|
|
|
|
|
|
|
|
|
async fn validate_and_reload(
|
|
|
|
|
&self,
|
|
|
|
|
params: ValidateAndReloadParams,
|
|
|
|
|
) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>> {
|
|
|
|
|
let ValidateAndReloadParams {
|
|
|
|
|
validate_and_reload_body,
|
|
|
|
|
} = params;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let local_var_configuration = &self.configuration;
|
|
|
|
|
|
|
|
|
|
let local_var_client = &local_var_configuration.client;
|
|
|
|
|
|
|
|
|
|
let local_var_uri_str = format!("{}/validate_and_reload", local_var_configuration.base_path);
|
|
|
|
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
|
|
|
|
let local_var_uri_str =
|
|
|
|
|
format!("{}/validate_and_reload", local_var_configuration.base_path);
|
|
|
|
|
let mut local_var_req_builder =
|
|
|
|
|
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
|
|
|
|
|
|
|
|
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
|
|
|
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
local_var_req_builder = local_var_req_builder
|
|
|
|
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
}
|
|
|
|
|
local_var_req_builder = local_var_req_builder.json(&validate_and_reload_body);
|
|
|
|
|
|
|
|
|
|
@@ -169,32 +199,43 @@ impl NginxAgentApi for NginxAgentApiClient {
|
|
|
|
|
let local_var_content = local_var_resp.text().await?;
|
|
|
|
|
|
|
|
|
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
|
|
|
|
let local_var_entity: Option<ValidateAndReloadSuccess> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<ValidateAndReloadSuccess> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Ok(local_var_result)
|
|
|
|
|
} else {
|
|
|
|
|
let local_var_entity: Option<ValidateAndReloadError> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<ValidateAndReloadError> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Err(Error::ResponseError(local_var_error))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn write_config(&self, params: WriteConfigParams ) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>> {
|
|
|
|
|
|
|
|
|
|
let WriteConfigParams {
|
|
|
|
|
write_config_body,
|
|
|
|
|
} = params;
|
|
|
|
|
|
|
|
|
|
async fn write_config(
|
|
|
|
|
&self,
|
|
|
|
|
params: WriteConfigParams,
|
|
|
|
|
) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>> {
|
|
|
|
|
let WriteConfigParams { write_config_body } = params;
|
|
|
|
|
|
|
|
|
|
let local_var_configuration = &self.configuration;
|
|
|
|
|
|
|
|
|
|
let local_var_client = &local_var_configuration.client;
|
|
|
|
|
|
|
|
|
|
let local_var_uri_str = format!("{}/write_config", local_var_configuration.base_path);
|
|
|
|
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
|
|
|
|
let mut local_var_req_builder =
|
|
|
|
|
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
|
|
|
|
|
|
|
|
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
|
|
|
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
local_var_req_builder = local_var_req_builder
|
|
|
|
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
|
|
|
|
}
|
|
|
|
|
local_var_req_builder = local_var_req_builder.json(&write_config_body);
|
|
|
|
|
|
|
|
|
|
@@ -205,16 +246,25 @@ impl NginxAgentApi for NginxAgentApiClient {
|
|
|
|
|
let local_var_content = local_var_resp.text().await?;
|
|
|
|
|
|
|
|
|
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
|
|
|
|
let local_var_entity: Option<WriteConfigSuccess> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<WriteConfigSuccess> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_result = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Ok(local_var_result)
|
|
|
|
|
} else {
|
|
|
|
|
let local_var_entity: Option<WriteConfigError> = serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
|
|
|
|
let local_var_entity: Option<WriteConfigError> =
|
|
|
|
|
serde_json::from_str(&local_var_content).ok();
|
|
|
|
|
let local_var_error = ResponseContent {
|
|
|
|
|
status: local_var_status,
|
|
|
|
|
content: local_var_content,
|
|
|
|
|
entity: local_var_entity,
|
|
|
|
|
};
|
|
|
|
|
Err(Error::ResponseError(local_var_error))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// struct for typed successes of method [`NginxAgentApi::status`]
|
|
|
|
|
@@ -277,4 +327,3 @@ pub enum WriteConfigError {
|
|
|
|
|
Status500(serde_json::Value),
|
|
|
|
|
UnknownValue(serde_json::Value),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|