-
Notifications
You must be signed in to change notification settings - Fork 1
/
group.go
52 lines (41 loc) · 1.3 KB
/
group.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
52
package warrant
import (
"time"
"github.com/pivotal-cf-experimental/warrant/internal/documents"
)
// Group is the representation of a group resource within UAA.
type Group struct {
// ID is the unique identifier for the group resource.
ID string
// DisplayName is the human-friendly name given to a group.
DisplayName string
// Description is the human readable description of the group.
Description string
// Version is an integer value indicating which revision this resource represents.
Version int
// CreatedAt is a timestamp value indicating when the group was created.
CreatedAt time.Time
// UpdatedAt is a timestamp value indicating when the group was last modified.
UpdatedAt time.Time
// Members is the list of members to be included in the group.
Members []Member
}
func newGroupFromResponse(config Config, response documents.GroupResponse) Group {
var members []Member
for _, member := range response.Members {
members = append(members, Member{
Type: member.Type,
Value: member.Value,
Origin: member.Origin,
})
}
return Group{
ID: response.ID,
Description: response.Description,
DisplayName: response.DisplayName,
Members: members,
Version: response.Meta.Version,
CreatedAt: response.Meta.Created,
UpdatedAt: response.Meta.LastModified,
}
}