-
Notifications
You must be signed in to change notification settings - Fork 23
/
type_role.go
48 lines (43 loc) · 924 Bytes
/
type_role.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
package iam
import (
"time"
SDK "github.com/aws/aws-sdk-go/service/iam"
)
// Role contains IAM Role data.
type Role struct {
ARN string
RoleID string
RoleName string
Path string
Description string
AssumeRolePolicyDocument string
CreateDate time.Time
}
// NewRole returns initialized Role from *SDK.Role.
func NewRole(r *SDK.Role) Role {
rr := Role{}
if r.Arn != nil {
rr.ARN = *r.Arn
}
if r.RoleId != nil {
rr.RoleID = *r.RoleId
}
if r.RoleName != nil {
rr.RoleName = *r.RoleName
}
if r.Path != nil {
rr.Path = *r.Path
}
if r.CreateDate != nil {
rr.CreateDate = *r.CreateDate
}
return rr
}
// NewRoles converts from []*SDK.Role to []Role.
func NewRoles(list []*SDK.Role) []Role {
result := make([]Role, len(list))
for i, p := range list {
result[i] = NewRole(p)
}
return result
}