events

package
v0.0.0-...-d74374d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractEventsInto

func ExtractEventsInto(r pagination.Page, v interface{}) error

func List

List retrieves a list of Events.

Types

type DateFilter

type DateFilter string

DateFilter represents a valid filter to use for filtering events by their date during a list.

const (
	DateFilterGT  DateFilter = "gt"
	DateFilterGTE DateFilter = "gte"
	DateFilterLT  DateFilter = "lt"
	DateFilterLTE DateFilter = "lte"
)

type DateQuery

type DateQuery struct {
	Date   time.Time
	Filter DateFilter
}

DateQuery represents a date field to be used for listing events. If no filter is specified, the query will act as if "equal" is used.

type Event

type Event cadf.Event

Event represents a Hermes Event.

func ExtractEvents

func ExtractEvents(r pagination.Page) ([]Event, error)

ExtractEvents accepts a Page struct, specifically an EventPage struct, and extracts the elements into a slice of Event structs. In other words, a generic collection is mapped into a relevant slice.

type EventPage

type EventPage struct {
	pagination.LinkedPageBase
}

EventPage is a single page of events results.

func (EventPage) IsEmpty

func (r EventPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of events contains any results.

func (EventPage) NextPageURL

func (r EventPage) NextPageURL() (string, error)

NextPageURL extracts the "next" link from the links section of the result.

func (EventPage) Total

func (r EventPage) Total() (int, error)

Total extracts the "total" attribute of the result.

type GetOpts

type GetOpts struct {
	// The project ID to retrieve event for.
	ProjectID string `q:"project_id"`

	// The domain ID to retrieve event for.
	DomainID string `q:"domain_id"`
}

GetOpts enables retrieving events by a specific project or domain.

func (GetOpts) ToEventsQuery

func (opts GetOpts) ToEventsQuery() (string, error)

ToEventsQuery formats a GetOpts into a query string.

type GetOptsBuilder

type GetOptsBuilder interface {
	ToEventsQuery() (string, error)
}

GetOptsBuilder allows extensions to add additional parameters to the Get request.

type GetResult

type GetResult struct {
	gophercloud.Result
}

func Get

Get retrieves a specific event based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Event, error)

Extract is a function that accepts a result and extracts an event resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	ObserverType string `q:"observer_type"`
	TargetID     string `q:"target_id"`
	TargetType   string `q:"target_type"`
	InitiatorID  string `q:"initiator_id"`

	// Not available for sort
	InitiatorType string `q:"initiator_type"`
	InitiatorName string `q:"initiator_name"`

	Action      string `q:"action"`
	Outcome     string `q:"outcome"`
	RequestPath string `q:"request_path"`
	Time        []DateQuery
	DomainID    string `q:"domain_id"`
	ProjectID   string `q:"project_id"`

	// Search is over the entire event body.
	Search string `q:"search"`

	// Sort will sort the results in the requested order.
	Sort string `q:"sort"`

	Limit  int `q:"limit"`
	Offset int `q:"offset"`
}

ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in filter value. Page and PerPage are used for pagination.

func (ListOpts) ToEventListQuery

func (opts ListOpts) ToEventListQuery() (string, error)

ToEventListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToEventListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL