forked from cloudfoundry/cli
/
stack.go
35 lines (29 loc) · 938 Bytes
/
stack.go
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
package ccv3
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
"code.cloudfoundry.org/cli/resources"
)
type Stack struct {
// GUID is a unique stack identifier.
GUID string `json:"guid"`
// Name is the name of the stack.
Name string `json:"name"`
// Description is the description for the stack
Description string `json:"description"`
// Metadata is used for custom tagging of API resources
Metadata *resources.Metadata `json:"metadata,omitempty"`
}
// GetStacks lists stacks with optional filters.
func (client *Client) GetStacks(query ...Query) ([]Stack, Warnings, error) {
var resources []Stack
_, warnings, err := client.MakeListRequest(RequestParams{
RequestName: internal.GetStacksRequest,
Query: query,
ResponseBody: Stack{},
AppendToList: func(item interface{}) error {
resources = append(resources, item.(Stack))
return nil
},
})
return resources, warnings, err
}