AddRoute calls the Tunnelstore POST endpoint for a given route.
(newRoute NewRoute)
| 159 | |
| 160 | // AddRoute calls the Tunnelstore POST endpoint for a given route. |
| 161 | func (r *RESTClient) AddRoute(newRoute NewRoute) (Route, error) { |
| 162 | endpoint := r.baseEndpoints.accountRoutes |
| 163 | endpoint.Path = path.Join(endpoint.Path) |
| 164 | resp, err := r.sendRequest("POST", endpoint, newRoute) |
| 165 | if err != nil { |
| 166 | return Route{}, errors.Wrap(err, "REST request failed") |
| 167 | } |
| 168 | defer resp.Body.Close() |
| 169 | |
| 170 | if resp.StatusCode == http.StatusOK { |
| 171 | return parseRoute(resp.Body) |
| 172 | } |
| 173 | |
| 174 | return Route{}, r.statusCodeToError("add route", resp) |
| 175 | } |
| 176 | |
| 177 | // DeleteRoute calls the Tunnelstore DELETE endpoint for a given route. |
| 178 | func (r *RESTClient) DeleteRoute(id uuid.UUID) error { |
nothing calls this directly
no test coverage detected