gcloud_utils/cli/
mod.rs

1use clap::{Args, Parser, Subcommand};
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Debug)]
5pub struct GcpConfig {
6    pub project_id: String,
7    pub service_name: String,
8    pub region: String,
9}
10
11#[derive(Parser)]
12#[clap(name = "gcloud-utils")]
13#[clap(about = "Google Cloud gcloud SDK Rust Wrapper")]
14#[clap(author = "EpicsDAO", version, long_about = None)]
15pub struct Cli {
16    #[clap(subcommand)]
17    pub command: Commands,
18}
19
20#[derive(Subcommand)]
21pub enum Commands {
22    Iam(Iam),
23    Run(Run),
24    Gh(Gh),
25    Init(Init),
26    Compute(Compute),
27    Docker(Docker),
28    Sql(Sql)
29}
30
31#[derive(Debug, Args)]
32#[clap(args_conflicts_with_subcommands = true)]
33pub struct Iam {
34    #[clap(subcommand)]
35    pub command: Option<IamCommands>,
36}
37
38#[derive(Debug, Args)]
39#[clap(args_conflicts_with_subcommands = true)]
40pub struct Compute {
41    #[clap(subcommand)]
42    pub command: Option<ComputeCommands>,
43}
44
45#[derive(Debug, Args)]
46#[clap(args_conflicts_with_subcommands = true)]
47pub struct Init {
48    #[clap(subcommand)]
49    pub command: Option<InitCommands>,
50}
51
52#[derive(Debug, Args)]
53#[clap(args_conflicts_with_subcommands = true)]
54pub struct Gh {
55    #[clap(subcommand)]
56    pub command: Option<GhCommands>,
57}
58
59#[derive(Debug, Args)]
60#[clap(args_conflicts_with_subcommands = true)]
61pub struct Run {
62    #[clap(subcommand)]
63    pub command: Option<RunCommands>,
64}
65
66#[derive(Debug, Args)]
67#[clap(args_conflicts_with_subcommands = true)]
68pub struct Docker {
69    #[clap(subcommand)]
70    pub command: Option<DockerCommands>,
71}
72
73#[derive(Debug, Args)]
74#[clap(args_conflicts_with_subcommands = true)]
75pub struct Sql {
76    #[clap(subcommand)]
77    pub command: Option<SqlCommands>,
78}
79
80#[derive(Debug, Subcommand)]
81pub enum IamCommands {
82    Setup,
83    Help,
84}
85
86#[derive(Debug, Subcommand)]
87pub enum ComputeCommands {
88    CreateNat,
89    Help,
90}
91
92#[derive(Debug, Subcommand)]
93pub enum InitCommands {
94    Config,
95    GhActions {
96        #[clap(short, long)]
97        nat: bool,
98    },
99    Help,
100}
101
102#[derive(Debug, Subcommand)]
103pub enum GhCommands {
104    AddEnv,
105    Help,
106}
107
108#[derive(Debug, Subcommand)]
109pub enum RunCommands {
110    Build,
111    Deploy,
112    Help,
113}
114
115#[derive(Debug, Subcommand)]
116pub enum DockerCommands {
117    Psql,
118    Build,
119    Push,
120    Help,
121}
122
123#[derive(Debug, Subcommand)]
124pub enum SqlCommands {
125    Create,
126    SetPrivateIp,
127    Help
128}