spiral-sdk 0.1.8

Rust SDK for Spiral resource and table APIs
Documentation
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Transport-independent service interface for local and remote calls."]

use async_trait::async_trait;
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::CallError;

use crate::api::workloads::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait WorkloadsApi: Send + Sync + 'static {
    /// Register a public key with workload manage credentials permission.
    async fn add_key(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
        request: CreateKeyRequest,
    ) -> Result<KeyResponse, CallError<WorkloadsError>>;
    /// Trust an external issuer with workload manage policies permission.
    async fn create_policy(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
        request: CreatePolicyRequest,
    ) -> Result<PolicyResponse, CallError<WorkloadsError>>;
    /// Create a machine identity with workload create permission in the Project.
    async fn create_workload(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: CreateWorkloadRequest,
    ) -> Result<WorkloadResponse, CallError<WorkloadsError>>;
    /// Deactivate a machine identity and revoke its credentials and trust policies with workload
    /// create permission.
    async fn deactivate_workload(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
    ) -> Result<(), CallError<WorkloadsError>>;
    /// List public keys with workload view permission.
    async fn list_keys(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
        request: PageRequest,
    ) -> Result<KeyPage, CallError<WorkloadsError>>;
    /// List trust policies with workload view permission.
    async fn list_policies(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
        request: PageRequest,
    ) -> Result<PolicyPage, CallError<WorkloadsError>>;
    /// List active machine identities with workload view permission in the Project.
    async fn list_workloads(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: PageRequest,
    ) -> Result<WorkloadPage, CallError<WorkloadsError>>;
    /// Read a machine identity with workload view permission.
    async fn read_workload(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
    ) -> Result<Workload, CallError<WorkloadsError>>;
    /// Remove a public key with workload manage credentials permission.
    async fn remove_key(
        &self,
        auth_header: AuthHeader,
        workload_id: String,
        kid: String,
    ) -> Result<(), CallError<WorkloadsError>>;
    /// Remove a trust policy with workload manage policies permission.
    async fn remove_policy(
        &self,
        auth_header: AuthHeader,
        policy_id: String,
    ) -> Result<(), CallError<WorkloadsError>>;
    /// Revoke an existing client credential with workload manage credentials permission.
    async fn revoke_credentials(
        &self,
        auth_header: AuthHeader,
        client_id: String,
    ) -> Result<(), CallError<WorkloadsError>>;
}