stacktemplates

package
v0.3.0-dev Latest Latest
Warning

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

Go to latest
Published: May 21, 2015 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package stacktemplates provides operations for working with Heat templates. A Cloud Orchestration template is a portable file, written in a user-readable language, that describes how a set of resources should be assembled and what software should be installed in order to produce a working stack. The template specifies what resources should be used, what attributes can be set, and other parameters that are critical to the successful, repeatable automation of a specific application stack.

Index

Constants

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

GetOutput represents the response body from a Get request.

View Source
const ValidateOutput = `` /* 210-byte string literal not displayed */

ValidateOutput represents the response body from a Validate request.

Variables

View Source
var GetExpected = &Template{
	Description:         "Simple template to test heat commands",
	HeatTemplateVersion: "2013-05-23",
	Parameters: map[string]interface{}{
		"flavor": map[string]interface{}{
			"default": "m1.tiny",
			"type":    "string",
		},
	},
	Resources: map[string]interface{}{
		"hello_world": map[string]interface{}{
			"type": "OS::Nova::Server",
			"properties": map[string]interface{}{
				"key_name": "heat_key",
				"flavor": map[string]interface{}{
					"get_param": "flavor",
				},
				"image":     "ad091b52-742f-469e-8f3c-fd81cadf0743",
				"user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n",
			},
		},
	},
}

GetExpected represents the expected object from a Get request.

View Source
var ValidateExpected = &ValidatedTemplate{
	Description: "Simple template to test heat commands",
	Parameters: map[string]interface{}{
		"flavor": map[string]interface{}{
			"Default":     "m1.tiny",
			"Type":        "String",
			"NoEcho":      "false",
			"Description": "",
			"Label":       "flavor",
		},
	},
}

ValidateExpected represents the expected object from a Validate request.

Functions

func HandleGetSuccessfully

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

HandleGetSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87/template` on the test handler mux that responds with a `Get` response.

func HandleValidateSuccessfully

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

HandleValidateSuccessfully creates an HTTP handler at `/validate` on the test handler mux that responds with a `Validate` response.

Types

type GetResult

type GetResult struct {
	gophercloud.Result
}

GetResult represents the result of a Get operation.

func Get

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

Get retreives data for the given stack template.

func (GetResult) Extract

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

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

type Template

type Template struct {
	Description         string                 `mapstructure:"description"`
	HeatTemplateVersion string                 `mapstructure:"heat_template_version"`
	Parameters          map[string]interface{} `mapstructure:"parameters"`
	Resources           map[string]interface{} `mapstructure:"resources"`
}

Template represents a stack template.

type ValidateOpts

type ValidateOpts struct {
	Template    map[string]interface{}
	TemplateURL string
}

ValidateOpts specifies the template validation parameters.

func (ValidateOpts) ToStackTemplateValidateMap

func (opts ValidateOpts) ToStackTemplateValidateMap() (map[string]interface{}, error)

ToStackTemplateValidateMap assembles a request body based on the contents of a ValidateOpts.

type ValidateOptsBuilder

type ValidateOptsBuilder interface {
	ToStackTemplateValidateMap() (map[string]interface{}, error)
}

ValidateOptsBuilder describes struct types that can be accepted by the Validate call. The ValidateOpts struct in this package does.

type ValidateResult

type ValidateResult struct {
	gophercloud.Result
}

ValidateResult represents the result of a Validate operation.

func Validate

Validate validates the given stack template.

func (ValidateResult) Extract

func (r ValidateResult) Extract() (*ValidatedTemplate, error)

Extract returns a pointer to a ValidatedTemplate object and is called after a Validate operation.

type ValidatedTemplate

type ValidatedTemplate struct {
	Description string
	Parameters  map[string]interface{}
}

ValidatedTemplate represents the parsed object returned from a Validate request.

Jump to

Keyboard shortcuts

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