stackevents

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2015 License: Apache-2.0, Apache-2.0 Imports: 10 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.

Index

Constants

View Source
const FindOutput = `` /* 1962-byte string literal not displayed */

FindOutput represents the response body from a Find request.

View Source
const GetOutput = `` /* 973-byte string literal not displayed */

GetOutput represents the response body from a Get request.

View Source
const ListOutput = `` /* 1962-byte string literal not displayed */

ListOutput represents the response body from a List request.

View Source
const ListResourceEventsOutput = `` /* 1962-byte string literal not displayed */

ListResourceEventsOutput represents the response body from a ListResourceEvents request.

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"
)
View Source
var FindExpected = []Event{
	Event{
		ResourceName: "hello_world",
		Time:         time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
		Links: []gophercloud.Link{
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/06feb26f-9298-4a9b-8749-9d770e5d577a",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
				Rel:  "resource",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalResourceID:    "hello_world",
		ResourceStatusReason: "state changed",
		ResourceStatus:       "CREATE_IN_PROGRESS",
		PhysicalResourceID:   "",
		ID:                   "06feb26f-9298-4a9b-8749-9d770e5d577a",
	},
	Event{
		ResourceName: "hello_world",
		Time:         time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC),
		Links: []gophercloud.Link{
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/93940999-7d40-44ae-8de4-19624e7b8d18",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
				Rel:  "resource",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalResourceID:    "hello_world",
		ResourceStatusReason: "state changed",
		ResourceStatus:       "CREATE_COMPLETE",
		PhysicalResourceID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		ID:                   "93940999-7d40-44ae-8de4-19624e7b8d18",
	},
}

FindExpected represents the expected object from a Find request.

View Source
var GetExpected = &Event{
	ResourceName: "hello_world",
	Time:         time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC),
	Links: []gophercloud.Link{
		gophercloud.Link{
			Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/93940999-7d40-44ae-8de4-19624e7b8d18",
			Rel:  "self",
		},
		gophercloud.Link{
			Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
			Rel:  "resource",
		},
		gophercloud.Link{
			Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
			Rel:  "stack",
		},
	},
	LogicalResourceID:    "hello_world",
	ResourceStatusReason: "state changed",
	ResourceStatus:       "CREATE_COMPLETE",
	PhysicalResourceID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
	ID:                   "93940999-7d40-44ae-8de4-19624e7b8d18",
}

GetExpected represents the expected object from a Get request.

View Source
var ListExpected = []Event{
	Event{
		ResourceName: "hello_world",
		Time:         time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
		Links: []gophercloud.Link{
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/06feb26f-9298-4a9b-8749-9d770e5d577a",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
				Rel:  "resource",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalResourceID:    "hello_world",
		ResourceStatusReason: "state changed",
		ResourceStatus:       "CREATE_IN_PROGRESS",
		PhysicalResourceID:   "",
		ID:                   "06feb26f-9298-4a9b-8749-9d770e5d577a",
	},
	Event{
		ResourceName: "hello_world",
		Time:         time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC),
		Links: []gophercloud.Link{
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/93940999-7d40-44ae-8de4-19624e7b8d18",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
				Rel:  "resource",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalResourceID:    "hello_world",
		ResourceStatusReason: "state changed",
		ResourceStatus:       "CREATE_COMPLETE",
		PhysicalResourceID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		ID:                   "93940999-7d40-44ae-8de4-19624e7b8d18",
	},
}

ListExpected represents the expected object from a List request.

View Source
var ListResourceEventsExpected = []Event{
	Event{
		ResourceName: "hello_world",
		Time:         time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
		Links: []gophercloud.Link{
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/06feb26f-9298-4a9b-8749-9d770e5d577a",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
				Rel:  "resource",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalResourceID:    "hello_world",
		ResourceStatusReason: "state changed",
		ResourceStatus:       "CREATE_IN_PROGRESS",
		PhysicalResourceID:   "",
		ID:                   "06feb26f-9298-4a9b-8749-9d770e5d577a",
	},
	Event{
		ResourceName: "hello_world",
		Time:         time.Date(2015, 2, 5, 21, 33, 27, 0, time.UTC),
		Links: []gophercloud.Link{
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world/events/93940999-7d40-44ae-8de4-19624e7b8d18",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
				Rel:  "resource",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalResourceID:    "hello_world",
		ResourceStatusReason: "state changed",
		ResourceStatus:       "CREATE_COMPLETE",
		PhysicalResourceID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		ID:                   "93940999-7d40-44ae-8de4-19624e7b8d18",
	},
}

ListResourceEventsExpected represents the expected object from a ListResourceEvents request.

Functions

func HandleFindSuccessfully

func HandleFindSuccessfully(t *testing.T, output string)

HandleFindSuccessfully creates an HTTP handler at `/stacks/postman_stack/events` on the test handler mux that responds with a `Find` response.

func HandleGetSuccessfully

func HandleGetSuccessfully(t *testing.T, output string)

HandleGetSuccessfully creates an HTTP handler at `/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/resources/my_resource/events/93940999-7d40-44ae-8de4-19624e7b8d18` on the test handler mux that responds with a `Get` response.

func HandleListResourceEventsSuccessfully

func HandleListResourceEventsSuccessfully(t *testing.T, output string)

HandleListResourceEventsSuccessfully creates an HTTP handler at `/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/resources/my_resource/events` on the test handler mux that responds with a `ListResourceEvents` response.

func HandleListSuccessfully

func HandleListSuccessfully(t *testing.T, output string)

HandleListSuccessfully creates an HTTP handler at `/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/events` on the test handler mux that responds with a `List` response.

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 `mapstructure:"resource_name"`
	// The time the event occurred.
	Time time.Time `mapstructure:"-"`
	// The URLs to the event.
	Links []gophercloud.Link `mapstructure:"links"`
	// The logical ID of the stack resource.
	LogicalResourceID string `mapstructure:"logical_resource_id"`
	// The reason of the status of the event.
	ResourceStatusReason string `mapstructure:"resource_status_reason"`
	// The status of the event.
	ResourceStatus string `mapstructure:"resource_status"`
	// The physical ID of the stack resource.
	PhysicalResourceID string `mapstructure:"physical_resource_id"`
	// The event ID.
	ID string `mapstructure:"id"`
	// Properties of the stack resource.
	ResourceProperties map[string]interface{} `mapstructure:"resource_properties"`
}

Event represents a stack event.

func ExtractEvents

func ExtractEvents(page 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.

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) 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) 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) ToResourceEventsListQuery

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

ToResourceEventsListQuery formats a ListOpts into a query string.

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.

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.

Jump to

Keyboard shortcuts

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