stacktemplates

package
v1.1.30 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 2 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.

Example to get stack template

temp, err := stacktemplates.Get(client, stack.Name, stack.ID).Extract()
if err != nil {
    panic(err)
}
fmt.Println("Get Stack Template for Stack ", stack.Name)
fmt.Println(string(temp))

Example to validate stack template

f2, err := ioutil.ReadFile("template.err.yaml")
if err != nil {
    panic(err)
}
fmt.Println(string(f2))
validateOpts := &stacktemplates.ValidateOpts{
    Template: string(f2),
}
validate_result, err := stacktemplates.Validate(client, validateOpts).Extract()
if err != nil {
    // If validate failed, you will get error message here
    fmt.Println("Validate failed: ", err.Error())
} else {
    fmt.Println(validate_result.Parameters)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) (r GetResult)

Get retreives data for the given stack template.

func (GetResult) Extract

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

Extract returns the JSON template and is called after a Get operation.

type ValidateOpts

type ValidateOpts struct {
	Template    string `json:"template" or:"TemplateURL"`
	TemplateURL string `json:"template_url" or:"Template"`
}

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                 `json:"Description"`
	Parameters      map[string]interface{} `json:"Parameters"`
	ParameterGroups map[string]interface{} `json:"ParameterGroups"`
}

ValidatedTemplate represents the parsed object returned from a Validate request.

Directories

Path Synopsis
orchestration_stacktemplates_v1
orchestration_stacktemplates_v1

Jump to

Keyboard shortcuts

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