-
Notifications
You must be signed in to change notification settings - Fork 0
/
credentials.go
43 lines (29 loc) · 920 Bytes
/
credentials.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
package session
import (
"fmt"
"strings"
)
const AnonymousCredentialsString string = "anon:"
const EnvironmentCredentialsString string = "env:"
const IAMCredentialsString string = "iam:"
const ProfileCredentialsTemplate string = "{profile}"
const ProfileFromPathCredentialsTemplate string = "{path}:{profile}"
const StaticCredentialsTemplate string = "static:{id}:{key}:{secret}"
const StaticCredentialsPrefix string = "static:"
const STSCredentialsPrefix string = "sts:"
func ValidCredentials() []string {
valid := []string{
AnonymousCredentialsString,
EnvironmentCredentialsString,
IAMCredentialsString,
STSCredentialsPrefix,
ProfileCredentialsTemplate,
ProfileFromPathCredentialsTemplate,
StaticCredentialsTemplate,
}
return valid
}
func ValidCredentialsString() string {
valid := ValidCredentials()
return fmt.Sprintf("Valid credential flags are: %s", strings.Join(valid, ", "))
}