spiral-sdk 0.1.9

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::storage::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait StorageApi: Send + Sync + 'static {
    /// Create a scoped mount for a project.
    async fn create_mount(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: CreateMountRequest,
    ) -> Result<CreateMountResponse, CallError<StorageError>>;
    /// Issue a scoped storage access token for an authorized service.
    async fn issue_mount_token(
        &self,
        auth_header: AuthHeader,
        mount_id: String,
        request: IssueMountTokenRequest,
    ) -> Result<IssueMountTokenResponse, CallError<StorageError>>;
    /// List mounts visible within a project.
    async fn list_mounts(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: PageRequest,
    ) -> Result<MountPage, CallError<StorageError>>;
    /// List mounts for an operator-selected storage location and principal.
    async fn list_mounts_global(
        &self,
        auth_header: AuthHeader,
        request: GlobalMountsRequest,
    ) -> Result<MountPage, CallError<StorageError>>;
    /// List usable Volumes. Organization owners also see configuration and inactive Volumes.
    async fn list_volumes(
        &self,
        auth_header: AuthHeader,
        request: PageRequest,
    ) -> Result<VolumePage, CallError<StorageError>>;
    /// Read one active mount.
    async fn read_mount(
        &self,
        auth_header: AuthHeader,
        mount_id: String,
    ) -> Result<Mount, CallError<StorageError>>;
    /// Read an active mount and its storage configuration.
    async fn read_mount_storage(
        &self,
        auth_header: AuthHeader,
        mount_id: String,
    ) -> Result<GetMountAndFileSystemResponse, CallError<StorageError>>;
    /// Read where a project allocates new tables and Vector Indexes.
    async fn read_project_storage(
        &self,
        auth_header: AuthHeader,
        project_id: String,
    ) -> Result<ProjectStorageView, CallError<StorageError>>;
    /// Register a storage bucket as an organization Volume.
    async fn register_volume(
        &self,
        auth_header: AuthHeader,
        request: RegisterVolumeRequest,
    ) -> Result<VolumeView, CallError<StorageError>>;
    /// Revoke mount authorization edges and remove the mount.
    async fn remove_mount(
        &self,
        auth_header: AuthHeader,
        mount_id: String,
    ) -> Result<(), CallError<StorageError>>;
    /// Select the storage used for new resources in a project.
    async fn select_project_storage(
        &self,
        auth_header: AuthHeader,
        project_id: String,
        request: ProjectStorage,
    ) -> Result<ProjectStorageView, CallError<StorageError>>;
    /// Test that storage reaches an organization Volume's root as a table write does. Provider
    /// refusals are reported in the response.
    async fn test_volume(
        &self,
        auth_header: AuthHeader,
        volume_id: String,
    ) -> Result<TestVolumeResponse, CallError<StorageError>>;
    /// Replace the credential for the same Volume storage bucket.
    async fn update_volume_credential(
        &self,
        auth_header: AuthHeader,
        volume_id: String,
        request: UpdateVolumeCredentialRequest,
    ) -> Result<VolumeView, CallError<StorageError>>;
    /// Retire, revoke or reactivate an organization Volume.
    async fn update_volume_status(
        &self,
        auth_header: AuthHeader,
        volume_id: String,
        request: UpdateVolumeStatusRequest,
    ) -> Result<VolumeView, CallError<StorageError>>;
}