stackevents

package
v1.1.39 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package stackevents provides operations for finding, listing, and retrieving stack events. Stack events are events that take place on stacks such as updating and abandoning.

Example for list events for a stack

pages, err := stackevents.List(client, stack.Name, stack.ID, nil).AllPages()
if err != nil {
    panic(err)
}
events, err := stackevents.ExtractEvents(pages)
if err != nil {
    panic(err)
}
fmt.Println("Get Event List")
fmt.Println(events)

Index

Constants

This section is empty.

Variables

View Source
var (
	// ResourceStatusInProgress is used to filter a List request by the 'IN_PROGRESS' status.
	ResourceStatusInProgress ResourceStatus = "IN_PROGRESS"
	// ResourceStatusComplete is used to filter a List request by the 'COMPLETE' status.
	ResourceStatusComplete ResourceStatus = "COMPLETE"
	// ResourceStatusFailed is used to filter a List request by the 'FAILED' status.
	ResourceStatusFailed ResourceStatus = "FAILED"

	// ResourceActionCreate is used to filter a List request by the 'CREATE' action.
	ResourceActionCreate ResourceAction = "CREATE"
	// ResourceActionDelete is used to filter a List request by the 'DELETE' action.
	ResourceActionDelete ResourceAction = "DELETE"
	// ResourceActionUpdate is used to filter a List request by the 'UPDATE' action.
	ResourceActionUpdate ResourceAction = "UPDATE"
	// ResourceActionRollback is used to filter a List request by the 'ROLLBACK' action.
	ResourceActionRollback ResourceAction = "ROLLBACK"
	// ResourceActionSuspend is used to filter a List request by the 'SUSPEND' action.
	ResourceActionSuspend ResourceAction = "SUSPEND"
	// ResourceActionResume is used to filter a List request by the 'RESUME' action.
	ResourceActionResume ResourceAction = "RESUME"
	// ResourceActionAbandon is used to filter a List request by the 'ABANDON' action.
	ResourceActionAbandon ResourceAction = "ABANDON"

	// SortAsc is used to sort a list of stacks in ascending order.
	SortAsc SortDir = "asc"
	// SortDesc is used to sort a list of stacks in descending order.
	SortDesc SortDir = "desc"

	// SortName is used to sort a list of stacks by name.
	SortName SortKey = "name"
	// SortResourceType is used to sort a list of stacks by resource type.
	SortResourceType SortKey = "resource_type"
	// SortCreatedAt is used to sort a list of stacks by date created.
	SortCreatedAt SortKey = "created_at"
)

Functions

func List

func List(client *gophercloud.ServiceClient, stackName, stackID string, opts ListOptsBuilder) pagination.Pager

List makes a request against the API to list resources for the given stack.

func ListResourceEvents

func ListResourceEvents(client *gophercloud.ServiceClient, stackName, stackID, resourceName string, opts ListResourceEventsOptsBuilder) pagination.Pager

ListResourceEvents makes a request against the API to list resources for the given stack.

Types

type Event

type Event struct {
	// The name of the resource for which the event occurred.
	ResourceName string `json:"resource_name"`
	// The time the event occurred.
	Time time.Time `json:"-"`
	// The URLs to the event.
	Links []gophercloud.Link `json:"links"`
	// The logical ID of the stack resource.
	LogicalResourceID string `json:"logical_resource_id"`
	// The reason of the status of the event.
	ResourceStatusReason string `json:"resource_status_reason"`
	// The status of the event.
	ResourceStatus string `json:"resource_status"`
	// The physical ID of the stack resource.
	PhysicalResourceID string `json:"physical_resource_id"`
	// The event ID.
	ID string `json:"id"`
	// Properties of the stack resource.
	ResourceProperties map[string]interface{} `json:"resource_properties"`
}

Event represents a stack event.

func ExtractEvents

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

ExtractEvents interprets the results of a single page from a List() call, producing a slice of Event entities.

func ExtractResourceEvents

func ExtractResourceEvents(page pagination.Page) ([]Event, error)

ExtractResourceEvents interprets the results of a single page from a ListResourceEvents() call, producing a slice of Event entities.

func (*Event) UnmarshalJSON

func (r *Event) UnmarshalJSON(b []byte) error

type EventPage

type EventPage struct {
	pagination.MarkerPageBase
}

EventPage abstracts the raw results of making a List() request against the API. As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the data provided through the ExtractResources call.

func (EventPage) IsEmpty

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

IsEmpty returns true if a page contains no Server results.

func (EventPage) LastMarker

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

LastMarker returns the last stack ID in a ListResult.

type FindResult

