fundaia 0.52.2

Command line for the Fundaia deployment platform: projects, services, variables, deployments, logs and metrics
use super::*;

impl ApiClient {
    pub async fn fix_deployment(&self, deployment_id: &str) -> Result<Answer<AutofixRunPage>> {
        self.post_answer(
            &format!("/api/infra/deployments/{deployment_id}/fix"),
            &serde_json::json!({}),
        )
        .await
    }

    pub async fn start_security_scan(
        &self,
        service_environment_id: &str,
        fix: bool,
    ) -> Result<Answer<SecurityScanPage>> {
        self.post_answer(
            &format!("/api/infra/services/{service_environment_id}/security-scans"),
            &serde_json::json!({ "fix": fix }),
        )
        .await
    }

    pub async fn security_scans(
        &self,
        service_environment_id: &str,
    ) -> Result<Answer<SecurityScansPage>> {
        self.get_answer(&format!(
            "/api/infra/services/{service_environment_id}/security-scans"
        ))
        .await
    }

    pub async fn security_scan(&self, scan_id: &str) -> Result<Answer<SecurityScanPage>> {
        self.get_answer(&format!("/api/infra/security-scans/{scan_id}"))
            .await
    }

    pub async fn open_issue(&self, kind: &str, id: &str) -> Result<Answer<IssuePage>> {
        self.post_answer(
            "/api/infra/issues",
            &serde_json::json!({ "kind": kind, "id": id }),
        )
        .await
    }
}