-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtype_user.go
50 lines (45 loc) · 925 Bytes
/
type_user.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
package iam
import (
"time"
SDK "github.com/aws/aws-sdk-go/service/iam"
)
// User contains IAM User data.
type User struct {
ARN string
UserID string
UserName string
Path string
CreateDate time.Time
PasswordLastUsed time.Time
}
// NewUser returns initialized User from *SDK.User.
func NewUser(u *SDK.User) User {
uu := User{}
if u.Arn != nil {
uu.ARN = *u.Arn
}
if u.UserId != nil {
uu.UserID = *u.UserId
}
if u.UserName != nil {
uu.UserName = *u.UserName
}
if u.Path != nil {
uu.Path = *u.Path
}
if u.CreateDate != nil {
uu.CreateDate = *u.CreateDate
}
if u.PasswordLastUsed != nil {
uu.PasswordLastUsed = *u.PasswordLastUsed
}
return uu
}
// NewUsers converts from []*SDK.User to []User.
func NewUsers(list []*SDK.User) []User {
result := make([]User, len(list))
for i, p := range list {
result[i] = NewUser(p)
}
return result
}