You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd:=app.Command("exec", "Execute a command with AWS credentials.")
73
-
74
-
cmd.Flag("duration", "Duration of the temporary or assume-role session. Defaults to 1h").
75
-
Short('d').
76
-
DurationVar(&input.SessionDuration)
77
-
78
-
cmd.Flag("no-session", "Skip creating STS session with GetSessionToken").
79
-
Short('n').
80
-
BoolVar(&input.NoSession)
81
-
82
-
cmd.Flag("region", "The AWS region").
83
-
StringVar(&input.Config.Region)
84
-
85
-
cmd.Flag("mfa-token", "The MFA token to use").
86
-
Short('t').
87
-
StringVar(&input.Config.MfaToken)
88
-
89
-
cmd.Flag("json", "Output credentials in JSON that can be used by credential_process").
90
-
Short('j').
91
-
Hidden().
92
-
BoolVar(&input.JSONDeprecated)
93
-
94
-
cmd.Flag("server", "Alias for --ecs-server").
95
-
Short('s').
96
-
BoolVar(&input.StartEcsServer)
97
-
98
-
cmd.Flag("ec2-server", "Run a EC2 metadata server in the background for credentials").
99
-
BoolVar(&input.StartEc2Server)
100
-
101
-
cmd.Flag("ecs-server", "Run a ECS credential server in the background for credentials (the SDK or app must support AWS_CONTAINER_CREDENTIALS_FULL_URI)").
102
-
BoolVar(&input.StartEcsServer)
103
-
104
-
cmd.Flag("lazy", "When using --ecs-server, lazily fetch credentials").
105
-
BoolVar(&input.Lazy)
106
-
107
-
cmd.Flag("stdout", "Print the SSO link to the terminal without automatically opening the browser").
returnfmt.Errorf("unable to select a 'profile'. Try --help: %w", err)
120
+
}
141
121
142
-
iferr!=nil {
143
-
returnfmt.Errorf("unable to select a 'profile'. Try --help: %w", err)
122
+
input.ProfileName=ProfileName
144
123
}
145
124
146
-
input.ProfileName=ProfileName
147
-
}
148
-
149
-
exitcode:=0
150
-
ifinput.JSONDeprecated {
151
-
exportCommandInput:=ExportCommandInput{
152
-
ProfileName: input.ProfileName,
153
-
Format: "json",
154
-
Config: input.Config,
155
-
SessionDuration: input.SessionDuration,
156
-
NoSession: input.NoSession,
125
+
exitcode:=0
126
+
ifinput.JSONDeprecated {
127
+
exportCommandInput:=ExportCommandInput{
128
+
ProfileName: input.ProfileName,
129
+
Format: "json",
130
+
Config: input.Config,
131
+
SessionDuration: input.SessionDuration,
132
+
NoSession: input.NoSession,
133
+
}
134
+
135
+
err=ExportCommand(exportCommandInput, f, keyring)
136
+
} else {
137
+
exitcode, err=ExecCommand(input, f, keyring)
157
138
}
158
139
159
-
err=ExportCommand(exportCommandInput, f, keyring)
160
-
} else {
161
-
exitcode, err=ExecCommand(input, f, keyring)
162
-
}
140
+
iferr!=nil {
141
+
returnerr
142
+
}
163
143
164
-
app.FatalIfError(err, "exec")
144
+
// override exit code if not err
145
+
os.Exit(exitcode)
165
146
166
-
// override exit code if not err
167
-
os.Exit(exitcode)
147
+
returnnil
148
+
},
149
+
}
168
150
169
-
returnnil
151
+
cmd.Flags().DurationVarP(&input.SessionDuration, "duration", "d", time.Hour, "Duration of the temporary or assume-role session. Defaults to 1h")
152
+
cmd.Flags().BoolVarP(&input.NoSession, "no-session", "n", false, "Skip creating STS session with GetSessionToken")
153
+
cmd.Flags().StringVar(&input.Config.Region, "region", "", "The AWS region")
154
+
cmd.Flags().StringVarP(&input.Config.MfaToken, "mfa-token", "t", "", "The MFA token to use")
155
+
cmd.Flags().BoolVarP(&input.JSONDeprecated, "json", "j", false, "Output credentials in JSON that can be used by credential_process")
156
+
_=cmd.Flags().MarkHidden("json")
157
+
cmd.Flags().BoolVarP(&input.StartEcsServer, "server", "s", false, "Alias for --ecs-server")
158
+
cmd.Flags().BoolVar(&input.StartEc2Server, "ec2-server", false, "Run a EC2 metadata server in the background for credentials")
159
+
cmd.Flags().BoolVar(&input.StartEcsServer, "ecs-server", false, "Run a ECS credential server in the background for credentials (the SDK or app must support AWS_CONTAINER_CREDENTIALS_FULL_URI)")
160
+
cmd.Flags().BoolVar(&input.Lazy, "lazy", false, "When using --ecs-server, lazily fetch credentials")
161
+
cmd.Flags().BoolVar(&input.UseStdout, "stdout", false, "Print the SSO link to the terminal without automatically opening the browser")
0 commit comments