foundation_deployment_docker 0.1.3

Docker Engine API v1.53 client over DynNetClient + valtron (bollard-free)
//! Auto-generated API module for docker swarm.
//!
//! Generated by `cargo run --bin ewe_platform gen_api`.
//! DO NOT EDIT MANUALLY.
//!
//! Feature flag: `docker_swarm `

#![cfg(feature = "docker_swarm")]
#![allow(clippy::too_many_arguments, clippy::type_complexity)]
#![allow(
    clippy::missing_errors_doc,
    clippy::doc_markdown,
    clippy::useless_format
)]
#![allow(unused_imports)]

use foundation_macros::JsonHash;
use foundation_netio::shared::client::http_client::HttpClient;
use foundation_netio::{DynNetClient, PreparedRequestBuilder};
use serde::{Deserialize, Serialize};

// Import shared types used by this module
use super::shared::ObjectVersion;

use super::shared::ApiResponse;

// =============================================================================
// TYPE DECLARATIONS
// =============================================================================

/// `ClusterInfo` type.
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ClusterInfo {
    /// `CreatedAt` property.
    #[serde(rename = "CreatedAt")]
    pub created_at: Option<String>,
    /// `DataPathPort` property.
    #[serde(rename = "DataPathPort")]
    pub data_path_port: Option<i64>,
    /// `DefaultAddrPool` property.
    #[serde(rename = "DefaultAddrPool")]
    pub default_addr_pool: Option<Vec<String>>,
    /// `ID` property.
    #[serde(rename = "ID")]
    pub id: Option<String>,
    /// `RootRotationInProgress` property.
    #[serde(rename = "RootRotationInProgress")]
    pub root_rotation_in_progress: Option<bool>,
    /// `Spec` property.
    #[serde(rename = "Spec")]
    pub spec: Option<SwarmSpec>,
    /// `SubnetSize` property.
    #[serde(rename = "SubnetSize")]
    pub subnet_size: Option<i64>,
    /// `TLSInfo` property.
    #[serde(rename = "TLSInfo")]
    pub tls_info: Option<TLSInfo>,
    /// `UpdatedAt` property.
    #[serde(rename = "UpdatedAt")]
    pub updated_at: Option<String>,
    /// `Version` property.
    #[serde(rename = "Version")]
    pub version: Option<ObjectVersion>,
}

/// `JoinTokens` type.
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct JoinTokens {
    /// `Manager` property.
    #[serde(rename = "Manager")]
    pub manager: Option<String>,
    /// `Worker` property.
    #[serde(rename = "Worker")]
    pub worker: Option<String>,
}

/// `Swarm` type.
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct Swarm {
    /// `CreatedAt` property.
    #[serde(rename = "CreatedAt")]
    pub created_at: Option<String>,
    /// `DataPathPort` property.
    #[serde(rename = "DataPathPort")]
    pub data_path_port: Option<i64>,
    /// `DefaultAddrPool` property.
    #[serde(rename = "DefaultAddrPool")]
    pub default_addr_pool: Option<Vec<String>>,
    /// `ID` property.
    #[serde(rename = "ID")]
    pub id: Option<String>,
    /// `JoinTokens` property.
    #[serde(rename = "JoinTokens")]
    pub join_tokens: Option<JoinTokens>,
    /// `RootRotationInProgress` property.
    #[serde(rename = "RootRotationInProgress")]
    pub root_rotation_in_progress: Option<bool>,
    /// `Spec` property.
    #[serde(rename = "Spec")]
    pub spec: Option<SwarmSpec>,
    /// `SubnetSize` property.
    #[serde(rename = "SubnetSize")]
    pub subnet_size: Option<i64>,
    /// `TLSInfo` property.
    #[serde(rename = "TLSInfo")]
    pub tls_info: Option<TLSInfo>,
    /// `UpdatedAt` property.
    #[serde(rename = "UpdatedAt")]
    pub updated_at: Option<String>,
    /// `Version` property.
    #[serde(rename = "Version")]
    pub version: Option<ObjectVersion>,
}

/// `SwarmSpec` type.
///
/// Same shape as `super::shared::SwarmSpecShape`.
pub type SwarmSpec = super::shared::SwarmSpecShape;

/// `TLSInfo` type.
///
/// Same shape as `super::shared::CertIssuerPublicKeyCertIssuerSubjectTrustRootObject`.
pub type TLSInfo = super::shared::CertIssuerPublicKeyCertIssuerSubjectTrustRootObject;

// =============================================================================
// ARGS TYPES (per-endpoint)
// =============================================================================

/// Arguments for [`SwarmInspect_request`].
///
/// Same shape as `super::shared::EmptyArgs`.
pub type SwarmInspectArgs = super::shared::EmptyArgs;

// =============================================================================
// CLIENT FUNCTIONS (per-endpoint)
// =============================================================================

// -----------------------------------------------------------------------------
// GET /swarm
// -----------------------------------------------------------------------------

/// GET /swarm.
///
/// Takes a client and args, builds the request, optionally applies
/// modifications, then sends it via `send_async().await`.
///
/// # Arguments
///
/// * `client` - HTTP client for making the request: a `DynNetClient`, or an `ApiClient` carrying the `BodyLimits` the response is read under
/// * `args` - Request arguments (path params, query params, body)
/// * `builder_mod` - Optional closure to modify the request builder (e.g., add headers)
///
/// # Example
///
/// ```ignore
/// let response = swarm_inspect_request(client.clone(), &args, Some(|b: &mut PreparedRequestBuilder| {
///     b.header("X-Custom-Header", "value");
/// })).await?;
/// ```
pub async fn swarm_inspect_request<F>(
    client: impl Into<super::shared::ApiClient>,
    _args: &SwarmInspectArgs,
    base_url: &str,
    builder_mod: Option<F>,
) -> Result<ApiResponse<Swarm>, super::shared::ApiError>
where
    F: FnOnce(&mut PreparedRequestBuilder),
{
    let path = format!("/swarm",);
    let endpoint_url = format!("{}{}", base_url, path);

    let mut builder = PreparedRequestBuilder::get(&endpoint_url)
        .map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;

    if let Some(f) = builder_mod {
        f(&mut builder);
    }

    super::shared::send_json(client.into(), builder.build()).await
}