github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/route_binding.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) CreateRouteBinding(binding resources.RouteBinding) (JobURL, Warnings, error) {
     9  	return client.MakeRequest(RequestParams{
    10  		RequestName: internal.PostRouteBindingRequest,
    11  		RequestBody: binding,
    12  	})
    13  }
    14  
    15  func (client *Client) GetRouteBindings(query ...Query) ([]resources.RouteBinding, IncludedResources, Warnings, error) {
    16  	var result []resources.RouteBinding
    17  
    18  	included, warnings, err := client.MakeListRequest(RequestParams{
    19  		RequestName:  internal.GetRouteBindingsRequest,
    20  		Query:        query,
    21  		ResponseBody: resources.RouteBinding{},
    22  		AppendToList: func(item interface{}) error {
    23  			result = append(result, item.(resources.RouteBinding))
    24  			return nil
    25  		},
    26  	})
    27  
    28  	return result, included, warnings, err
    29  }
    30  
    31  func (client *Client) DeleteRouteBinding(guid string) (JobURL, Warnings, error) {
    32  	return client.MakeRequest(RequestParams{
    33  		RequestName: internal.DeleteRouteBindingRequest,
    34  		URIParams:   internal.Params{"route_binding_guid": guid},
    35  	})
    36  }