type FindResult struct {
	gophercloud.Result
}

FindResult represents the result of a Find operation.

func Find

func Find(c *gophercloud.ServiceClient, stackName string) (r FindResult)

Find retrieves stack events for the given stack name.

func (FindResult) Extract

func (r FindResult) Extract() ([]Event, error)

Extract returns a slice of Event objects and is called after a Find operation.

type GetResult

type GetResult struct {
	gophercloud.Result
}

GetResult represents the result of a Get operation.

func Get

func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName, eventID string) (r GetResult)

Get retreives data for the given stack resource.

func (GetResult) Extract

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

Extract returns a pointer to an Event object and is called after a Get operation.

type ListOpts

type ListOpts struct {
	// The stack resource ID with which to start the listing.
	Marker string `q:"marker"`
	// Integer value for the limit of values to return.
	Limit int `q:"limit"`
	// Filters the event list by the specified ResourceAction. You can use this
	// filter multiple times to filter by multiple resource actions: CREATE, DELETE,
	// UPDATE, ROLLBACK, SUSPEND, RESUME or ADOPT.
	ResourceActions []ResourceAction `q:"resource_action"`
	// Filters the event list by the specified resource_status. You can use this
	// filter multiple times to filter by multiple resource statuses: IN_PROGRESS,
	// COMPLETE or FAILED.
	ResourceStatuses []ResourceStatus `q:"resource_status"`
	// Filters the event list by the specified resource_name. You can use this
	// filter multiple times to filter by multiple resource names.
	ResourceNames []string `q:"resource_name"`
	// Filters the event list by the specified resource_type. You can use this
	// filter multiple times to filter by multiple resource types: OS::Nova::Server,
	// OS::Cinder::Volume, and so on.
	ResourceTypes []string `q:"resource_type"`
	// Sorts the event list by: resource_type or created_at.
	SortKey SortKey `q:"sort_keys"`
	// The sort direction of the event list. Which is asc (ascending) or desc (descending).
	SortDir SortDir `q:"sort_dir"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Marker and Limit are used for pagination.

func (ListOpts) ToStackEventListQuery

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

ToStackEventListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type ListResourceEventsOpts

type ListResourceEventsOpts struct {
	// The stack resource ID with which to start the listing.
	Marker string `q:"marker"`
	// Integer value for the limit of values to return.
	Limit int `q:"limit"`
	// Filters the event list by the specified ResourceAction. You can use this
	// filter multiple times to filter by multiple resource actions: CREATE, DELETE,
	// UPDATE, ROLLBACK, SUSPEND, RESUME or ADOPT.
	ResourceActions []string `q:"resource_action"`
	// Filters the event list by the specified resource_status. You can use this
	// filter multiple times to filter by multiple resource statuses: IN_PROGRESS,
	// COMPLETE or FAILED.
	ResourceStatuses []string `q:"resource_status"`
	// Filters the event list by the specified resource_name. You can use this
	// filter multiple times to filter by multiple resource names.
	ResourceNames []string `q:"resource_name"`
	// Filters the event list by the specified resource_type. You can use this
	// filter multiple times to filter by multiple resource types: OS::Nova::Server,
	// OS::Cinder::Volume, and so on.
	ResourceTypes []string `q:"resource_type"`
	// Sorts the event list by: resource_type or created_at.
	SortKey SortKey `q:"sort_keys"`
	// The sort direction of the event list. Which is asc (ascending) or desc (descending).
	SortDir SortDir `q:"sort_dir"`
}

ListResourceEventsOpts allows the filtering and sorting of paginated resource events through the API. Marker and Limit are used for pagination.

func (ListResourceEventsOpts) ToResourceEventListQuery

func (opts ListResourceEventsOpts) ToResourceEventListQuery() (string, error)

ToResourceEventListQuery formats a ListResourceEventsOpts into a query string.

type ListResourceEventsOptsBuilder

type ListResourceEventsOptsBuilder interface {
	ToResourceEventListQuery() (string, error)
}

ListResourceEventsOptsBuilder allows extensions to add additional parameters to the ListResourceEvents request.

type ResourceAction

type ResourceAction string

ResourceAction is a type for specifying by which resource action to filter a list of events.

type ResourceStatus

type ResourceStatus string

ResourceStatus is a type for specifying by which resource status to filter a list of events.

type SortDir

type SortDir string

SortDir is a type for specifying in which direction to sort a list of events.

type SortKey

type SortKey string

SortKey is a type for specifying by which key to sort a list of events.

Directories

Path Synopsis
orchestration_stackevents_v1
orchestration_stackevents_v1

Jump to

Keyboard shortcuts

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