@@ -38,7 +38,7 @@ func main() {
38
38
var deleteFlag bool
39
39
flag .BoolVar (& yesFlag , "y" , false , `Automatic "yes" to prompts.` )
40
40
flag .BoolVar (& mfaFlag , "mfa" , false , "Use MFA." )
41
- flag .BoolVar (& deleteFlag , "d" , false , "Delete old key without deactivation ." )
41
+ flag .BoolVar (& deleteFlag , "d" , false , "Delete the old key instead of deactivating it ." )
42
42
flag .StringVar (& profileFlag , "profile" , defaultProfile , "The profile to use." )
43
43
flag .StringVar (& authProfileFlag , "auth-profile" , "" , "Use a different profile when calling AWS." )
44
44
flag .StringVar (& mfaSerialNumber , "mfa-serial-number" , "" , "Specify the MFA device to use. (optional)" )
@@ -80,7 +80,7 @@ func main() {
80
80
re_aws_secret_access_key := regexp .MustCompile (fmt .Sprintf (`(?m)^aws_secret_access_key *= *%s` , regexp .QuoteMeta (creds .SecretAccessKey )))
81
81
if ! re_aws_access_key_id .MatchString (credentialsText ) || ! re_aws_secret_access_key .MatchString (credentialsText ) {
82
82
fmt .Println ()
83
- fmt .Printf ("Unable to find your credentials in %s. \n " , credentialsPath )
83
+ fmt .Printf ("Unable to find your credentials in %s\n " , credentialsPath )
84
84
fmt .Println ("Please make sure your file is formatted like the following:" )
85
85
fmt .Println ()
86
86
fmt .Printf ("aws_access_key_id=%s\n " , creds .AccessKeyID )
@@ -137,7 +137,7 @@ func main() {
137
137
fmt .Println ()
138
138
fmt .Println ("You have multiple MFA devices assigned to your user." )
139
139
if len (supportedSerialNumbers ) != len (respMFADevices .MFADevices ) {
140
- fmt .Println ("Note: You have U2F MFA devices assigned to your user. These are not supported and are not included here ." )
140
+ fmt .Println ("Note: You have U2F MFA devices assigned to your user. These are not supported and are not in this list ." )
141
141
}
142
142
fmt .Println ()
143
143
for i , serialNumber := range supportedSerialNumbers {
@@ -149,7 +149,8 @@ func main() {
149
149
fmt .Println ("Because you used -y, the first MFA device was automatically chosen. You can use -mfa-serial-number to pick a different device." )
150
150
} else {
151
151
var input string
152
- fmt .Print ("Which MFA device do you want to use? Enter a number from above or the full serial number: " )
152
+ fmt .Println ("Which MFA device do you want to use?" )
153
+ fmt .Print ("Enter a number from the list above or the full serial number: " )
153
154
_ , err = fmt .Scanln (& input )
154
155
check (err )
155
156
if isNumeric (input ) {
@@ -244,7 +245,7 @@ func main() {
244
245
AccessKeyId : respListAccessKeys .AccessKeyMetadata [keyIndex ].AccessKeyId ,
245
246
})
246
247
check (err2 )
247
- fmt .Printf ("Deleted access key %s. \n " , * respListAccessKeys .AccessKeyMetadata [keyIndex ].AccessKeyId )
248
+ fmt .Printf ("Deleted access key: %s\n " , * respListAccessKeys .AccessKeyMetadata [keyIndex ].AccessKeyId )
248
249
} else if ! yesFlag {
249
250
cleanupAction := "deactivate"
250
251
if deleteFlag {
@@ -265,7 +266,7 @@ func main() {
265
266
check (err )
266
267
newAccessKeyId := * respCreateAccessKey .AccessKey .AccessKeyId
267
268
newSecretAccessKey := * respCreateAccessKey .AccessKey .SecretAccessKey
268
- fmt .Printf ("Created access key %s. \n " , newAccessKeyId )
269
+ fmt .Printf ("Created access key: %s\n " , newAccessKeyId )
269
270
270
271
// Replace key pair in credentials file
271
272
// This search & replace does not limit itself to the specified profile, which is useful if the user is using the same key in multiple profiles
@@ -281,7 +282,7 @@ func main() {
281
282
AccessKeyId : aws .String (newAccessKeyId ),
282
283
})
283
284
check (err2 )
284
- fmt .Printf ("Deleted access key %s. \n " , newAccessKeyId )
285
+ fmt .Printf ("Deleted access key: %s\n " , newAccessKeyId )
285
286
os .Exit (1 )
286
287
}
287
288
@@ -296,14 +297,14 @@ func main() {
296
297
AccessKeyId : aws .String (creds .AccessKeyID ),
297
298
})
298
299
check (err )
299
- fmt .Printf ("Deleted old access key %s. \n " , creds .AccessKeyID )
300
+ fmt .Printf ("Deleted old access key: %s\n " , creds .AccessKeyID )
300
301
} else {
301
302
_ , err = iamClient .UpdateAccessKey (& iam.UpdateAccessKeyInput {
302
303
AccessKeyId : aws .String (creds .AccessKeyID ),
303
304
Status : aws .String ("Inactive" ),
304
305
})
305
306
check (err )
306
- fmt .Printf ("Deactivated old access key %s. \n " , creds .AccessKeyID )
307
+ fmt .Printf ("Deactivated old access key: %s\n " , creds .AccessKeyID )
307
308
fmt .Println ("Please make sure this key is not used elsewhere." )
308
309
}
309
310
fmt .Println ("Please note that it may take a minute for your new access key to propagate in the AWS control plane." )
0 commit comments