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