func (client *Client) GetSpaceRoutes(spaceGUID string, queryParams ...QQuery) ([]Route, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetSpaceRoutesRequest,
		URIParams:   map[string]string{"space_guid": spaceGUID},
		Query:       FormatQueryParameters(queryParams),
	})
	if err != nil {
		return nil, nil, err
	}
	var fullRoutesList []Route
	warnings, err := client.paginate(request, Route{}, func(item interface{}) error {
		if route, ok := item.(Route); ok {
			fullRoutesList = append(fullRoutesList, route)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   Route{},
				Unexpected: item,
			}
		}
		return nil
	})
	return fullRoutesList, warnings, err
}
GetSpaceRoutes returns a list of Routes associated with the provided Space
GUID, and filtered by the provided queries.
package ccv2
import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"code.cloudfoundry.org/cli/api/cloudcontroller"
	"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/internal"
	"code.cloudfoundry.org/cli/api/cloudcontroller/ccversion"
	"code.cloudfoundry.org/cli/types"
)
type Route struct {
	GUID       string        `json:"-"`
	Host       string        `json:"host,omitempty"`
	Path       string        `json:"path,omitempty"`
	Port       types.NullInt `json:"port,omitempty"`
	DomainGUID string        `json:"domain_guid"`
	SpaceGUID  string        `json:"space_guid"`
}
func (route *Route) UnmarshalJSON(data []byte) error {
	var ccRoute struct {
		Metadata internal.Metadata `json:"metadata"`
		Entity   struct {
			Host       string        `json:"host"`
			Path       string        `json:"path"`
			Port       types.NullInt `json:"port"`
			DomainGUID string        `json:"domain_guid"`
			SpaceGUID  string        `json:"space_guid"`
		} `json:"entity"`
	}
	if err := json.Unmarshal(data, &ccRoute); err != nil {
		return err
	}
	route.GUID = ccRoute.Metadata.GUID
	route.Host = ccRoute.Entity.Host
	route.Path = ccRoute.Entity.Path
	route.Port = ccRoute.Entity.Port
	route.DomainGUID = ccRoute.Entity.DomainGUID
	route.SpaceGUID = ccRoute.Entity.SpaceGUID
	return nil
}
func (client *Client) UpdateRouteApplication(routeGUID string, appGUID string) (Route, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PutRouteAppRequest,
		URIParams: map[string]string{
			"app_guid":   appGUID,
			"route_guid": routeGUID,
		},
	})
	if err != nil {
		return Route{}, nil, err
	}
	var route Route
	response := cloudcontroller.Response{
		Result: &route,
	}
	err = client.connection.Make(request, &response)
	return route, response.Warnings, err
}
func (client *Client) DeleteRouteApplication(routeGUID string, appGUID string) (Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.DeleteRouteAppRequest,
		URIParams: map[string]string{
			"app_guid":   appGUID,
			"route_guid": routeGUID,
		},
	})
	if err != nil {
		return nil, err
	}
	var response cloudcontroller.Response
	err = client.connection.Make(request, &response)
	return response.Warnings, err
}
func (client *Client) CreateRoute(route Route, generatePort bool) (Route, Warnings, error) {
	body, err := json.Marshal(route)
	if err != nil {
		return Route{}, nil, err
	}
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PostRouteRequest,
		Body:        bytes.NewReader(body),
	})
	if err != nil {
		return Route{}, nil, err
	}
	if generatePort {
		query := url.Values{}
		query.Add("generate_port", "true")
		request.URL.RawQuery = query.Encode()
	}
	var updatedRoute Route
	response := cloudcontroller.Response{
		Result: &updatedRoute,
	}
	err = client.connection.Make(request, &response)
	return updatedRoute, response.Warnings, err
}
func (client *Client) GetApplicationRoutes(appGUID string, queryParams ...QQuery) ([]Route, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetAppRoutesRequest,
		URIParams:   map[string]string{"app_guid": appGUID},
		Query:       FormatQueryParameters(queryParams),
	})
	if err != nil {
		return nil, nil, err
	}
	var fullRoutesList []Route
	warnings, err := client.paginate(request, Route{}, func(item interface{}) error {
		if route, ok := item.(Route); ok {
			fullRoutesList = append(fullRoutesList, route)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   Route{},
				Unexpected: item,
			}
		}
		return nil
	})
	return fullRoutesList, warnings, err
}