Documentation ¶
Index ¶
Constants ¶
const ( DefaultRecordMinAge = 5 * time.Minute DefaultFetchLimit = 50 )
const GUIDNil = "GUID_NIL"
GUIDNil represents an empty GUID
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CFEventFetcher ¶
type CFEventFetcher struct {
// contains filtered or unexported fields
}
CFEventFetcher is an EventFetcher that fetches cloudfoundry App or Service usage events
func New ¶
func New(cfg Config) (*CFEventFetcher, error)
New creates a new CFEventFetcher for the given config
func (*CFEventFetcher) FetchEvents ¶
func (e *CFEventFetcher) FetchEvents(ctx context.Context, lastEvent *eventio.RawEvent) ([]eventio.RawEvent, error)
FetchEvents requests
func (*CFEventFetcher) Kind ¶
func (e *CFEventFetcher) Kind() string
Kind returns the type of event this fetcher returns
type Config ¶
type Config struct { // Type sets the Kind of event to collect, must be App or Service Type Kind // ClientConfig allows configuration of connection to CF API ClientConfig *cfclient.Config // Client overrides the default client used to query API Client UsageEventsAPI // Logger overrides the default logger Logger lager.Logger // RecordMinAge sets the age at which events are mature enough for collection RecordMinAge time.Duration // FetchLimit dictates the max number of events returned in each FetchEvents call FetchLimit int }
FetcherConfig allows tuning of the fetcher. You must set a Type and ClientConfig
type UsageEvent ¶
type UsageEvent struct { MetaData MetaData EntityRaw json.RawMessage `json:"entity"` }
UsageEvent represent a usage event record from the API
type UsageEventList ¶
type UsageEventList struct {
Resources []UsageEvent `json:"resources"`
}
UsageEventList contains usage event records
type UsageEventsAPI ¶
type UsageEventsAPI interface { Get(afterGUID string, count int, minAge time.Duration) (*UsageEventList, error) Type() string }
UsageEventsAPI is a common interface for the app and service usage event APIs
func NewAppUsageEventsAPI ¶
func NewAppUsageEventsAPI(client UsageEventsClient, logger lager.Logger) UsageEventsAPI
NewAppUsageEventsAPI returns with a new app usage events API client
func NewServiceUsageEventsAPI ¶
func NewServiceUsageEventsAPI(client UsageEventsClient, logger lager.Logger) UsageEventsAPI
NewServiceUsageEventsAPI returns with a new service usage events API client