Skip to main content

twc_rs/cli/
s3.rs

1// SPDX-FileCopyrightText: 2026 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4//! S3 storage subcommands.
5
6use clap::Subcommand;
7
8/// S3 storage subcommands.
9#[derive(Subcommand, Debug)]
10pub enum S3Commands {
11    /// List all S3 storages.
12    List {
13        /// Maximum number of storages to return.
14        #[arg(long)]
15        limit: Option<i32>,
16
17        /// Number of storages to skip.
18        #[arg(long)]
19        offset: Option<i32>
20    },
21    /// Show detailed info for a storage.
22    Info {
23        /// Storage ID.
24        #[arg(long)]
25        id: i32
26    },
27    /// Create a new S3 storage.
28    Create {
29        /// Storage name.
30        #[arg(long)]
31        name: String,
32
33        /// Preset ID for the storage.
34        #[arg(short = 'p', long)]
35        preset_id: Option<f64>
36    },
37    /// Delete a storage by ID.
38    Delete {
39        /// Storage ID.
40        #[arg(long)]
41        id: i32
42    },
43    /// Update storage settings.
44    Update {
45        /// Storage ID.
46        #[arg(long)]
47        id: i32,
48
49        /// New storage description.
50        #[arg(long)]
51        description: Option<String>
52    },
53    /// List users for a storage.
54    UserList {
55        /// Storage ID.
56        #[arg(long)]
57        id: i32
58    },
59    /// Update a storage user.
60    UserUpdate {
61        /// Storage user ID.
62        #[arg(long)]
63        user_id: i32
64    },
65    /// Transfer a storage.
66    Transfer {
67        /// Target storage ID (reserved for future use).
68        #[arg(long)]
69        target_id: Option<i32>
70    },
71    /// List subdomains for a storage.
72    SubdomainList {
73        /// Storage ID.
74        #[arg(long)]
75        id: i32
76    },
77    /// Add a subdomain to a storage.
78    SubdomainAdd {
79        /// Storage ID.
80        #[arg(long)]
81        id: i32,
82
83        /// Subdomain name.
84        #[arg(long)]
85        subdomain: String
86    },
87    /// Delete a subdomain from a storage.
88    SubdomainDelete {
89        /// Storage ID.
90        #[arg(long)]
91        id: i32,
92
93        /// Subdomain name.
94        #[arg(long)]
95        subdomain: String
96    },
97    /// List available storage presets.
98    PresetList,
99    /// Print an s3cmd config file for a storage.
100    Genconfig {
101        /// Storage ID.
102        #[arg(long)]
103        id: i32
104    }
105}