github.com/gophercloud/gophercloud@v1.11.0/openstack/orchestration/v1/stacktemplates/doc.go (about)

     1  /*
     2  Package stacktemplates provides operations for working with Heat templates.
     3  A Cloud Orchestration template is a portable file, written in a user-readable
     4  language, that describes how a set of resources should be assembled and what
     5  software should be installed in order to produce a working stack. The template
     6  specifies what resources should be used, what attributes can be set, and other
     7  parameters that are critical to the successful, repeatable automation of a
     8  specific application stack.
     9  
    10  Example to get stack template
    11  
    12  	temp, err := stacktemplates.Get(client, stack.Name, stack.ID).Extract()
    13  	if err != nil {
    14  	    panic(err)
    15  	}
    16  	fmt.Println("Get Stack Template for Stack ", stack.Name)
    17  	fmt.Println(string(temp))
    18  
    19  Example to validate stack template
    20  
    21  	f2, err := ioutil.ReadFile("template.err.yaml")
    22  	if err != nil {
    23  	    panic(err)
    24  	}
    25  	fmt.Println(string(f2))
    26  	validateOpts := &stacktemplates.ValidateOpts{
    27  	    Template: string(f2),
    28  	}
    29  	validate_result, err := stacktemplates.Validate(client, validateOpts).Extract()
    30  	if err != nil {
    31  	    // If validate failed, you will get error message here
    32  	    fmt.Println("Validate failed: ", err.Error())
    33  	} else {
    34  	    fmt.Println(validate_result.Parameters)
    35  	}
    36  */
    37  package stacktemplates