1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Storage backend and artifact registry models.
use crate::id::{ArtifactId, BackendId, RunId, StepInstanceId};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use utoipa::ToSchema;
/// Supported storage backend types for artifacts and engine data.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::Type, PartialEq, Eq, ToSchema)]
#[sqlx(type_name = "backend_type", rename_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum BackendType {
/// Amazon S3 or compatible storage.
S3,
/// OCI-compliant registry.
Oci,
/// JFrog Artifactory.
Jfrog,
/// Google Cloud Storage.
Gcs,
/// Azure Blob Storage.
Azure,
}
/// Represents a configured storage backend instance.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::FromRow, ToSchema)]
pub struct StorageBackend {
/// Unique identifier for the storage backend.
pub id: BackendId,
/// Logical name of the backend.
pub name: String,
/// Optional description of the backend's purpose.
pub description: Option<String>,
/// The type of storage backend.
pub backend_type: BackendType,
/// JSON configuration specific to the backend type.
pub config: Value,
/// Optional AWS role ARN to assume via STS (primarily for S3).
pub aws_assume_role_arn: Option<String>,
/// Whether this backend is the default Stormchaser File System (SFS).
pub is_default_sfs: bool,
/// Optional custom CA certificate for mTLS.
pub ca_cert: Option<String>,
/// Optional client certificate for mTLS.
pub client_cert: Option<String>,
/// Optional client private key for mTLS.
pub client_key: Option<String>,
/// Timestamp when the backend was registered.
pub created_at: chrono::DateTime<chrono::Utc>,
/// Timestamp when the backend configuration was last updated.
pub updated_at: chrono::DateTime<chrono::Utc>,
}
/// Registry of workflow artifacts stored in backends.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::FromRow, ToSchema)]
pub struct ArtifactRegistry {
/// Unique identifier for the artifact record.
pub id: ArtifactId,
/// Associated workflow run ID.
pub run_id: RunId,
/// Associated step instance ID that produced the artifact.
pub step_instance_id: StepInstanceId,
/// Logical name of the artifact.
pub artifact_name: String,
/// Identifier of the storage backend where the artifact is located.
pub backend_id: BackendId,
/// Path or locator within the storage backend.
pub remote_path: String,
/// Additional metadata about the artifact.
pub metadata: Value,
/// Timestamp when the artifact was registered.
pub created_at: chrono::DateTime<chrono::Utc>,
}