stackresources

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2016 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package stackresources provides operations for working with stack resources. A resource is a template artifact that represents some component of your desired architecture (a Cloud Server, a group of scaled Cloud Servers, a load balancer, some configuration management system, and so forth).

Index

Constants

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

FindOutput represents the response body from a Find request.

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

GetOutput represents the response body from a Get request.

View Source
const GetSchemaOutput = `` /* 429-byte string literal not displayed */

GetSchemaOutput represents the response body from a Schema request.

View Source
const GetTemplateOutput = `` /* 1270-byte string literal not displayed */

GetTemplateOutput represents the response body from a Template request.

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

ListOutput represents the response body from a List request.

View Source
const ListTypesOutput = `` /* 266-byte string literal not displayed */

ListTypesOutput represents the response body from a ListTypes request.

View Source
const MetadataOutput = `
{
    "metadata": {
      "number": "7",
      "animal": "auk"
    }
}`

MetadataOutput represents the response body from a Metadata request.

Variables

View Source
var FindExpected = []Resource{
	Resource{
		Name: "hello_world",
		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",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalID:    "hello_world",
		StatusReason: "state changed",
		UpdatedTime:  time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
		CreationTime: time.Date(2015, 2, 5, 21, 33, 10, 0, time.UTC),
		RequiredBy:   []interface{}{},
		Status:       "CREATE_IN_PROGRESS",
		PhysicalID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		Type:         "OS::Nova::Server",
		Attributes:   map[string]interface{}{"SXSW": "atx"},
		Description:  "Some resource",
	},
}

FindExpected represents the expected object from a Find request.

View Source
var GetExpected = &Resource{
	Name: "wordpress_instance",
	Links: []gophercloud.Link{
		gophercloud.Link{
			Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance",
			Rel:  "self",
		},
		gophercloud.Link{
			Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e",
			Rel:  "stack",
		},
	},
	LogicalID:    "wordpress_instance",
	Attributes:   map[string]interface{}{"SXSW": "atx"},
	StatusReason: "state changed",
	UpdatedTime:  time.Date(2014, 12, 10, 18, 34, 35, 0, time.UTC),
	RequiredBy:   []interface{}{},
	Status:       "CREATE_COMPLETE",
	PhysicalID:   "00e3a2fe-c65d-403c-9483-4db9930dd194",
	Type:         "OS::Nova::Server",
}

GetExpected represents the expected object from a Get request.

View Source
var GetSchemaExpected = &TypeSchema{
	Attributes: map[string]interface{}{
		"an_attribute": map[string]interface{}{
			"description": "An attribute description .",
		},
	},
	Properties: map[string]interface{}{
		"a_property": map[string]interface{}{
			"update_allowed": false,
			"required":       true,
			"type":           "string",
			"description":    "A resource description.",
		},
	},
	ResourceType: "OS::Heat::AResourceName",
	SupportStatus: map[string]interface{}{
		"message": "A status message",
		"status":  "SUPPORTED",
		"version": "2014.1",
	},
}

GetSchemaExpected represents the expected object from a Schema request.

View Source
var GetTemplateExpected = "" /* 1448-byte string literal not displayed */

GetTemplateExpected represents the expected object from a Template request.

View Source
var ListExpected = []Resource{
	Resource{
		Name: "hello_world",
		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",
				Rel:  "self",
			},
			gophercloud.Link{
				Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
				Rel:  "stack",
			},
		},
		LogicalID:    "hello_world",
		StatusReason: "state changed",
		UpdatedTime:  time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
		CreationTime: time.Date(2015, 2, 5, 21, 33, 10, 0, time.UTC),
		RequiredBy:   []interface{}{},
		Status:       "CREATE_IN_PROGRESS",
		PhysicalID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		Type:         "OS::Nova::Server",
		Attributes:   map[string]interface{}{"SXSW": "atx"},
		Description:  "Some resource",
	},
}

ListExpected represents the expected object from a List request.

View Source
var ListTypesExpected = ResourceTypes{
	"OS::Nova::Server",
	"OS::Heat::RandomString",
	"OS::Swift::Container",
	"OS::Trove::Instance",
	"OS::Nova::FloatingIPAssociation",
	"OS::Cinder::VolumeAttachment",
	"OS::Nova::FloatingIP",
	"OS::Nova::KeyPair",
}

ListTypesExpected represents the expected object from a ListTypes request.

View Source
var MetadataExpected = map[string]string{
	"number": "7",
	"animal": "auk",
}

MetadataExpected represents the expected object from a Metadata request.

View Source
var SortedListTypesExpected = ResourceTypes{
	"OS::Cinder::VolumeAttachment",
	"OS::Heat::RandomString",
	"OS::Nova::FloatingIP",
	"OS::Nova::FloatingIPAssociation",
	"OS::Nova::KeyPair",
	"OS::Nova::Server",
	"OS::Swift::Container",
	"OS::Trove::Instance",
}

same as above, but sorted

Functions

func HandleFindSuccessfully

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

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

func HandleGetSchemaSuccessfully

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

