github.com/elopio/cli@v6.21.2-0.20160902224010-ea909d1fdb2f+incompatible/cf/api/strategy/events.go (about)

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