-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathmod.rs
48 lines (39 loc) · 1.19 KB
/
mod.rs
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
mod check;
mod delete;
mod fetch;
mod list;
mod push;
use serde::Serialize;
use structopt::StructOpt;
use crate::client::StudioClientConfig;
use crate::command::RoverStdout;
use crate::Result;
#[derive(Debug, Serialize, StructOpt)]
pub struct Subgraph {
#[structopt(subcommand)]
command: Command,
}
#[derive(Debug, Serialize, StructOpt)]
pub enum Command {
/// Check changes to an subgraph
Check(check::Check),
/// Delete a subgraph and trigger composition
Delete(delete::Delete),
/// Fetch a subgraph's schema from Apollo Studio
Fetch(fetch::Fetch),
/// Push a subgraph's schema from a local file
Push(push::Push),
/// List all subgraphs for a federated graph.
List(list::List),
}
impl Subgraph {
pub fn run(&self, client_config: StudioClientConfig) -> Result<RoverStdout> {
match &self.command {
Command::Push(command) => command.run(client_config),
Command::Delete(command) => command.run(client_config),
Command::Fetch(command) => command.run(client_config),
Command::Check(command) => command.run(client_config),
Command::List(command) => command.run(client_config),
}
}
}