Skip to content

Commit 21880bc

Browse files
committed
Tweak some output.
1 parent 79b2606 commit 21880bc

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $ aws-rotate-key --help
1616
Usage of aws-rotate-key:
1717
-auth-profile string
1818
Use a different profile when calling AWS.
19-
-d Delete old key without deactivation.
19+
-d Delete the old key instead of deactivating it.
2020
-mfa
2121
Use MFA.
2222
-mfa-serial-number string
@@ -41,10 +41,10 @@ Your user has 2 access keys:
4141
4242
You have two access keys, which is the maximum number of access keys allowed.
4343
Do you want to delete AKIAI3KI7UC6BPI4O57A and create a new key? [yN] y
44-
Deleted access key AKIAI3KI7UC6BPI4O57A.
45-
Created access key AKIAIX46CKYT7E5I3KVQ.
44+
Deleted access key: AKIAI3KI7UC6BPI4O57A
45+
Created access key: AKIAIX46CKYT7E5I3KVQ
4646
Wrote new key pair to /Users/your_username/.aws/credentials
47-
Deactivated old access key AKIAJMIGD6UPCXCFWVOA.
47+
Deactivated old access key: AKIAJMIGD6UPCXCFWVOA
4848
Please make sure this key is not used elsewhere.
4949
Please note that it may take a minute for your new access key to propagate in the AWS control plane.
5050
```

main.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func main() {
3838
var deleteFlag bool
3939
flag.BoolVar(&yesFlag, "y", false, `Automatic "yes" to prompts.`)
4040
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.")
4242
flag.StringVar(&profileFlag, "profile", defaultProfile, "The profile to use.")
4343
flag.StringVar(&authProfileFlag, "auth-profile", "", "Use a different profile when calling AWS.")
4444
flag.StringVar(&mfaSerialNumber, "mfa-serial-number", "", "Specify the MFA device to use. (optional)")
@@ -80,7 +80,7 @@ func main() {
8080
re_aws_secret_access_key := regexp.MustCompile(fmt.Sprintf(`(?m)^aws_secret_access_key *= *%s`, regexp.QuoteMeta(creds.SecretAccessKey)))
8181
if !re_aws_access_key_id.MatchString(credentialsText) || !re_aws_secret_access_key.MatchString(credentialsText) {
8282
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)
8484
fmt.Println("Please make sure your file is formatted like the following:")
8585
fmt.Println()
8686
fmt.Printf("aws_access_key_id=%s\n", creds.AccessKeyID)
@@ -137,7 +137,7 @@ func main() {
137137
fmt.Println()
138138
fmt.Println("You have multiple MFA devices assigned to your user.")
139139
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.")
141141
}
142142
fmt.Println()
143143
for i, serialNumber := range supportedSerialNumbers {
@@ -149,7 +149,8 @@ func main() {
149149
fmt.Println("Because you used -y, the first MFA device was automatically chosen. You can use -mfa-serial-number to pick a different device.")
150150
} else {
151151
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: ")
153154
_, err = fmt.Scanln(&input)
154155
check(err)
155156
if isNumeric(input) {
@@ -244,7 +245,7 @@ func main() {
244245
AccessKeyId: respListAccessKeys.AccessKeyMetadata[keyIndex].AccessKeyId,
245246
})
246247
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)
248249
} else if !yesFlag {
249250
cleanupAction := "deactivate"
250251
if deleteFlag {
@@ -265,7 +266,7 @@ func main() {
265266
check(err)
266267
newAccessKeyId := *respCreateAccessKey.AccessKey.AccessKeyId
267268
newSecretAccessKey := *respCreateAccessKey.AccessKey.SecretAccessKey
268-
fmt.Printf("Created access key %s.\n", newAccessKeyId)
269+
fmt.Printf("Created access key: %s\n", newAccessKeyId)
269270

270271
// Replace key pair in credentials file
271272
// 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() {
281282
AccessKeyId: aws.String(newAccessKeyId),
282283
})
283284
check(err2)
284-
fmt.Printf("Deleted access key %s.\n", newAccessKeyId)
285+
fmt.Printf("Deleted access key: %s\n", newAccessKeyId)
285286
os.Exit(1)
286287
}
287288

@@ -296,14 +297,14 @@ func main() {
296297
AccessKeyId: aws.String(creds.AccessKeyID),
297298
})
298299
check(err)
299-
fmt.Printf("Deleted old access key %s.\n", creds.AccessKeyID)
300+
fmt.Printf("Deleted old access key: %s\n", creds.AccessKeyID)
300301
} else {
301302
_, err = iamClient.UpdateAccessKey(&iam.UpdateAccessKeyInput{
302303
AccessKeyId: aws.String(creds.AccessKeyID),
303304
Status: aws.String("Inactive"),
304305
})
305306
check(err)
306-
fmt.Printf("Deactivated old access key %s.\n", creds.AccessKeyID)
307+
fmt.Printf("Deactivated old access key: %s\n", creds.AccessKeyID)
307308
fmt.Println("Please make sure this key is not used elsewhere.")
308309
}
309310
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

Comments
 (0)