axiam-sdk 1.2.2

Official Rust client SDK for AXIAM IAM
Documentation
// @generated by tools/gen_management.py from management-registry.json and
// openapi.json. DO NOT EDIT -- your changes will be overwritten. Regenerate
// with `tools/gen_management.py`; CI verifies the committed output is current.

//! The `platform` management namespace (CONTRACT §27.1).
//!
//! Deployment-level probes and FIDO metadata state. Unauthenticated where the
//! server leaves them so.

#![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;

/// The `platform` namespace handle.
///
/// Deployment-level probes and FIDO metadata state. Unauthenticated where the
/// server leaves them so.
///
/// Acquiring one performs no I/O and allocates nothing meaningful (§27.2 rule
/// 1); it borrows the client and cannot outlive it.
#[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(),
        }
    }

    /// `GET /health`
    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
    }

    /// `GET /ready`
    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
    }

    /// `GET /api/v1/mds/status`
    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
    }

    /// `POST /api/v1/mds/refresh`
    /// Not retried on failure (§27.4 rule 8): every write on this surface is
    /// issued exactly once, including the ones that look idempotent.
    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
    }
}