Compare commits
3 Commits
0b64538754
...
e6e85564e7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6e85564e7 | ||
|
|
c7a090f78a | ||
|
|
8cc2775fe4 |
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -83,7 +83,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -114,7 +114,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -142,12 +142,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
cd apps/frontend
|
cd apps/frontend
|
||||||
pnpm install
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/verify.yml
vendored
2
.github/workflows/verify.yml
vendored
@@ -213,7 +213,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
|
|||||||
7021
apps/frontend/pnpm-lock.yaml
generated
7021
apps/frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
6
justfile
6
justfile
@@ -67,6 +67,12 @@ generate-agent-client:
|
|||||||
--additional-properties=supportMultipleResponses=true \
|
--additional-properties=supportMultipleResponses=true \
|
||||||
--additional-properties=topLevelApiClient=true \
|
--additional-properties=topLevelApiClient=true \
|
||||||
--additional-properties=useSingleRequestParameter=true
|
--additional-properties=useSingleRequestParameter=true
|
||||||
|
# format generated code
|
||||||
|
cd public/agent-client && \
|
||||||
|
cargo fmt
|
||||||
|
# append lint allows/forbids to the end of Cargo.toml to disable warnings in generated code and forbid unsafe code
|
||||||
|
cd public/agent-client && \
|
||||||
|
echo '\n[lints.clippy]\nall = "allow"\n[lints.rust]\nunsafe_code = "forbid"\n' >> Cargo.toml
|
||||||
|
|
||||||
generate-all: generate-entity generate-openapi generate-agent-client
|
generate-all: generate-entity generate-openapi generate-agent-client
|
||||||
|
|
||||||
|
|||||||
6279
pnpm-lock.yaml
generated
6279
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,7 @@
|
|||||||
|
packages:
|
||||||
|
- apps/frontend
|
||||||
|
|
||||||
onlyBuiltDependencies:
|
onlyBuiltDependencies:
|
||||||
- '@nestjs/core'
|
- '@nestjs/core'
|
||||||
- '@openapitools/openapi-generator-cli'
|
- '@openapitools/openapi-generator-cli'
|
||||||
|
- esbuild
|
||||||
|
|||||||
@@ -19,3 +19,9 @@ default = ["native-tls"]
|
|||||||
native-tls = ["reqwest/native-tls"]
|
native-tls = ["reqwest/native-tls"]
|
||||||
rustls-tls = ["reqwest/rustls-tls"]
|
rustls-tls = ["reqwest/rustls-tls"]
|
||||||
mockall = ["dep:mockall"]
|
mockall = ["dep:mockall"]
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
all = "allow"
|
||||||
|
[lints.rust]
|
||||||
|
unsafe_code = "forbid"
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
* Generated by: https://openapi-generator.tech
|
* Generated by: https://openapi-generator.tech
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Configuration {
|
pub struct Configuration {
|
||||||
pub base_path: String,
|
pub base_path: String,
|
||||||
@@ -29,7 +27,6 @@ pub struct ApiKey {
|
|||||||
pub key: String,
|
pub key: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Configuration {
|
impl Configuration {
|
||||||
pub fn new() -> Configuration {
|
pub fn new() -> Configuration {
|
||||||
Configuration::default()
|
Configuration::default()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub enum Error<T> {
|
|||||||
ResponseError(ResponseContent<T>),
|
ResponseError(ResponseContent<T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl <T> fmt::Display for Error<T> {
|
impl<T> fmt::Display for Error<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let (module, e) = match self {
|
let (module, e) = match self {
|
||||||
Error::Reqwest(e) => ("reqwest", e.to_string()),
|
Error::Reqwest(e) => ("reqwest", e.to_string()),
|
||||||
@@ -28,7 +28,7 @@ impl <T> fmt::Display for Error<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl <T: fmt::Debug> error::Error for Error<T> {
|
impl<T: fmt::Debug> error::Error for Error<T> {
|
||||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||||
Some(match self {
|
Some(match self {
|
||||||
Error::Reqwest(e) => e,
|
Error::Reqwest(e) => e,
|
||||||
@@ -39,19 +39,19 @@ impl <T: fmt::Debug> error::Error for Error<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl <T> From<reqwest::Error> for Error<T> {
|
impl<T> From<reqwest::Error> for Error<T> {
|
||||||
fn from(e: reqwest::Error) -> Self {
|
fn from(e: reqwest::Error) -> Self {
|
||||||
Error::Reqwest(e)
|
Error::Reqwest(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl <T> From<serde_json::Error> for Error<T> {
|
impl<T> From<serde_json::Error> for Error<T> {
|
||||||
fn from(e: serde_json::Error) -> Self {
|
fn from(e: serde_json::Error) -> Self {
|
||||||
Error::Serde(e)
|
Error::Serde(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl <T> From<std::io::Error> for Error<T> {
|
impl<T> From<std::io::Error> for Error<T> {
|
||||||
fn from(e: std::io::Error) -> Self {
|
fn from(e: std::io::Error) -> Self {
|
||||||
Error::Io(e)
|
Error::Io(e)
|
||||||
}
|
}
|
||||||
@@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String
|
|||||||
value,
|
value,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())),
|
serde_json::Value::String(s) => {
|
||||||
|
params.push((format!("{}[{}]", prefix, key), s.clone()))
|
||||||
|
}
|
||||||
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
|
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +98,7 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String
|
|||||||
enum ContentType {
|
enum ContentType {
|
||||||
Json,
|
Json,
|
||||||
Text,
|
Text,
|
||||||
Unsupported(String)
|
Unsupported(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&str> for ContentType {
|
impl From<&str> for ContentType {
|
||||||
@@ -128,7 +130,9 @@ pub struct ApiClient {
|
|||||||
impl ApiClient {
|
impl ApiClient {
|
||||||
pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
|
pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
nginx_agent_api: Box::new(nginx_agent_api::NginxAgentApiClient::new(configuration.clone())),
|
nginx_agent_api: Box::new(nginx_agent_api::NginxAgentApiClient::new(
|
||||||
|
configuration.clone(),
|
||||||
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,4 +163,3 @@ impl Api for MockApiClient {
|
|||||||
&self.nginx_agent_api_mock
|
&self.nginx_agent_api_mock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,44 +8,51 @@
|
|||||||
* Generated by: https://openapi-generator.tech
|
* Generated by: https://openapi-generator.tech
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use super::{configuration, Error};
|
||||||
|
use crate::apis::ContentType;
|
||||||
|
use crate::{apis::ResponseContent, models};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
#[cfg(feature = "mockall")]
|
#[cfg(feature = "mockall")]
|
||||||
use mockall::automock;
|
use mockall::automock;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
|
use serde::{de::Error as _, Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
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)]
|
#[cfg_attr(feature = "mockall", automock)]
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait NginxAgentApi: Send + Sync {
|
pub trait NginxAgentApi: Send + Sync {
|
||||||
|
|
||||||
/// GET /status
|
/// GET /status
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
async fn status(&self, ) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>>;
|
async fn status(&self) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>>;
|
||||||
|
|
||||||
/// POST /validate
|
/// 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
|
/// 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
|
/// 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 {
|
pub struct NginxAgentApiClient {
|
||||||
configuration: Arc<configuration::Configuration>
|
configuration: Arc<configuration::Configuration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NginxAgentApiClient {
|
impl NginxAgentApiClient {
|
||||||
@@ -54,40 +61,38 @@ impl NginxAgentApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// struct for passing parameters to the method [`NginxAgentApi::validate`]
|
/// struct for passing parameters to the method [`NginxAgentApi::validate`]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ValidateParams {
|
pub struct ValidateParams {
|
||||||
pub validate_body: models::ValidateBody
|
pub validate_body: models::ValidateBody,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// struct for passing parameters to the method [`NginxAgentApi::validate_and_reload`]
|
/// struct for passing parameters to the method [`NginxAgentApi::validate_and_reload`]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ValidateAndReloadParams {
|
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`]
|
/// struct for passing parameters to the method [`NginxAgentApi::write_config`]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct WriteConfigParams {
|
pub struct WriteConfigParams {
|
||||||
pub write_config_body: models::WriteConfigBody
|
pub write_config_body: models::WriteConfigBody,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl NginxAgentApi for NginxAgentApiClient {
|
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_configuration = &self.configuration;
|
||||||
|
|
||||||
let local_var_client = &local_var_configuration.client;
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
let local_var_uri_str = format!("{}/status", local_var_configuration.base_path);
|
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 {
|
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()?;
|
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?;
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
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_entity: Option<StatusSuccess> =
|
||||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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)
|
Ok(local_var_result)
|
||||||
} else {
|
} else {
|
||||||
let local_var_entity: Option<StatusError> = serde_json::from_str(&local_var_content).ok();
|
let local_var_entity: Option<StatusError> =
|
||||||
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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))
|
Err(Error::ResponseError(local_var_error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn validate(&self, params: ValidateParams ) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>> {
|
async fn validate(
|
||||||
|
&self,
|
||||||
let ValidateParams {
|
params: ValidateParams,
|
||||||
validate_body,
|
) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>> {
|
||||||
} = params;
|
let ValidateParams { validate_body } = params;
|
||||||
|
|
||||||
|
|
||||||
let local_var_configuration = &self.configuration;
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
let local_var_client = &local_var_configuration.client;
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
let local_var_uri_str = format!("{}/validate", local_var_configuration.base_path);
|
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 {
|
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);
|
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?;
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
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_entity: Option<ValidateSuccess> =
|
||||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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)
|
Ok(local_var_result)
|
||||||
} else {
|
} else {
|
||||||
let local_var_entity: Option<ValidateError> = serde_json::from_str(&local_var_content).ok();
|
let local_var_entity: Option<ValidateError> =
|
||||||
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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))
|
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 {
|
let ValidateAndReloadParams {
|
||||||
validate_and_reload_body,
|
validate_and_reload_body,
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
|
|
||||||
let local_var_configuration = &self.configuration;
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
let local_var_client = &local_var_configuration.client;
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
let local_var_uri_str = format!("{}/validate_and_reload", local_var_configuration.base_path);
|
let local_var_uri_str =
|
||||||
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_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 {
|
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);
|
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?;
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
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_entity: Option<ValidateAndReloadSuccess> =
|
||||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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)
|
Ok(local_var_result)
|
||||||
} else {
|
} else {
|
||||||
let local_var_entity: Option<ValidateAndReloadError> = serde_json::from_str(&local_var_content).ok();
|
let local_var_entity: Option<ValidateAndReloadError> =
|
||||||
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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))
|
Err(Error::ResponseError(local_var_error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn write_config(&self, params: WriteConfigParams ) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>> {
|
async fn write_config(
|
||||||
|
&self,
|
||||||
let WriteConfigParams {
|
params: WriteConfigParams,
|
||||||
write_config_body,
|
) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>> {
|
||||||
} = params;
|
let WriteConfigParams { write_config_body } = params;
|
||||||
|
|
||||||
|
|
||||||
let local_var_configuration = &self.configuration;
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
let local_var_client = &local_var_configuration.client;
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
let local_var_uri_str = format!("{}/write_config", local_var_configuration.base_path);
|
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 {
|
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);
|
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?;
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
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_entity: Option<WriteConfigSuccess> =
|
||||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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)
|
Ok(local_var_result)
|
||||||
} else {
|
} else {
|
||||||
let local_var_entity: Option<WriteConfigError> = serde_json::from_str(&local_var_content).ok();
|
let local_var_entity: Option<WriteConfigError> =
|
||||||
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
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))
|
Err(Error::ResponseError(local_var_error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// struct for typed successes of method [`NginxAgentApi::status`]
|
/// struct for typed successes of method [`NginxAgentApi::status`]
|
||||||
@@ -277,4 +327,3 @@ pub enum WriteConfigError {
|
|||||||
Status500(serde_json::Value),
|
Status500(serde_json::Value),
|
||||||
UnknownValue(serde_json::Value),
|
UnknownValue(serde_json::Value),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
extern crate serde_repr;
|
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
|
extern crate serde_repr;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
pub mod apis;
|
pub mod apis;
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ pub struct StatusResp {
|
|||||||
|
|
||||||
impl StatusResp {
|
impl StatusResp {
|
||||||
pub fn new(ok: bool) -> StatusResp {
|
pub fn new(ok: bool) -> StatusResp {
|
||||||
StatusResp {
|
StatusResp { ok }
|
||||||
ok,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,3 @@ impl ValidateAndReloadBody {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ pub struct ValidateAndReloadResp {
|
|||||||
|
|
||||||
impl ValidateAndReloadResp {
|
impl ValidateAndReloadResp {
|
||||||
pub fn new(rc: i32, ro: String) -> ValidateAndReloadResp {
|
pub fn new(rc: i32, ro: String) -> ValidateAndReloadResp {
|
||||||
ValidateAndReloadResp {
|
ValidateAndReloadResp { rc, ro }
|
||||||
rc,
|
|
||||||
ro,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,3 @@ impl ValidateBody {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,4 +30,3 @@ impl WriteConfigBody {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user