forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws-vault.ts
161 lines (158 loc) · 3.43 KB
/
aws-vault.ts
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
const profilesGenerator: Fig.Generator = {
script: ["aws-vault", "list", "--profiles"],
postProcess(out) {
return out.split("\n").map((name) => ({ name }));
},
};
const subcommands: Fig.Subcommand[] = [
{
name: "add",
description: "Add credentials to the secure keystore",
args: {
name: "profile",
description: "The profile you want to add",
},
},
{
name: "remove",
description: "Remove credentials from the secure keystore",
args: {
name: "profile",
generators: profilesGenerator,
},
options: [
{
name: ["-f", "--force"],
description: "Force-remove the profile without a prompt",
},
],
},
{
name: "list",
description: "List profiles, along with their credentials and sessions",
options: [
{
name: "--profiles",
description: "Show only the profile names",
},
{
name: "--sessions",
description: "Show only the session names",
},
{
name: "--credentials",
description: "Show only the profiles with stored credential",
},
],
},
{
name: "rotate",
description: "Rotate credentials",
args: {
name: "profile",
generators: profilesGenerator,
},
options: [
{
name: ["-n", "--no-session"],
description: "Use master credentials, no session or role used",
},
],
},
{
name: "exec",
description: "Execute a command with AWS credentials",
args: [
{
name: "profile",
generators: profilesGenerator,
},
{
name: "command",
isCommand: true,
},
],
options: [
{
name: ["-d", "--duration"],
description:
"Duration of the temporary or assume-role session. Defaults to 1h",
args: {
name: "DURATION",
},
},
{
name: ["-n", "--no-session"],
description: "Use master credentials, no session or role used",
},
{
name: "--region",
description: "The AWS region",
args: {
name: "REGION",
},
},
{
name: ["-t", "--mfa-token"],
description: "The MFA token to use",
args: {
name: "MFA-TOKEN",
},
},
],
},
{
name: "export",
description: "Export AWS credentials",
args: {
name: "profile",
generators: profilesGenerator,
},
},
{
name: "clear",
description: "Clear temporary credentials from the secure keystore",
args: {
name: "profile",
generators: profilesGenerator,
},
},
{
name: "login",
description: "Generate a login link for the AWS Console",
args: {
name: "profile",
generators: profilesGenerator,
},
},
{
name: "help",
description: "Show help about the command",
args: {
name: "command",
template: "help",
},
},
];
const completionSpec: Fig.Spec = {
name: "aws-vault",
description:
"A vault for securely storing and accessing AWS credentials in development environments",
subcommands,
options: [
{
name: "--help",
description:
"Show context-sensitive help (also try --help-long and --help-man)",
},
{
name: "--version",
description: "Show application version",
},
{
name: "--debug",
description: "Show debugging output",
},
],
};
export default completionSpec;