TUN-3722: Teamnet API paths include /network
This commit is contained in:
parent
55bf904689
commit
92fd039440
|
@ -31,7 +31,7 @@ func (r *RESTClient) ListRoutes(filter *teamnet.Filter) ([]*teamnet.Route, error
|
||||||
// AddRoute calls the Tunnelstore POST endpoint for a given route.
|
// AddRoute calls the Tunnelstore POST endpoint for a given route.
|
||||||
func (r *RESTClient) AddRoute(newRoute teamnet.NewRoute) (teamnet.Route, error) {
|
func (r *RESTClient) AddRoute(newRoute teamnet.NewRoute) (teamnet.Route, error) {
|
||||||
endpoint := r.baseEndpoints.accountRoutes
|
endpoint := r.baseEndpoints.accountRoutes
|
||||||
endpoint.Path = path.Join(endpoint.Path, url.PathEscape(newRoute.Network.String()))
|
endpoint.Path = path.Join(endpoint.Path, "network", url.PathEscape(newRoute.Network.String()))
|
||||||
resp, err := r.sendRequest("POST", endpoint, newRoute)
|
resp, err := r.sendRequest("POST", endpoint, newRoute)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return teamnet.Route{}, errors.Wrap(err, "REST request failed")
|
return teamnet.Route{}, errors.Wrap(err, "REST request failed")
|
||||||
|
@ -48,7 +48,7 @@ func (r *RESTClient) AddRoute(newRoute teamnet.NewRoute) (teamnet.Route, error)
|
||||||
// DeleteRoute calls the Tunnelstore DELETE endpoint for a given route.
|
// DeleteRoute calls the Tunnelstore DELETE endpoint for a given route.
|
||||||
func (r *RESTClient) DeleteRoute(network net.IPNet) error {
|
func (r *RESTClient) DeleteRoute(network net.IPNet) error {
|
||||||
endpoint := r.baseEndpoints.accountRoutes
|
endpoint := r.baseEndpoints.accountRoutes
|
||||||
endpoint.Path = path.Join(endpoint.Path, url.PathEscape(network.String()))
|
endpoint.Path = path.Join(endpoint.Path, "network", url.PathEscape(network.String()))
|
||||||
resp, err := r.sendRequest("DELETE", endpoint, nil)
|
resp, err := r.sendRequest("DELETE", endpoint, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "REST request failed")
|
return errors.Wrap(err, "REST request failed")
|
||||||
|
|
Loading…
Reference in New Issue