forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.go
34 lines (26 loc) · 939 Bytes
/
events.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
package strategy
import "github.com/cloudfoundry/cli/cf/api/resources"
type EventsEndpointStrategy interface {
EventsURL(appGuid string, limit int64) string
EventsResource() resources.EventResource
}
type eventsEndpointStrategy struct{}
func (_ eventsEndpointStrategy) EventsURL(appGuid string, limit int64) string {
return buildURL(v2("apps", appGuid, "events"), params{
resultsPerPage: limit,
})
}
func (_ eventsEndpointStrategy) EventsResource() resources.EventResource {
return resources.EventResourceOldV2{}
}
type globalEventsEndpointStrategy struct{}
func (strategy globalEventsEndpointStrategy) EventsURL(appGuid string, limit int64) string {
return buildURL(v2("events"), params{
resultsPerPage: limit,
orderDirection: "desc",
q: map[string]string{"actee": appGuid},
})
}
func (_ globalEventsEndpointStrategy) EventsResource() resources.EventResource {
return resources.EventResourceNewV2{}
}