Documentation
¶
Index ¶
Constants ¶
const ( // EndpointEventsJSON is the endpoint for events in JSON format EndpointEventsJSON = "/events.json" // EndpointEventsCSV is the endpoint for events in CSV format EndpointEventsCSV = "/events.csv" // Filter types FilterUser = "user" FilterSystem = "system" FilterAll = "all" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID string `json:"id"`
EventType string `json:"event_type"`
OccurredAt time.Time `json:"occurred_at"`
ActorID *string `json:"actor_id"`
ActorType *string `json:"actor_type"`
TargetID *string `json:"target_id"`
TargetType *string `json:"target_type"`
TargetIdentifier *string `json:"target_identifier"`
TargetSnapshot map[string]any `json:"target_snapshot,omitempty"`
Changes map[string]any `json:"changes,omitempty"`
}
Event represents a single event entry
type EventsResponse ¶
type EventsResponse []Event
EventsResponse is the response from GET /events.json
type EventsServiceInterface ¶
type EventsServiceInterface interface {
// ListEvents returns a list of audit log events
//
// Returns audit log events with IDs, event types, timestamps, actor information, and target details.
// Supports filtering by actor type (user, system, or all) via query options.
ListEvents(ctx context.Context, opts *RequestQueryOptions) (*EventsResponse, *interfaces.Response, error)
// ListEventsCSV returns audit log events as CSV
//
// Returns audit log event data as CSV with columns: id, event_type, occurred_at, actor_id, actor_type, target_id, target_type, target_identifier.
// Supports filtering by actor type and optional download parameter via query options.
ListEventsCSV(ctx context.Context, opts *RequestQueryOptions) ([]byte, *interfaces.Response, error)
}
EventsServiceInterface defines the interface for events operations
Workbrew API docs: https://console.workbrew.com/documentation/api
type RequestQueryOptions ¶
type RequestQueryOptions struct {
Filter string // Filter by actor type: user, system, or all
Download bool // For CSV: force download as attachment (set to true to add download=1)
}
RequestQueryOptions represents optional query parameters for events requests
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles communication with the events related methods of the Workbrew API.
func NewService ¶
func NewService(client interfaces.HTTPClient) *Service
NewService creates a new events service
func (*Service) ListEvents ¶
func (s *Service) ListEvents(ctx context.Context, opts *RequestQueryOptions) (*EventsResponse, *interfaces.Response, error)
ListEvents retrieves all events in JSON format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/events.json
Parameters:
- opts: Optional query parameters (filter by actor type: user, system, all)
func (*Service) ListEventsCSV ¶
func (s *Service) ListEventsCSV(ctx context.Context, opts *RequestQueryOptions) ([]byte, *interfaces.Response, error)
ListEventsCSV retrieves all events in CSV format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/events.csv
Parameters:
- opts: Optional query parameters (filter by actor type, download flag)