forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroute_binding.go
36 lines (30 loc) · 1.08 KB
/
route_binding.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
36
package ccv3
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
"code.cloudfoundry.org/cli/resources"
)
func (client *Client) CreateRouteBinding(binding resources.RouteBinding) (JobURL, Warnings, error) {
return client.MakeRequest(RequestParams{
RequestName: internal.PostRouteBindingRequest,
RequestBody: binding,
})
}
func (client *Client) GetRouteBindings(query ...Query) ([]resources.RouteBinding, IncludedResources, Warnings, error) {
var result []resources.RouteBinding
included, warnings, err := client.MakeListRequest(RequestParams{
RequestName: internal.GetRouteBindingsRequest,
Query: query,
ResponseBody: resources.RouteBinding{},
AppendToList: func(item interface{}) error {
result = append(result, item.(resources.RouteBinding))
return nil
},
})
return result, included, warnings, err
}
func (client *Client) DeleteRouteBinding(guid string) (JobURL, Warnings, error) {
return client.MakeRequest(RequestParams{
RequestName: internal.DeleteRouteBindingRequest,
URIParams: internal.Params{"route_binding_guid": guid},
})
}