Skip to content

Commit

Permalink
rename tunnel route get methods to conform to convention
Browse files Browse the repository at this point in the history
  • Loading branch information
tpickett66 committed Mar 30, 2022
1 parent 7826722 commit 64fa12f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tunnel_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ type tunnelRouteResponse struct {
Result TunnelRoute `json:"result"`
}

// TunnelRoutes lists all defined routes for tunnels in the account.
// ListTunnelRoutes lists all defined routes for tunnels in the account.
//
// See: https://api.cloudflare.com/#tunnel-route-list-tunnel-routes
func (api *API) TunnelRoutes(ctx context.Context, params TunnelRoutesListParams) ([]TunnelRoute, error) {
func (api *API) ListTunnelRoutes(ctx context.Context, params TunnelRoutesListParams) ([]TunnelRoute, error) {
if params.AccountID == "" {
return []TunnelRoute{}, ErrMissingAccountID
}
Expand All @@ -91,10 +91,10 @@ func (api *API) TunnelRoutes(ctx context.Context, params TunnelRoutesListParams)
return resp.Result, nil
}

// TunnelRouteForIP finds the Tunnel Route that encompasses the given IP.
// GetTunnelRouteForIP finds the Tunnel Route that encompasses the given IP.
//
// See: https://api.cloudflare.com/#tunnel-route-get-tunnel-route-by-ip
func (api *API) TunnelRouteForIP(ctx context.Context, params TunnelRoutesForIPParams) (TunnelRoute, error) {
func (api *API) GetTunnelRouteForIP(ctx context.Context, params TunnelRoutesForIPParams) (TunnelRoute, error) {
uri := fmt.Sprintf("/%s/%s/teamnet/routes/ip/%s", AccountRouteRoot, params.AccountID, params.Network)

responseBody, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
Expand Down
4 changes: 2 additions & 2 deletions tunnel_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestListTunnelRoutes(t *testing.T) {
}

params := TunnelRoutesListParams{AccountID: testAccountID}
got, err := client.TunnelRoutes(context.Background(), params)
got, err := client.ListTunnelRoutes(context.Background(), params)

if assert.NoError(t, err) {
assert.Equal(t, want, got)
Expand Down Expand Up @@ -91,7 +91,7 @@ func TestTunnelRouteForIP(t *testing.T) {
DeletedAt: &ts,
}

got, err := client.TunnelRouteForIP(context.Background(), TunnelRoutesForIPParams{AccountID: testAccountID, Network: "10.1.0.137"})
got, err := client.GetTunnelRouteForIP(context.Background(), TunnelRoutesForIPParams{AccountID: testAccountID, Network: "10.1.0.137"})

if assert.NoError(t, err) {
assert.Equal(t, want, got)
Expand Down

0 comments on commit 64fa12f

Please sign in to comment.