HandleGetSchemaSuccessfully creates an HTTP handler at `/resource_types/OS::Heat::AResourceName` on the test handler mux that responds with a `Schema` response.

func HandleGetSuccessfully

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

HandleGetSuccessfully creates an HTTP handler at `/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance` on the test handler mux that responds with a `Get` response.

func HandleGetTemplateSuccessfully

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

HandleGetTemplateSuccessfully creates an HTTP handler at `/resource_types/OS::Heat::AResourceName/template` on the test handler mux that responds with a `Template` response.

func HandleListSuccessfully

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

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

func HandleListTypesSuccessfully

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

HandleListTypesSuccessfully creates an HTTP handler at `/resource_types` on the test handler mux that responds with a `ListTypes` response.

func HandleMetadataSuccessfully

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

HandleMetadataSuccessfully creates an HTTP handler at `/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance/metadata` on the test handler mux that responds with a `Metadata` 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 ListTypes

func ListTypes(client *gophercloud.ServiceClient) pagination.Pager

ListTypes makes a request against the API to list resource types.

Types

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 resources for the given stack name.

func (FindResult) Extract

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

Extract returns a slice of Resource 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 string) GetResult

Get retreives data for the given stack resource.

func (GetResult) Extract

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

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

type ListOpts

type ListOpts struct {
	// Include resources from nest stacks up to Depth levels of recursion.
	Depth int `q:"nested_depth"`
}

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

func (ListOpts) ToStackResourceListQuery

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

ToStackResourceListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type MetadataResult

type MetadataResult struct {
	gophercloud.Result
}

MetadataResult represents the result of a Metadata operation.

func Metadata

func Metadata(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) MetadataResult

Metadata retreives the metadata for the given stack resource.

func (MetadataResult) Extract

func (r MetadataResult) Extract() (map[string]string, error)

Extract returns a map object and is called after a Metadata operation.

type Resource

type Resource struct {
	Attributes   map[string]interface{} `mapstructure:"attributes"`
	CreationTime time.Time              `mapstructure:"-"`
	Description  string                 `mapstructure:"description"`
	Links        []gophercloud.Link     `mapstructure:"links"`
	LogicalID    string                 `mapstructure:"logical_resource_id"`
	Name         string                 `mapstructure:"resource_name"`
	PhysicalID   string                 `mapstructure:"physical_resource_id"`
	RequiredBy   []interface{}          `mapstructure:"required_by"`
	Status       string                 `mapstructure:"resource_status"`
	StatusReason string                 `mapstructure:"resource_status_reason"`
	Type         string                 `mapstructure:"resource_type"`
	UpdatedTime  time.Time              `mapstructure:"-"`
}

Resource represents a stack resource.

func ExtractResources

func ExtractResources(page pagination.Page) ([]Resource, error)

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

type ResourcePage

type ResourcePage struct {
	pagination.SinglePageBase
}

ResourcePage 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 (ResourcePage) IsEmpty

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

IsEmpty returns true if a page contains no Server results.

type ResourceTypePage

type ResourceTypePage struct {
	pagination.SinglePageBase
}

ResourceTypePage abstracts the raw results of making a ListTypes() 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 ExtractResourceTypes call.

func (ResourceTypePage) IsEmpty

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

IsEmpty returns true if a ResourceTypePage contains no resource types.

type ResourceTypes

type ResourceTypes []string

ResourceTypes represents the type that holds the result of ExtractResourceTypes. We define methods on this type to sort it before output

func ExtractResourceTypes

func ExtractResourceTypes(page pagination.Page) (ResourceTypes, error)

ExtractResourceTypes extracts and returns resource types.

func (ResourceTypes) Len

func (r ResourceTypes) Len() int

func (ResourceTypes) Less

func (r ResourceTypes) Less(i, j int) bool

func (ResourceTypes) Swap

func (r ResourceTypes) Swap(i, j int)

type SchemaResult

type SchemaResult struct {
	gophercloud.Result
}

SchemaResult represents the result of a Schema operation.

func Schema

func Schema(c *gophercloud.ServiceClient, resourceType string) SchemaResult

Schema retreives the schema for the given resource type.

func (SchemaResult) Extract

func (r SchemaResult) Extract() (*TypeSchema, error)

Extract returns a pointer to a TypeSchema object and is called after a Schema operation.

type TemplateResult

type TemplateResult struct {
	gophercloud.Result
}

TemplateResult represents the result of a Template operation.

func Template

func Template(c *gophercloud.ServiceClient, resourceType string) TemplateResult

Template retreives the template representation for the given resource type.

func (TemplateResult) Extract

func (r TemplateResult) Extract() ([]byte, error)

Extract returns the template and is called after a Template operation.

type TypeSchema

type TypeSchema struct {
	Attributes    map[string]interface{} `mapstructure:"attributes"`
	Properties    map[string]interface{} `mapstrucutre:"properties"`
	ResourceType  string                 `mapstructure:"resource_type"`
	SupportStatus map[string]interface{} `mapstructure:"support_status"`
}

TypeSchema represents a stack resource schema.

Jump to

Keyboard shortcuts

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