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

Method CheckIfExists

cf/api/routes.go:130–155  ·  view source on GitHub ↗
(host string, domain models.DomainFields, path string)

Source from the content-addressed store, hash-verified

128}
129
130func (repo CloudControllerRouteRepository) CheckIfExists(host string, domain models.DomainFields, path string) (bool, error) {
131 path = normalizedPath(path)
132
133 u, err := url.Parse(repo.config.APIEndpoint())
134 if err != nil {
135 return false, err
136 }
137
138 u.Path = fmt.Sprintf("/v2/routes/reserved/domain/%s/host/%s", domain.GUID, host)
139 if path != "" {
140 q := u.Query()
141 q.Set("path", path)
142 u.RawQuery = q.Encode()
143 }
144
145 var rawResponse interface{}
146 err = repo.gateway.GetResource(u.String(), &rawResponse)
147 if err != nil {
148 if _, ok := err.(*errors.HTTPNotFoundError); ok {
149 return false, nil
150 }
151 return false, err
152 }
153
154 return true, nil
155}
156
157func (repo CloudControllerRouteRepository) CreateInSpace(host, path, domainGUID, spaceGUID string, port int, randomPort bool) (models.Route, error) {
158 path = normalizedPath(path)

Callers

nothing calls this directly

Calls 6

normalizedPathFunction · 0.85
GetResourceMethod · 0.80
ParseMethod · 0.65
APIEndpointMethod · 0.65
SetMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected