github.com/sleungcy/cli@v7.1.0+incompatible/api/cloudcontroller/ccv3/stack.go (about) 1 package ccv3 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" 5 "code.cloudfoundry.org/cli/resources" 6 ) 7 8 type Stack struct { 9 // GUID is a unique stack identifier. 10 GUID string `json:"guid"` 11 // Name is the name of the stack. 12 Name string `json:"name"` 13 // Description is the description for the stack 14 Description string `json:"description"` 15 16 // Metadata is used for custom tagging of API resources 17 Metadata *resources.Metadata `json:"metadata,omitempty"` 18 } 19 20 // GetStacks lists stacks with optional filters. 21 func (client *Client) GetStacks(query ...Query) ([]Stack, Warnings, error) { 22 var resources []Stack 23 24 _, warnings, err := client.MakeListRequest(RequestParams{ 25 RequestName: internal.GetStacksRequest, 26 Query: query, 27 ResponseBody: Stack{}, 28 AppendToList: func(item interface{}) error { 29 resources = append(resources, item.(Stack)) 30 return nil 31 }, 32 }) 33 34 return resources, warnings, err 35 }