events

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: Apache-2.0 Imports: 3 Imported by: 4

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

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.

func (EventPage) IsEmpty

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

IsEmpty determines if a EventPage contains any results.

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.

func (GetResult) Extract

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

Extract interprets any commonResult-based result as an 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

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

ToEventListQuery builds a query string from ListOpts.

type ListOptsBuilder

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

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

Directories

Path Synopsis
clustering_events_v1
clustering_events_v1

Jump to

Keyboard shortcuts

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