File: doc.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,416 kB
  • sloc: sh: 99; makefile: 21
file content (70 lines) | stat: -rw-r--r-- 1,988 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
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).

Example of get resource information in stack

	rsrc_result := stackresources.Get(client, stack.Name, stack.ID, rsrc.Name)
	if rsrc_result.Err != nil {
	    panic(rsrc_result.Err)
	}
	rsrc, err := rsrc_result.Extract()
	if err != nil {
	    panic(err)
	}

Example for list stack resources

	all_stack_rsrc_pages, err := stackresources.List(client, stack.Name, stack.ID, nil).AllPages()
	if err != nil {
	    panic(err)
	}

	all_stack_rsrcs, err := stackresources.ExtractResources(all_stack_rsrc_pages)
	if err != nil {
	    panic(err)
	}

	fmt.Println("Resource List:")
	for _, rsrc := range all_stack_rsrcs {
	    // Get information of a resource in stack
	    rsrc_result := stackresources.Get(client, stack.Name, stack.ID, rsrc.Name)
	    if rsrc_result.Err != nil {
	        panic(rsrc_result.Err)
	    }
	    rsrc, err := rsrc_result.Extract()
	    if err != nil {
	        panic(err)
	    }
	    fmt.Println("Resource Name: ", rsrc.Name, ", Physical ID: ", rsrc.PhysicalID, ", Status: ", rsrc.Status)
	}

Example for get resource type schema

	schema_result := stackresources.Schema(client, "OS::Heat::Stack")
	if schema_result.Err != nil {
	    panic(schema_result.Err)
	}
	schema, err := schema_result.Extract()
	if err != nil {
	    panic(err)
	}
	fmt.Println("Schema for resource type OS::Heat::Stack")
	fmt.Println(schema.SupportStatus)

Example for get resource type Template

	tmp_result := stackresources.Template(client, "OS::Heat::Stack")
	if tmp_result.Err != nil {
	    panic(tmp_result.Err)
	}
	tmp, err := tmp_result.Extract()
	if err != nil {
	    panic(err)
	}
	fmt.Println("Template for resource type OS::Heat::Stack")
	fmt.Println(string(tmp))
*/
package stackresources