/
flags.go
184 lines (160 loc) · 4.63 KB
/
flags.go
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
package main
import (
"github.com/TimeIncOSS/ape-dev-rt/commons"
"github.com/TimeIncOSS/ape-dev-rt/git"
"github.com/TimeIncOSS/ape-dev-rt/validators"
"github.com/urfave/cli"
)
type FlagDefinitions struct {
Config cli.StringFlag
Profile cli.StringFlag
Module cli.StringFlag
Path commons.StringFlag
Skeleton commons.StringFlag
AwsProfile commons.StringFlag
AwsRegion commons.StringFlag
Environment commons.StringFlag
AppName commons.StringFlag
SlotID commons.StringFlag
OlderThan commons.StringFlag
Namespace commons.StringFlag
OutputName cli.StringFlag
Target cli.StringFlag
Refresh cli.BoolFlag
Verbose cli.BoolFlag
EnableFileLogging cli.BoolTFlag
YesOverride cli.BoolFlag
Force cli.BoolFlag
Variable cli.StringSliceFlag
SlotPrefix cli.StringFlag
PreviousSlot cli.BoolFlag
}
var flags = FlagDefinitions{
Config: cli.StringFlag{
Name: "config",
Usage: "Path to the RT configuration file, defaults to ~/.rt/config",
EnvVar: "RT_CONFIG",
},
Profile: cli.StringFlag{
Name: "profile",
Usage: "Name profile to load from RT configuration, ~/.rt/config",
EnvVar: "RT_PROFILE",
},
Module: cli.StringFlag{
Name: "module",
Usage: "Name of the module the resource belongs to",
},
Path: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "path",
Usage: "Local path to clone of the apps GIT repository (" + git.AppConfigRepoUrl + ")",
EnvVar: "RT_PATH",
},
Validator: validators.StringIsValidPath,
},
Skeleton: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "skeleton",
Usage: "",
Value: "default",
},
Validator: validators.NonEmptyString,
},
AwsProfile: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "aws-profile",
Usage: "Specify the AWS Credential Profile used to resolve AWS credentials",
Value: "default",
EnvVar: "RT_AWS_PROFILE",
},
Validator: validators.NonEmptyString,
},
AwsRegion: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "aws-region",
Usage: "Specify the AWS Region where application resources reside",
Value: "us-east-1",
EnvVar: "RT_AWS_REGION",
},
Validator: validators.NonEmptyString,
},
Environment: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "env",
Usage: "The AWS environment name, used to lookup the application state in S3 ([a-zA-Z0-9_]+)",
EnvVar: "RT_ENV",
},
Validator: validators.IsEnvironmentNameValid,
},
AppName: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "app",
Usage: "Name of the AWS application ([a-z0-9-_]+)",
},
Validator: validators.IsApplicationNameValid,
},
SlotID: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "slot-id",
Usage: "Name of the slot",
},
Validator: validators.IsSlotIDValid,
},
Refresh: cli.BoolFlag{
Name: "refresh",
Usage: "Will update the cached realease tool state by interrogating the AWS API",
},
Verbose: cli.BoolFlag{
Name: "verbose, v",
Usage: "Prints all log messages",
EnvVar: "RT_LOG",
},
EnableFileLogging: cli.BoolTFlag{
Name: "enable-file-logging",
Usage: "Sends all log messages to designated location",
EnvVar: "RT_ENABLE_FILE_LOGGING",
},
YesOverride: cli.BoolFlag{
Name: "y, yes, yas", //yas is a term used by young people to mean yes
Usage: "Makes operations non-interactive by confirming all prompts and defaults",
},
Force: cli.BoolFlag{
Name: "f, force",
Usage: "Forces an Apply or Destroy command without a need for a creation or deletion of resources",
},
Variable: cli.StringSliceFlag{
Name: "var",
Usage: "Variable to pass to Terraform. e.g. -var=key=val",
},
SlotPrefix: cli.StringFlag{
Name: "slot-prefix",
Usage: "Slot prefix",
},
PreviousSlot: cli.BoolFlag{
Name: "previous-slot",
Usage: "Whether to use previous slot with given slot prefix",
},
OlderThan: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "older-than",
Usage: "Time period in which to cleanup slots (e.g. 7day for 7 days, see github.com/ninibe/bigduration)",
},
Validator: validators.IsBigDurationValid,
},
Namespace: commons.StringFlag{
StringFlag: cli.StringFlag{
Name: "namespace",
Usage: "Namespace for the tfstate files. Value defaults to AWS Account ID",
Value: "default",
},
Validator: validators.IsNamespaceValid,
},
OutputName: cli.StringFlag{
Name: "name",
Usage: "Name of the output value",
},
Target: cli.StringFlag{
Name: "target",
Usage: "A resource address to target. [module path][resource spec]",
},
}