-
Notifications
You must be signed in to change notification settings - Fork 194
/
credentials.go
51 lines (41 loc) · 869 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
44
45
46
47
48
49
50
51
package common
var creErr = "ClientError.CredentialError"
type CredentialIface interface {
GetSecretId() string
GetToken() string
GetSecretKey() string
// needRefresh() bool
// refresh()
}
type Credential struct {
SecretId string
SecretKey string
Token string
}
func (c *Credential) needRefresh() bool {
return false
}
func (c *Credential) refresh() {
}
func NewCredential(secretId, secretKey string) *Credential {
return &Credential{
SecretId: secretId,
SecretKey: secretKey,
}
}
func NewTokenCredential(secretId, secretKey, token string) *Credential {
return &Credential{
SecretId: secretId,
SecretKey: secretKey,
Token: token,
}
}
func (c *Credential) GetSecretKey() string {
return c.SecretKey
}
func (c *Credential) GetSecretId() string {
return c.SecretId
}
func (c *Credential) GetToken() string {
return c.Token
}