Documentation
¶
Overview ¶
Package events provides listing and retrieving of senlin events for the OpenStack Clustering Service.
Example to List Events
opts := events.ListOpts{
Limit: 5,
}
err = events.List(serviceClient, opts).EachPage(func(page pagination.Page) (bool, error) {
eventInfos, err := events.ExtractEvents(page)
if err != nil {
return false, err
}
for _, eventInfo := range eventInfos {
fmt.Println("%+v\n", eventInfo)
}
return true, nil
})
Example to Get an Event
eventID := "edce3528-864f-41fb-8759-f4707925cc09"
event, err := events.Get(serviceClient, eventID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("Event %+v: ", event)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List instructs OpenStack to provide a list of events.
Types ¶
type Event ¶
type Event struct {
Action string `json:"action"`
Cluster string `json:"cluster"`
ClusterID string `json:"cluster_id"`
ID string `json:"id"`
Level string `json:"level"`
Metadata map[string]interface{} `json:"meta_data"`
OID string `json:"oid"`
OName string `json:"oname"`
OType string `json:"otype"`
Project string `json:"project"`
Status string `json:"status"`
StatusReason string `json:"status_reason"`
Timestamp time.Time `json:"timestamp"`
User string `json:"user"`
}
Event represents a detailed Event.
func ExtractEvents ¶
func ExtractEvents(r pagination.Page) ([]Event, error)
ExtractEvents returns a slice of Events from the List operation.
type EventPage ¶
type EventPage struct {
pagination.LinkedPageBase
}
EventPage contains a single page of all events from a List call.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the response of a Get operations. Call its Extract method to interpret it as an Event.
func Get ¶
func Get(client *gophercloud.ServiceClient, id string) (r GetResult)
Get retrieves details of a single event.
type ListOpts ¶
type ListOpts struct {
Limit int `q:"limit,omitempty"`
Level int `q:"level,omitempty"`
Marker string `q:"marker,omitempty"`
Sort string `q:"sort,omitempty"`
GlobalProject *bool `q:"global_project,omitempty"`
OID string `q:"oid,omitempty"`
OType string `q:"otype,omitempty"`
OName string `q:"oname,omitempty"`
ClusterID string `q:"cluster_id,omitempty"`
Action string `q:"action"`
}
ListOpts represents options used to list events.
func (ListOpts) ToEventListQuery ¶
ToEventListQuery builds a query string from ListOpts.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.