ListRoutes calls the Tunnelstore GET endpoint for all routes under an account. Due to pagination on the server side it will call the endpoint multiple times if needed.
(filter *IpRouteFilter)
| 139 | // ListRoutes calls the Tunnelstore GET endpoint for all routes under an account. |
| 140 | // Due to pagination on the server side it will call the endpoint multiple times if needed. |
| 141 | func (r *RESTClient) ListRoutes(filter *IpRouteFilter) ([]*DetailedRoute, error) { |
| 142 | fetchFn := func(page int) (*http.Response, error) { |
| 143 | endpoint := r.baseEndpoints.accountRoutes |
| 144 | filter.Page(page) |
| 145 | endpoint.RawQuery = filter.Encode() |
| 146 | rsp, err := r.sendRequest("GET", endpoint, nil) |
| 147 | |
| 148 | if err != nil { |
| 149 | return nil, errors.Wrap(err, "REST request failed") |
| 150 | } |
| 151 | if rsp.StatusCode != http.StatusOK { |
| 152 | rsp.Body.Close() |
| 153 | return nil, r.statusCodeToError("list routes", rsp) |
| 154 | } |
| 155 | return rsp, nil |
| 156 | } |
| 157 | return fetchExhaustively[DetailedRoute](fetchFn) |
| 158 | } |
| 159 | |
| 160 | // AddRoute calls the Tunnelstore POST endpoint for a given route. |
| 161 | func (r *RESTClient) AddRoute(newRoute NewRoute) (Route, error) { |
nothing calls this directly
no test coverage detected