forked from jarias/stormpath-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application_criteria.go
74 lines (57 loc) · 2.02 KB
/
application_criteria.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package stormpath
import "net/url"
type ApplicationCriteria struct {
baseCriteria
}
func MakeApplicationCriteria() ApplicationCriteria {
return ApplicationCriteria{baseCriteria{filter: url.Values{}}}
}
func MakeApplicationsCriteria() ApplicationCriteria {
return ApplicationCriteria{baseCriteria{limit: 25, filter: url.Values{}}}
}
//Filter related functions
//Possible filters:
//* name
//* description
//* status
func (c ApplicationCriteria) NameEq(name string) ApplicationCriteria {
c.filter.Add("name", name)
return c
}
func (c ApplicationCriteria) DescriptionEq(description string) ApplicationCriteria {
c.filter.Add("description", description)
return c
}
func (c ApplicationCriteria) StatusEq(status string) ApplicationCriteria {
c.filter.Add("statu", status)
return c
}
//Expansion related functions
func (c ApplicationCriteria) WithCustomData() ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, "customData")
return c
}
func (c ApplicationCriteria) WithAccounts(pageRequest PageRequest) ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("accounts"))
return c
}
func (c ApplicationCriteria) WithGroups(pageRequest PageRequest) ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("groups"))
return c
}
func (c ApplicationCriteria) WithTenant() ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, "tenant")
return c
}
func (c ApplicationCriteria) WithAccountStoreMappings(pageRequest PageRequest) ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("accountStoreMappings"))
return c
}
func (c ApplicationCriteria) WithDefaultAccountStoreMapping() ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, "defaultAccountStoreMapping")
return c
}
func (c ApplicationCriteria) WithDefaultGroupStoreMapping() ApplicationCriteria {
c.expandedAttributes = append(c.expandedAttributes, "defaultGroupStoreMapping")
return c
}