MCPcopy
hub / github.com/cloudfoundry/cli / getRouteForBinding

Method getRouteForBinding

actor/v7action/route_binding.go:145–180  ·  view source on GitHub ↗
(params getRouteForBindingParams)

Source from the content-addressed store, hash-verified

143}
144
145func (actor Actor) getRouteForBinding(params getRouteForBindingParams) (resources.Route, ccv3.Warnings, error) {
146 var (
147 domain resources.Domain
148 routes []resources.Route
149 )
150
151 warnings, err := railway.Sequentially(
152 func() (warnings ccv3.Warnings, err error) {
153 domain, warnings, err = actor.getDomainByName(params.DomainName)
154 return
155 },
156 func() (warnings ccv3.Warnings, err error) {
157 routes, warnings, err = actor.CloudControllerClient.GetRoutes(
158 ccv3.Query{Key: ccv3.DomainGUIDFilter, Values: []string{domain.GUID}},
159 ccv3.Query{Key: ccv3.HostsFilter, Values: []string{params.Hostname}},
160 ccv3.Query{Key: ccv3.PathsFilter, Values: []string{params.Path}},
161 ccv3.Query{Key: ccv3.PerPage, Values: []string{"1"}},
162 ccv3.Query{Key: ccv3.Page, Values: []string{"1"}},
163 )
164 return
165 },
166 )
167
168 switch {
169 case err != nil:
170 return resources.Route{}, warnings, err
171 case len(routes) == 0:
172 return resources.Route{}, warnings, actionerror.RouteNotFoundError{
173 Host: params.Hostname,
174 DomainName: domain.Name,
175 Path: params.Path,
176 }
177 default:
178 return routes[0], warnings, nil
179 }
180}

Callers 2

CreateRouteBindingMethod · 0.95
DeleteRouteBindingMethod · 0.95

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 3

getDomainByNameMethod · 0.95
SequentiallyFunction · 0.92
GetRoutesMethod · 0.65

Tested by

no test coverage detected