github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/revisions.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  func (client *Client) GetApplicationRevisions(appGUID string, query ...Query) ([]resources.Revision, Warnings, error) {
     9  	var revisions []resources.Revision
    10  
    11  	_, warnings, err := client.MakeListRequest(RequestParams{
    12  		RequestName:  internal.GetApplicationRevisionsRequest,
    13  		Query:        query,
    14  		URIParams:    internal.Params{"app_guid": appGUID},
    15  		ResponseBody: resources.Revision{},
    16  		AppendToList: func(item interface{}) error {
    17  			revisions = append(revisions, item.(resources.Revision))
    18  			return nil
    19  		},
    20  	})
    21  	return revisions, warnings, err
    22  }
    23  
    24  func (client *Client) GetApplicationRevisionsDeployed(appGUID string) ([]resources.Revision, Warnings, error) {
    25  	var revisions []resources.Revision
    26  
    27  	_, warnings, err := client.MakeListRequest(RequestParams{
    28  		RequestName:  internal.GetApplicationRevisionsDeployedRequest,
    29  		URIParams:    internal.Params{"app_guid": appGUID},
    30  		ResponseBody: resources.Revision{},
    31  		AppendToList: func(item interface{}) error {
    32  			revisions = append(revisions, item.(resources.Revision))
    33  			return nil
    34  		},
    35  	})
    36  	return revisions, warnings, err
    37  }