github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/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  // GetStacks lists stacks with optional filters.
     9  func (client *Client) GetStacks(query ...Query) ([]resources.Stack, Warnings, error) {
    10  	var stacks []resources.Stack
    11  
    12  	_, warnings, err := client.MakeListRequest(RequestParams{
    13  		RequestName:  internal.GetStacksRequest,
    14  		Query:        query,
    15  		ResponseBody: resources.Stack{},
    16  		AppendToList: func(item interface{}) error {
    17  			stacks = append(stacks, item.(resources.Stack))
    18  			return nil
    19  		},
    20  	})
    21  
    22  	return stacks, warnings, err
    23  }