Skip to content

allow for multiple CreateAts and UpdatedAts in the client.ListOptions so you can search within time ranges #446

Closed
@metskem

Description

@metskem

The raw CF API allows for using the created_ats/updated_ats query parameters multiple times, so you can search within ranges.
For example to search for audit_events between 13:00 and 14:00 :

cf curl "/v3/audit_events?created_ats[gt]=2025-02-06T13:00:00Z&created_ats[lt]=2025-02-06T14:00:00Z"

The go-cfclient however only allows one client.ListOptions{CreatedAts, UpdatedAts}, check this code

I also wonder why you can provide multiple timestamps here, shouldn't that have been a slice of TimeStampFilter instead?

Now with audit_events you can now get away with this since the created_at is always the same as the updated_at and you use the first one for [gt] and the second one for [lt], i.e. :

	var createdAts, updatedAts client.TimestampFilter
	createdAts = client.TimestampFilter{Timestamp: []time.Time{afterTime}, Operator: client.FilterModifierGreaterThan}
	updatedAts = client.TimestampFilter{Timestamp: []time.Time{beforeTime}, Operator: client.FilterModifierLessThan}
	
	auditListOptions := client.AuditEventListOptions{ListOptions: &client.ListOptions{CreateAts: createdAts, UpdatedAts: updatedAts}}

But it would be nice if we could use multiple (at least 2) TimestampFilter's.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions