github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/rts/v1/stacktemplates/results.go (about) 1 package stacktemplates 2 3 import ( 4 "encoding/json" 5 6 "github.com/huaweicloud/golangsdk" 7 ) 8 9 // GetResult represents the result of a Get operation. 10 type GetResult struct { 11 golangsdk.Result 12 } 13 14 // Extract returns the JSON template and is called after a Get operation. 15 func (r GetResult) Extract() ([]byte, error) { 16 if r.Err != nil { 17 return nil, r.Err 18 } 19 template, err := json.MarshalIndent(r.Body, "", " ") 20 if err != nil { 21 return nil, err 22 } 23 return template, nil 24 }