github.com/asifdxtreme/cli@v6.1.3-0.20150123051144-9ead8700b4ae+incompatible/cf/api/strategy/events.go (about)

     1  package strategy
     2  
     3  import "github.com/cloudfoundry/cli/cf/api/resources"
     4  
     5  type EventsEndpointStrategy interface {
     6  	EventsURL(appGuid string, limit int64) string
     7  	EventsResource() resources.EventResource
     8  }
     9  
    10  type eventsEndpointStrategy struct{}
    11  
    12  func (_ eventsEndpointStrategy) EventsURL(appGuid string, limit int64) string {
    13  	return buildURL(v2("apps", appGuid, "events"), params{
    14  		resultsPerPage: limit,
    15  	})
    16  }
    17  
    18  func (_ eventsEndpointStrategy) EventsResource() resources.EventResource {
    19  	return resources.EventResourceOldV2{}
    20  }
    21  
    22  type globalEventsEndpointStrategy struct{}
    23  
    24  func (strategy globalEventsEndpointStrategy) EventsURL(appGuid string, limit int64) string {
    25  	return buildURL(v2("events"), params{
    26  		resultsPerPage: limit,
    27  		orderDirection: "desc",
    28  		q:              map[string]string{"actee": appGuid},
    29  	})
    30  }
    31  
    32  func (_ globalEventsEndpointStrategy) EventsResource() resources.EventResource {
    33  	return resources.EventResourceNewV2{}
    34  }