stackresources

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2015 License: Apache-2.0, Apache-2.0 Imports: 10 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 = `` /* 776-byte string literal not displayed */

FindOutput represents the response body from a Find request.

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

GetOutput represents the response body from a Get request.

View Source
const GetSchemaOutput = `` /* 325-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 = `` /* 761-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),
		RequiredBy:   []interface{}{},
		Status:       "CREATE_IN_PROGRESS",
		PhysicalID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		Type:         "OS::Nova::Server",
	},
}

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",
	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",
}

GetSchemaExpected represents the expected object from a Schema request.

View Source
var GetTemplateExpected = &TypeTemplate{
	HeatTemplateFormatVersion: "2012-12-12",
	Outputs: map[string]interface{}{
		"private_key": map[string]interface{}{
			"Description": "The private key if it has been saved.",
			"Value":       "{\"Fn::GetAtt\": [\"KeyPair\", \"private_key\"]}",
		},
		"public_key": map[string]interface{}{
			"Description": "The public key.",
			"Value":       "{\"Fn::GetAtt\": [\"KeyPair\", \"public_key\"]}",
		},
	},
	Parameters: map[string]interface{}{
		"name": map[string]interface{}{
			"Description": "The name of the key pair.",
			"Type":        "String",
		},
		"public_key": map[string]interface{}{
			"Description": "The optional public key. This allows users to supply the public key from a pre-existing key pair. If not supplied, a new key pair will be generated.",
			"Type":        "String",
		},
		"save_private_key": map[string]interface{}{
			"AllowedValues": []string{
				"True",
				"true",
				"False",
				"false",
			},
			"Default":     false,
			"Description": "True if the system should remember a generated private key; False otherwise.",
			"Type":        "String",
		},
	},
	Resources: map[string]interface{}{
		"KeyPair": map[string]interface{}{
			"Properties": map[string]interface{}{
				"name": map[string]interface{}{
					"Ref": "name",
				},
				"public_key": map[string]interface{}{
					"Ref": "public_key",
				},
				"save_private_key": map[string]interface{}{
					"Ref": "save_private_key",
				},
			},
			"Type": "OS::Nova::KeyPair",
		},
	},
}

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),
		RequiredBy:   []interface{}{},
		Status:       "CREATE_IN_PROGRESS",
		PhysicalID:   "49181cd6-169a-4130-9455-31185bbfc5bf",
		Type:         "OS::Nova::Server",
	},
}

ListExpected represents the expected object from a List request.

View Source
var ListTypesExpected = []string{
	"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.

Functions

func ExtractResourceTypes

func ExtractResourceTypes(page pagination.Page) ([]string, error)

ExtractResourceTypes extracts and returns resource types.

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 {
	// 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"`

	// 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 {
	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.MarkerPageBase
}

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.

func (ResourcePage) LastMarker

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

LastMarker returns the last container name in a ListResult.

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 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() (*TypeTemplate, error)

Extract returns a pointer to a TypeTemplate object 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"`
}

TypeSchema represents a stack resource schema.

type TypeTemplate

type TypeTemplate struct {
	HeatTemplateFormatVersion string
	Outputs                   map[string]interface{}
	Parameters                map[string]interface{}
	Resources                 map[string]interface{}
}

TypeTemplate represents a stack resource template.

Jump to

Keyboard shortcuts

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