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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
use super::non_empty;
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Debug, Subcommand)]
pub enum FleetAction {
/// Manage Fleet agent policies
AgentPolicies {
#[command(subcommand)]
action: AgentPoliciesAction,
},
/// Manage Fleet integration policies
IntegrationPolicies {
#[command(subcommand)]
action: IntegrationPoliciesAction,
},
}
#[derive(Debug, Subcommand)]
pub enum AgentPoliciesAction {
/// List agent policies
List {
/// Case-insensitive substring over id and name
#[arg(long, value_parser = non_empty)]
search: Option<String>,
/// Cap the rows returned after sorting by id
#[arg(long)]
limit: Option<usize>,
},
/// Show one agent policy by id or exact name
Get { selector: String },
/// Check a portable agent-policy file without contacting a server
Validate {
#[arg(long)]
path: PathBuf,
},
/// Export portable agent policies
Export {
/// Agent-policy ids or exact names
#[arg(conflicts_with = "all_custom")]
selectors: Vec<String>,
/// Export every policy that is not platform-owned
#[arg(long)]
all_custom: bool,
/// File format: json or yaml. This is separate from the global renderer.
#[arg(long = "format-file", default_value = "json")]
format_file: String,
},
/// Import portable agent policies
Import {
#[arg(long)]
path: PathBuf,
/// Replace agent policies that already exist
#[arg(long, conflicts_with = "skip_existing")]
overwrite: bool,
/// Leave agent policies that already exist alone instead of failing
#[arg(long, conflicts_with = "overwrite")]
skip_existing: bool,
},
/// Delete agent policies that have no agents or integrations
Delete {
/// Agent-policy ids or exact names
#[arg(required = true)]
selectors: Vec<String>,
},
}
#[derive(Debug, Subcommand)]
pub enum IntegrationPoliciesAction {
/// List integration policies
List {
/// Case-insensitive substring over id and name
#[arg(long, value_parser = non_empty)]
search: Option<String>,
/// Cap the rows returned after sorting by id
#[arg(long)]
limit: Option<usize>,
},
/// Show one integration policy by id or exact name
Get {
#[arg(value_parser = non_empty)]
selector: String,
},
/// Check a portable integration-policy file without contacting a server
Validate {
#[arg(long)]
path: PathBuf,
},
/// Export portable integration policies
Export {
/// Integration-policy ids or exact names
#[arg(conflicts_with = "all_custom", value_parser = non_empty)]
selectors: Vec<String>,
/// Export every integration policy that is not platform-owned
#[arg(long)]
all_custom: bool,
/// File format: json or yaml. This is separate from the global renderer.
#[arg(long = "format-file", default_value = "json")]
format_file: String,
},
/// Import portable integration policies
Import {
#[arg(long)]
path: PathBuf,
/// Replace integration policies that already exist
#[arg(long, conflicts_with = "skip_existing")]
overwrite: bool,
/// Leave integration policies that already exist alone instead of failing
#[arg(long, conflicts_with = "overwrite")]
skip_existing: bool,
},
/// Delete integration policies
Delete {
/// Integration-policy ids or exact names
#[arg(required = true, value_parser = non_empty)]
selectors: Vec<String>,
},
}