(domain resources.Domain, hostname string, path string, port int)
| 377 | } |
| 378 | |
| 379 | func (actor Actor) GetRouteByAttributes(domain resources.Domain, hostname string, path string, port int) (resources.Route, Warnings, error) { |
| 380 | var ( |
| 381 | routes []resources.Route |
| 382 | ccWarnings ccv3.Warnings |
| 383 | err error |
| 384 | ) |
| 385 | |
| 386 | queries := []ccv3.Query{ |
| 387 | {Key: ccv3.DomainGUIDFilter, Values: []string{domain.GUID}}, |
| 388 | {Key: ccv3.HostsFilter, Values: []string{hostname}}, |
| 389 | {Key: ccv3.PathsFilter, Values: []string{path}}, |
| 390 | {Key: ccv3.PerPage, Values: []string{"1"}}, |
| 391 | {Key: ccv3.Page, Values: []string{"1"}}, |
| 392 | } |
| 393 | |
| 394 | if domain.IsTCP() { |
| 395 | queries = append(queries, ccv3.Query{Key: ccv3.PortsFilter, Values: []string{strconv.Itoa(port)}}) |
| 396 | } |
| 397 | |
| 398 | routes, ccWarnings, err = actor.CloudControllerClient.GetRoutes(queries...) |
| 399 | if err != nil { |
| 400 | return resources.Route{}, Warnings(ccWarnings), err |
| 401 | } |
| 402 | |
| 403 | if len(routes) < 1 { |
| 404 | return resources.Route{}, Warnings(ccWarnings), actionerror.RouteNotFoundError{ |
| 405 | DomainName: domain.Name, |
| 406 | Host: hostname, |
| 407 | Path: path, |
| 408 | Port: port, |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | return routes[0], Warnings(ccWarnings), nil |
| 413 | } |
| 414 | |
| 415 | func (actor Actor) MapRoute(routeGUID string, appGUID string, destinationProtocol string, destinationPort int) (Warnings, error) { |
| 416 | warnings, err := actor.CloudControllerClient.MapRoute(routeGUID, appGUID, destinationProtocol, destinationPort) |
no test coverage detected