MCPcopy Index your code
hub / github.com/cloudfoundry/cli / parseRoutePath

Method parseRoutePath

actor/v7action/route.go:105–146  ·  view source on GitHub ↗
(routePath string)

Source from the content-addressed store, hash-verified

103}
104
105func (actor Actor) parseRoutePath(routePath string) (string, string, string, resources.Domain, Warnings, error) {
106 var (
107 warnings Warnings
108 host string
109 path string
110 port string
111 )
112
113 routeParts := strings.SplitN(routePath, "/", 2)
114 domainAndPort := routeParts[0]
115 if len(routeParts) > 1 {
116 path = "/" + routeParts[1]
117 }
118
119 domainAndPortParts := strings.SplitN(domainAndPort, ":", 2)
120 domainName := domainAndPortParts[0]
121 if len(domainAndPortParts) > 1 {
122 port = domainAndPortParts[1]
123 }
124
125 domain, allWarnings, err := actor.GetDomainByName(domainName)
126
127 if err != nil {
128 _, domainNotFound := err.(actionerror.DomainNotFoundError)
129 domainParts := strings.SplitN(domainName, ".", 2)
130 needToCheckForHost := domainNotFound && len(domainParts) > 1
131
132 if !needToCheckForHost {
133 return "", "", "", resources.Domain{}, allWarnings, err
134 }
135
136 host = domainParts[0]
137 domainName = domainParts[1]
138 domain, warnings, err = actor.GetDomainByName(domainName)
139 allWarnings = append(allWarnings, warnings...)
140 if err != nil {
141 return "", "", "", resources.Domain{}, allWarnings, err
142 }
143 }
144
145 return host, path, port, domain, allWarnings, err
146}
147
148func (actor Actor) GetRoute(routePath string, spaceGUID string) (resources.Route, Warnings, error) {
149 filters := []ccv3.Query{

Callers 1

GetRouteMethod · 0.95

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 1

GetDomainByNameMethod · 0.95

Tested by

no test coverage detected