#![allow(clippy::too_many_arguments)]
use crate::AxiamError;
use crate::client::AxiamClient;
use crate::management::models;
use crate::management::request::{Call, Verb};
use crate::management::scope::Scope;
#[derive(Clone, Copy)]
pub struct Platform<'c> {
pub(crate) client: &'c AxiamClient,
pub(crate) scope: Scope,
}
impl std::fmt::Debug for Platform<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Platform")
.field("scope", &self.scope)
.finish()
}
}
impl<'c> Platform<'c> {
pub(crate) fn new(client: &'c AxiamClient) -> Self {
Self {
client,
scope: Scope::default(),
}
}
pub async fn health(&self) -> Result<models::HealthResponse, AxiamError> {
let query: Vec<(&'static str, String)> = Vec::new();
let call = Call {
operation: "platform.health",
verb: Verb::Get,
path_template: "/health",
path: "/health".to_string(),
query: &query,
};
self.client
.management_send::<_, models::HealthResponse>(call, None::<&()>)
.await
}
pub async fn ready(&self) -> Result<models::ReadyResponse, AxiamError> {
let query: Vec<(&'static str, String)> = Vec::new();
let call = Call {
operation: "platform.ready",
verb: Verb::Get,
path_template: "/ready",
path: "/ready".to_string(),
query: &query,
};
self.client
.management_send::<_, models::ReadyResponse>(call, None::<&()>)
.await
}
pub async fn mds_status(&self) -> Result<models::MdsStatusResponse, AxiamError> {
let query: Vec<(&'static str, String)> = Vec::new();
let call = Call {
operation: "platform.mds_status",
verb: Verb::Get,
path_template: "/api/v1/mds/status",
path: "/api/v1/mds/status".to_string(),
query: &query,
};
self.client
.management_send::<_, models::MdsStatusResponse>(call, None::<&()>)
.await
}
pub async fn mds_refresh(&self) -> Result<models::MdsRefreshOutcome, AxiamError> {
let query: Vec<(&'static str, String)> = Vec::new();
let call = Call {
operation: "platform.mds_refresh",
verb: Verb::Post,
path_template: "/api/v1/mds/refresh",
path: "/api/v1/mds/refresh".to_string(),
query: &query,
};
self.client
.management_send::<_, models::MdsRefreshOutcome>(call, None::<&()>)
.await
}
}