stormchaser_model/dsl/storage.rs
1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4/// Storage volume definition to be provisioned.
5#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
6pub struct Storage {
7 /// Logical name of the storage volume.
8 pub name: String,
9 /// Type of backend (e.g., 's3', 'gcs').
10 pub backend: Option<String>,
11 /// Size of the storage requested.
12 pub size: String,
13 /// Pre-provisioning instructions (e.g., download an artifact into it).
14 pub provision: Vec<Provision>,
15 /// Paths to preserve after execution.
16 pub preserve: Vec<String>,
17 /// Artifacts to upload.
18 pub artifacts: Vec<Artifact>,
19 /// Retention policy for the storage.
20 pub retainment: Option<String>,
21}
22
23/// Instructions for provisioning data into storage.
24#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
25pub struct Provision {
26 /// Type of resource to provision.
27 pub resource_type: String, // "secret", "config", "download", "artifact"
28 /// Name of the provision block.
29 pub name: String,
30 /// Source reference.
31 pub source: Option<String>,
32 /// URL to download from.
33 pub url: Option<String>,
34 /// Destination path.
35 pub destination: String,
36 /// File mode/permissions.
37 pub mode: Option<String>,
38 /// Verification checksum.
39 pub checksum: Option<String>,
40 /// Optional specific origin.
41 pub from: Option<String>,
42}
43
44/// Definition of an artifact to collect and upload.
45#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
46pub struct Artifact {
47 /// Logical name of the artifact.
48 pub name: String,
49 /// Local path to the artifact file or directory.
50 pub path: String,
51 /// Retention period.
52 pub retention: String,
53}
54
55/// Mount definition for attaching storage to a container.
56#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
57pub struct StorageMount {
58 /// Name of the storage volume to mount.
59 pub name: String,
60 /// Path where the volume should be mounted inside the container.
61 pub mount_path: String,
62 /// Whether the mount should be read-only.
63 pub read_only: Option<bool>,
64 /// Step-specific paths to preserve when parking the volume, overriding the top-level storage config.
65 #[serde(default)]
66 pub preserve: Option<Vec<String>>,
67}