Repository: cloudflare/cloudflare-go
Pull request #1084 (2022-09-09 01:23:37)

load_balancing: revamp methods for consistent usage
Updates the load balancing methods to:

- Ensure we have a consistent experience for user, zone and account
  level resources.
- A consistent method signature where `ctx` and `params` are available
  to all methods and filtering is performed based on the values passed
  in. See [experimental docs] for details.
- `Modify..` => `Update` to match other method conventions.


Unblocks https://github.com/cloudflare/terraform-provider-cloudflare/issues/1876

[experimental docs]: https://github.com/cloudflare/cloudflare-go/blob/master/docs/experimental.md


Patch:
diff --git a/.changelog/1084.txt b/.changelog/1084.txt
new file mode 100644
index 000000000..6599587b7
--- /dev/null
+++ b/.changelog/1084.txt
@@ -0,0 +1,3 @@
+```release-note:breaking-change
+load_balancing: update method signatures to match experimental conventions
+```
diff --git a/consts.go b/consts.go
index 9696f99e9..668ddc315 100644
--- a/consts.go
+++ b/consts.go
@@ -21,6 +21,7 @@ const (
 	// Used for testing.
 	testAccountID    = "01a7362d577a6c3019a474fd6f485823"
 	testZoneID       = "d56084adb405e0b7e32c52321bf07be6"
+	testUserID       = "a81be4e9b20632860d20a64c054c4150"
 	testCertPackUUID = "a77f8bd7-3b47-46b4-a6f1-75cf98109948"
 	testTunnelID     = "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"
 )
diff --git a/errors.go b/errors.go
index 64c696d6c..615438983 100644
--- a/errors.go
+++ b/errors.go
@@ -29,6 +29,8 @@ const (
 	errInvalidZoneIdentifer                   = "invalid zone identifier: %s"
 	errAPIKeysAndTokensAreMutuallyExclusive   = "API keys and tokens are mutually exclusive"
 	errMissingCredentials                     = "no credentials provided"
+
+	errInvalidResourceContainerAccess = "requested resource container (%q) is not supported for this endpoint"
 )
 
 var (
diff --git a/load_balancing.go b/load_balancing.go
index 2df80a8c6..2fcd71fa8 100644
--- a/load_balancing.go
+++ b/load_balancing.go
@@ -3,6 +3,7 @@ package cloudflare
 import (
 	"context"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"net/http"
 	"time"
@@ -252,12 +253,64 @@ type loadBalancerPoolHealthResponse struct {
 	Result LoadBalancerPoolHealth `json:"result"`
 }
 
+type CreateLoadBalancerPoolParams struct {
+	LoadBalancerPool LoadBalancerPool
+}
+
+type ListLoadBalancerPoolParams struct {
+	PaginationOptions
+}
+
+type UpdateLoadBalancerPoolParams struct {
+	LoadBalancer LoadBalancerPool
+}
+
+type CreateLoadBalancerMonitorParams struct {
+	LoadBalancerMonitor LoadBalancerMonitor
+}
+
+type ListLoadBalancerMonitorParams struct {
+	PaginationOptions
+}
+
+type UpdateLoadBalancerMonitorParams struct {
+	LoadBalancerMonitor LoadBalancerMonitor
+}
+
+type CreateLoadBalancerParams struct {
+	LoadBalancer LoadBalancer
+}
+
+type ListLoadBalancerParams struct {
+	PaginationOptions
+}
+
+type UpdateLoadBalancerParams struct {
+	LoadBalancer LoadBalancer
+}
+
+var (
+	ErrMissingPoolID         = errors.New("missing required pool ID")
+	ErrMissingMonitorID      = errors.New("missing required monitor ID")
+	ErrMissingLoadBalancerID = errors.New("missing required load balancer ID")
+)
+
 // CreateLoadBalancerPool creates a new load balancer pool.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-pools-create-pool
-func (api *API) CreateLoadBalancerPool(ctx context.Context, pool LoadBalancerPool) (LoadBalancerPool, error) {
-	uri := fmt.Sprintf("%s/load_balancers/pools", api.userBaseURL("/user"))
-	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, pool)
+func (api *API) CreateLoadBalancerPool(ctx context.Context, rc *ResourceContainer, params CreateLoadBalancerPoolParams) (LoadBalancerPool, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerPool{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = "/user/load_balancers/pools"
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/pools", rc.Identifier)
+	}
+
+	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, params.LoadBalancerPool)
 	if err != nil {
 		return LoadBalancerPool{}, err
 	}
@@ -271,8 +324,20 @@ func (api *API) CreateLoadBalancerPool(ctx context.Context, pool LoadBalancerPoo
 // ListLoadBalancerPools lists load balancer pools connected to an account.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-pools-list-pools
-func (api *API) ListLoadBalancerPools(ctx context.Context) ([]LoadBalancerPool, error) {
-	uri := fmt.Sprintf("%s/load_balancers/pools", api.userBaseURL("/user"))
+func (api *API) ListLoadBalancerPools(ctx context.Context, rc *ResourceContainer, params ListLoadBalancerPoolParams) ([]LoadBalancerPool, error) {
+	if rc.Level == ZoneRouteLevel {
+		return []LoadBalancerPool{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = "/user/load_balancers/pools"
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/pools", rc.Identifier)
+	}
+
+	uri = buildURI(uri, params.PaginationOptions)
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return nil, err
@@ -284,11 +349,25 @@ func (api *API) ListLoadBalancerPools(ctx context.Context) ([]LoadBalancerPool,
 	return r.Result, nil
 }
 
-// LoadBalancerPoolDetails returns the details for a load balancer pool.
+// GetLoadBalancerPool returns the details for a load balancer pool.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-pools-pool-details
-func (api *API) LoadBalancerPoolDetails(ctx context.Context, poolID string) (LoadBalancerPool, error) {
-	uri := fmt.Sprintf("%s/load_balancers/pools/%s", api.userBaseURL("/user"), poolID)
+func (api *API) GetLoadBalancerPool(ctx context.Context, rc *ResourceContainer, poolID string) (LoadBalancerPool, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerPool{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if poolID == "" {
+		return LoadBalancerPool{}, ErrMissingPoolID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/pools/%s", poolID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/pools/%s", rc.Identifier, poolID)
+	}
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return LoadBalancerPool{}, err
@@ -303,20 +382,49 @@ func (api *API) LoadBalancerPoolDetails(ctx context.Context, poolID string) (Loa
 // DeleteLoadBalancerPool disables and deletes a load balancer pool.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-pools-delete-pool
-func (api *API) DeleteLoadBalancerPool(ctx context.Context, poolID string) error {
-	uri := fmt.Sprintf("%s/load_balancers/pools/%s", api.userBaseURL("/user"), poolID)
+func (api *API) DeleteLoadBalancerPool(ctx context.Context, rc *ResourceContainer, poolID string) error {
+	if rc.Level == ZoneRouteLevel {
+		return fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if poolID == "" {
+		return ErrMissingPoolID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/pools/%s", poolID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/pools/%s", rc.Identifier, poolID)
+	}
+
 	if _, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil); err != nil {
 		return err
 	}
+
 	return nil
 }
 
-// ModifyLoadBalancerPool modifies a configured load balancer pool.
+// UpdateLoadBalancerPool modifies a configured load balancer pool.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-pools-update-pool
-func (api *API) ModifyLoadBalancerPool(ctx context.Context, pool LoadBalancerPool) (LoadBalancerPool, error) {
-	uri := fmt.Sprintf("%s/load_balancers/pools/%s", api.userBaseURL("/user"), pool.ID)
-	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, pool)
+func (api *API) UpdateLoadBalancerPool(ctx context.Context, rc *ResourceContainer, params UpdateLoadBalancerPoolParams) (LoadBalancerPool, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerPool{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if params.LoadBalancer.ID == "" {
+		return LoadBalancerPool{}, ErrMissingPoolID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/pools/%s", params.LoadBalancer.ID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/pools/%s", rc.Identifier, params.LoadBalancer.ID)
+	}
+
+	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, params.LoadBalancer)
 	if err != nil {
 		return LoadBalancerPool{}, err
 	}
@@ -330,9 +438,19 @@ func (api *API) ModifyLoadBalancerPool(ctx context.Context, pool LoadBalancerPoo
 // CreateLoadBalancerMonitor creates a new load balancer monitor.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-monitors-create-monitor
-func (api *API) CreateLoadBalancerMonitor(ctx context.Context, monitor LoadBalancerMonitor) (LoadBalancerMonitor, error) {
-	uri := fmt.Sprintf("%s/load_balancers/monitors", api.userBaseURL("/user"))
-	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, monitor)
+func (api *API) CreateLoadBalancerMonitor(ctx context.Context, rc *ResourceContainer, params CreateLoadBalancerMonitorParams) (LoadBalancerMonitor, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerMonitor{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = "/user/load_balancers/monitors"
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/monitors", rc.Identifier)
+	}
+
+	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, params.LoadBalancerMonitor)
 	if err != nil {
 		return LoadBalancerMonitor{}, err
 	}
@@ -346,8 +464,20 @@ func (api *API) CreateLoadBalancerMonitor(ctx context.Context, monitor LoadBalan
 // ListLoadBalancerMonitors lists load balancer monitors connected to an account.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-monitors-list-monitors
-func (api *API) ListLoadBalancerMonitors(ctx context.Context) ([]LoadBalancerMonitor, error) {
-	uri := fmt.Sprintf("%s/load_balancers/monitors", api.userBaseURL("/user"))
+func (api *API) ListLoadBalancerMonitors(ctx context.Context, rc *ResourceContainer, params ListLoadBalancerMonitorParams) ([]LoadBalancerMonitor, error) {
+	if rc.Level == ZoneRouteLevel {
+		return []LoadBalancerMonitor{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = "/user/load_balancers/monitors"
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/monitors", rc.Identifier)
+	}
+
+	uri = buildURI(uri, params.PaginationOptions)
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return nil, err
@@ -359,11 +489,25 @@ func (api *API) ListLoadBalancerMonitors(ctx context.Context) ([]LoadBalancerMon
 	return r.Result, nil
 }
 
-// LoadBalancerMonitorDetails returns the details for a load balancer monitor.
+// GetLoadBalancerMonitor returns the details for a load balancer monitor.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-monitors-monitor-details
-func (api *API) LoadBalancerMonitorDetails(ctx context.Context, monitorID string) (LoadBalancerMonitor, error) {
-	uri := fmt.Sprintf("%s/load_balancers/monitors/%s", api.userBaseURL("/user"), monitorID)
+func (api *API) GetLoadBalancerMonitor(ctx context.Context, rc *ResourceContainer, monitorID string) (LoadBalancerMonitor, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerMonitor{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if monitorID == "" {
+		return LoadBalancerMonitor{}, ErrMissingMonitorID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/monitors/%s", monitorID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/monitors/%s", rc.Identifier, monitorID)
+	}
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return LoadBalancerMonitor{}, err
@@ -378,20 +522,48 @@ func (api *API) LoadBalancerMonitorDetails(ctx context.Context, monitorID string
 // DeleteLoadBalancerMonitor disables and deletes a load balancer monitor.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-monitors-delete-monitor
-func (api *API) DeleteLoadBalancerMonitor(ctx context.Context, monitorID string) error {
-	uri := fmt.Sprintf("%s/load_balancers/monitors/%s", api.userBaseURL("/user"), monitorID)
+func (api *API) DeleteLoadBalancerMonitor(ctx context.Context, rc *ResourceContainer, monitorID string) error {
+	if rc.Level == ZoneRouteLevel {
+		return fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if monitorID == "" {
+		return ErrMissingMonitorID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/monitors/%s", monitorID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/monitors/%s", rc.Identifier, monitorID)
+	}
+
 	if _, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil); err != nil {
 		return err
 	}
 	return nil
 }
 
-// ModifyLoadBalancerMonitor modifies a configured load balancer monitor.
+// UpdateLoadBalancerMonitor modifies a configured load balancer monitor.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-monitors-update-monitor
-func (api *API) ModifyLoadBalancerMonitor(ctx context.Context, monitor LoadBalancerMonitor) (LoadBalancerMonitor, error) {
-	uri := fmt.Sprintf("%s/load_balancers/monitors/%s", api.userBaseURL("/user"), monitor.ID)
-	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, monitor)
+func (api *API) UpdateLoadBalancerMonitor(ctx context.Context, rc *ResourceContainer, params UpdateLoadBalancerMonitorParams) (LoadBalancerMonitor, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerMonitor{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if params.LoadBalancerMonitor.ID == "" {
+		return LoadBalancerMonitor{}, ErrMissingMonitorID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/monitors/%s", params.LoadBalancerMonitor.ID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/monitors/%s", rc.Identifier, params.LoadBalancerMonitor.ID)
+	}
+
+	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, params.LoadBalancerMonitor)
 	if err != nil {
 		return LoadBalancerMonitor{}, err
 	}
@@ -405,9 +577,14 @@ func (api *API) ModifyLoadBalancerMonitor(ctx context.Context, monitor LoadBalan
 // CreateLoadBalancer creates a new load balancer.
 //
 // API reference: https://api.cloudflare.com/#load-balancers-create-load-balancer
-func (api *API) CreateLoadBalancer(ctx context.Context, zoneID string, lb LoadBalancer) (LoadBalancer, error) {
-	uri := fmt.Sprintf("/zones/%s/load_balancers", zoneID)
-	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, lb)
+func (api *API) CreateLoadBalancer(ctx context.Context, rc *ResourceContainer, params CreateLoadBalancerParams) (LoadBalancer, error) {
+	if rc.Level != ZoneRouteLevel {
+		return LoadBalancer{}, fmt.Errorf(errInvalidResourceContainerAccess, rc.Level)
+	}
+
+	uri := fmt.Sprintf("/zones/%s/load_balancers", rc.Identifier)
+
+	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, params.LoadBalancer)
 	if err != nil {
 		return LoadBalancer{}, err
 	}
@@ -421,8 +598,13 @@ func (api *API) CreateLoadBalancer(ctx context.Context, zoneID string, lb LoadBa
 // ListLoadBalancers lists load balancers configured on a zone.
 //
 // API reference: https://api.cloudflare.com/#load-balancers-list-load-balancers
-func (api *API) ListLoadBalancers(ctx context.Context, zoneID string) ([]LoadBalancer, error) {
-	uri := fmt.Sprintf("/zones/%s/load_balancers", zoneID)
+func (api *API) ListLoadBalancers(ctx context.Context, rc *ResourceContainer, params ListLoadBalancerParams) ([]LoadBalancer, error) {
+	if rc.Level != ZoneRouteLevel {
+		return []LoadBalancer{}, fmt.Errorf(errInvalidResourceContainerAccess, rc.Level)
+	}
+
+	uri := buildURI(fmt.Sprintf("/zones/%s/load_balancers", rc.Identifier), params.PaginationOptions)
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return nil, err
@@ -434,11 +616,20 @@ func (api *API) ListLoadBalancers(ctx context.Context, zoneID string) ([]LoadBal
 	return r.Result, nil
 }
 
-// LoadBalancerDetails returns the details for a load balancer.
+// GetLoadBalancer returns the details for a load balancer.
 //
 // API reference: https://api.cloudflare.com/#load-balancers-load-balancer-details
-func (api *API) LoadBalancerDetails(ctx context.Context, zoneID, lbID string) (LoadBalancer, error) {
-	uri := fmt.Sprintf("/zones/%s/load_balancers/%s", zoneID, lbID)
+func (api *API) GetLoadBalancer(ctx context.Context, rc *ResourceContainer, loadbalancerID string) (LoadBalancer, error) {
+	if rc.Level != ZoneRouteLevel {
+		return LoadBalancer{}, fmt.Errorf(errInvalidResourceContainerAccess, rc.Level)
+	}
+
+	if loadbalancerID == "" {
+		return LoadBalancer{}, ErrMissingLoadBalancerID
+	}
+
+	uri := fmt.Sprintf("/zones/%s/load_balancers/%s", rc.Identifier, loadbalancerID)
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return LoadBalancer{}, err
@@ -453,20 +644,38 @@ func (api *API) LoadBalancerDetails(ctx context.Context, zoneID, lbID string) (L
 // DeleteLoadBalancer disables and deletes a load balancer.
 //
 // API reference: https://api.cloudflare.com/#load-balancers-delete-load-balancer
-func (api *API) DeleteLoadBalancer(ctx context.Context, zoneID, lbID string) error {
-	uri := fmt.Sprintf("/zones/%s/load_balancers/%s", zoneID, lbID)
+func (api *API) DeleteLoadBalancer(ctx context.Context, rc *ResourceContainer, loadbalancerID string) error {
+	if rc.Level != ZoneRouteLevel {
+		return fmt.Errorf(errInvalidResourceContainerAccess, rc.Level)
+	}
+
+	if loadbalancerID == "" {
+		return ErrMissingLoadBalancerID
+	}
+
+	uri := fmt.Sprintf("/zones/%s/load_balancers/%s", rc.Identifier, loadbalancerID)
+
 	if _, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil); err != nil {
 		return err
 	}
 	return nil
 }
 
-// ModifyLoadBalancer modifies a configured load balancer.
+// UpdateLoadBalancer modifies a configured load balancer.
 //
 // API reference: https://api.cloudflare.com/#load-balancers-update-load-balancer
-func (api *API) ModifyLoadBalancer(ctx context.Context, zoneID string, lb LoadBalancer) (LoadBalancer, error) {
-	uri := fmt.Sprintf("/zones/%s/load_balancers/%s", zoneID, lb.ID)
-	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, lb)
+func (api *API) UpdateLoadBalancer(ctx context.Context, rc *ResourceContainer, params UpdateLoadBalancerParams) (LoadBalancer, error) {
+	if rc.Level != ZoneRouteLevel {
+		return LoadBalancer{}, fmt.Errorf(errInvalidResourceContainerAccess, rc.Level)
+	}
+
+	if params.LoadBalancer.ID == "" {
+		return LoadBalancer{}, ErrMissingLoadBalancerID
+	}
+
+	uri := fmt.Sprintf("/zones/%s/load_balancers/%s", rc.Identifier, params.LoadBalancer.ID)
+
+	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, params.LoadBalancer)
 	if err != nil {
 		return LoadBalancer{}, err
 	}
@@ -477,11 +686,26 @@ func (api *API) ModifyLoadBalancer(ctx context.Context, zoneID string, lb LoadBa
 	return r.Result, nil
 }
 
-// PoolHealthDetails fetches the latest healtcheck details for a single pool.
+// GetLoadBalancerPoolHealth fetches the latest healtcheck details for a single
+// pool.
 //
 // API reference: https://api.cloudflare.com/#load-balancer-pools-pool-health-details
-func (api *API) PoolHealthDetails(ctx context.Context, poolID string) (LoadBalancerPoolHealth, error) {
-	uri := fmt.Sprintf("%s/load_balancers/pools/%s/health", api.userBaseURL("/user"), poolID)
+func (api *API) GetLoadBalancerPoolHealth(ctx context.Context, rc *ResourceContainer, poolID string) (LoadBalancerPoolHealth, error) {
+	if rc.Level == ZoneRouteLevel {
+		return LoadBalancerPoolHealth{}, fmt.Errorf(errInvalidResourceContainerAccess, ZoneRouteLevel)
+	}
+
+	if poolID == "" {
+		return LoadBalancerPoolHealth{}, ErrMissingPoolID
+	}
+
+	var uri string
+	if rc.Level == UserRouteLevel {
+		uri = fmt.Sprintf("/user/load_balancers/pools/%s/health", poolID)
+	} else {
+		uri = fmt.Sprintf("/accounts/%s/load_balancers/pools/%s/health", rc.Identifier, poolID)
+	}
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return LoadBalancerPoolHealth{}, err


Test patch:
diff --git a/cloudflare_test.go b/cloudflare_test.go
index 6238c49c7..24ec3154f 100644
--- a/cloudflare_test.go
+++ b/cloudflare_test.go
@@ -184,7 +184,7 @@ func TestClient_RetryCanSucceedAfterErrors(t *testing.T) {
 
 	mux.HandleFunc("/user/load_balancers/pools", handler)
 
-	_, err := client.CreateLoadBalancerPool(context.Background(), LoadBalancerPool{ID: "123"})
+	_, err := client.CreateLoadBalancerPool(context.Background(), UserIdentifier(testUserID), CreateLoadBalancerPoolParams{LoadBalancerPool: LoadBalancerPool{ID: "123"}})
 	assert.NoError(t, err)
 }
 
@@ -209,7 +209,7 @@ func TestClient_RetryReturnsPersistentErrorResponse(t *testing.T) {
 
 	mux.HandleFunc("/user/load_balancers/pools", handler)
 
-	_, err := client.ListLoadBalancerPools(context.Background())
+	_, err := client.ListLoadBalancerPools(context.Background(), UserIdentifier(testUserID), ListLoadBalancerPoolParams{})
 	assert.Error(t, err)
 }
 
diff --git a/load_balancing_example_test.go b/load_balancing_example_test.go
index d9565f604..2aaa8956a 100644
--- a/load_balancing_example_test.go
+++ b/load_balancing_example_test.go
@@ -15,14 +15,8 @@ func ExampleAPI_ListLoadBalancers() {
 		log.Fatal(err)
 	}
 
-	// Fetch the zone ID.
-	id, err := api.ZoneIDByName("example.com") // Assuming example.com exists in your Cloudflare account
-	if err != nil {
-		log.Fatal(err)
-	}
-
 	// List LBs configured in zone.
-	lbList, err := api.ListLoadBalancers(context.Background(), id)
+	lbList, err := api.ListLoadBalancers(context.Background(), cloudflare.ZoneIdentifier("d56084adb405e0b7e32c52321bf07be6"), cloudflare.ListLoadBalancerParams{})
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -32,7 +26,7 @@ func ExampleAPI_ListLoadBalancers() {
 	}
 }
 
-func ExampleAPI_PoolHealthDetails() {
+func ExampleAPI_GetLoadBalancerPoolHealth() {
 	// Construct a new API object.
 	api, err := cloudflare.New("deadbeef", "test@example.com")
 	if err != nil {
@@ -40,7 +34,7 @@ func ExampleAPI_PoolHealthDetails() {
 	}
 
 	// Fetch pool health details.
-	healthInfo, err := api.PoolHealthDetails(context.Background(), "example-pool-id")
+	healthInfo, err := api.GetLoadBalancerPoolHealth(context.Background(), cloudflare.AccountIdentifier("01a7362d577a6c3019a474fd6f485823"), "example-pool-id")
 	if err != nil {
 		log.Fatal(err)
 	}
diff --git a/load_balancing_test.go b/load_balancing_test.go
index 1aef80a8c..2392322a7 100644
--- a/load_balancing_test.go
+++ b/load_balancing_test.go
@@ -105,7 +105,7 @@ func TestCreateLoadBalancerPool(t *testing.T) {
 		return &f
 	}
 
-	mux.HandleFunc("/user/load_balancers/pools", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/pools", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := LoadBalancerPool{
@@ -177,12 +177,22 @@ func TestCreateLoadBalancerPool(t *testing.T) {
 		},
 	}
 
-	actual, err := client.CreateLoadBalancerPool(context.Background(), request)
+	actual, err := client.CreateLoadBalancerPool(context.Background(), AccountIdentifier(testAccountID), CreateLoadBalancerPoolParams{LoadBalancerPool: request})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
+func TestCreateLoadBalancerPool_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.CreateLoadBalancerPool(context.Background(), ZoneIdentifier(testZoneID), CreateLoadBalancerPoolParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
 func TestListLoadBalancerPools(t *testing.T) {
 	setup()
 	defer teardown()
@@ -226,7 +236,7 @@ func TestListLoadBalancerPools(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/pools", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/pools", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := []LoadBalancerPool{
@@ -253,13 +263,23 @@ func TestListLoadBalancerPools(t *testing.T) {
 		},
 	}
 
-	actual, err := client.ListLoadBalancerPools(context.Background())
+	actual, err := client.ListLoadBalancerPools(context.Background(), AccountIdentifier(testAccountID), ListLoadBalancerPoolParams{})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
-func TestLoadBalancerPoolDetails(t *testing.T) {
+func TestListLoadBalancerPool_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.ListLoadBalancerPools(context.Background(), ZoneIdentifier(testZoneID), ListLoadBalancerPoolParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
+func TestGetLoadBalancerPool(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -294,7 +314,7 @@ func TestLoadBalancerPoolDetails(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := LoadBalancerPool{
@@ -319,15 +339,25 @@ func TestLoadBalancerPoolDetails(t *testing.T) {
 		NotificationEmail: "someone@example.com",
 	}
 
-	actual, err := client.LoadBalancerPoolDetails(context.Background(), "17b5962d775c646f3f9725cbc7a53df4")
+	actual, err := client.GetLoadBalancerPool(context.Background(), AccountIdentifier(testAccountID), "17b5962d775c646f3f9725cbc7a53df4")
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 
-	_, err = client.LoadBalancerPoolDetails(context.Background(), "bar")
+	_, err = client.GetLoadBalancerPool(context.Background(), AccountIdentifier(testAccountID), "bar")
 	assert.Error(t, err)
 }
 
+func TestGetLoadBalancerPool_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.GetLoadBalancerPool(context.Background(), ZoneIdentifier(testZoneID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
 func TestDeleteLoadBalancerPool(t *testing.T) {
 	setup()
 	defer teardown()
@@ -345,12 +375,22 @@ func TestDeleteLoadBalancerPool(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4", handler)
-	assert.NoError(t, client.DeleteLoadBalancerPool(context.Background(), "17b5962d775c646f3f9725cbc7a53df4"))
-	assert.Error(t, client.DeleteLoadBalancerPool(context.Background(), "bar"))
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4", handler)
+	assert.NoError(t, client.DeleteLoadBalancerPool(context.Background(), AccountIdentifier(testAccountID), "17b5962d775c646f3f9725cbc7a53df4"))
+	assert.Error(t, client.DeleteLoadBalancerPool(context.Background(), AccountIdentifier(testAccountID), "bar"))
+}
+
+func TestDeleteLoadBalancerPool_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	err := client.DeleteLoadBalancerPool(context.Background(), ZoneIdentifier(testZoneID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
 }
 
-func TestModifyLoadBalancerPool(t *testing.T) {
+func TestUpdateLoadBalancerPool(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -422,7 +462,7 @@ func TestModifyLoadBalancerPool(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2017-02-01T05:20:00.12345Z")
 	want := LoadBalancerPool{
@@ -476,12 +516,22 @@ func TestModifyLoadBalancerPool(t *testing.T) {
 		},
 	}
 
-	actual, err := client.ModifyLoadBalancerPool(context.Background(), request)
+	actual, err := client.UpdateLoadBalancerPool(context.Background(), AccountIdentifier(testAccountID), UpdateLoadBalancerPoolParams{LoadBalancer: request})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
+func TestUpdateLoadBalancerPool_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.UpdateLoadBalancerPool(context.Background(), ZoneIdentifier(testZoneID), UpdateLoadBalancerPoolParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
 func TestCreateLoadBalancerMonitor(t *testing.T) {
 	setup()
 	defer teardown()
@@ -547,7 +597,7 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/monitors", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/monitors", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := LoadBalancerMonitor{
@@ -590,12 +640,22 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
 		AllowInsecure:   true,
 	}
 
-	actual, err := client.CreateLoadBalancerMonitor(context.Background(), request)
+	actual, err := client.CreateLoadBalancerMonitor(context.Background(), AccountIdentifier(testAccountID), CreateLoadBalancerMonitorParams{LoadBalancerMonitor: request})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
+func TestCreateLoadBalancerMonitor_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.CreateLoadBalancerMonitor(context.Background(), ZoneIdentifier(testZoneID), CreateLoadBalancerMonitorParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
 func TestListLoadBalancerMonitors(t *testing.T) {
 	setup()
 	defer teardown()
@@ -640,7 +700,7 @@ func TestListLoadBalancerMonitors(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/monitors", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/monitors", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := []LoadBalancerMonitor{
@@ -664,13 +724,23 @@ func TestListLoadBalancerMonitors(t *testing.T) {
 		},
 	}
 
-	actual, err := client.ListLoadBalancerMonitors(context.Background())
+	actual, err := client.ListLoadBalancerMonitors(context.Background(), AccountIdentifier(testAccountID), ListLoadBalancerMonitorParams{})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
-func TestLoadBalancerMonitorDetails(t *testing.T) {
+func TestListLoadBalancerMonitors_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.ListLoadBalancerMonitors(context.Background(), ZoneIdentifier(testZoneID), ListLoadBalancerMonitorParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
+func TestGetLoadBalancerMonitor(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -709,7 +779,7 @@ func TestLoadBalancerMonitorDetails(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/monitors/f1aba936b94213e5b8dca0c0dbf1f9cc", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/monitors/f1aba936b94213e5b8dca0c0dbf1f9cc", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := LoadBalancerMonitor{
@@ -734,15 +804,25 @@ func TestLoadBalancerMonitorDetails(t *testing.T) {
 		AllowInsecure:   true,
 	}
 
-	actual, err := client.LoadBalancerMonitorDetails(context.Background(), "f1aba936b94213e5b8dca0c0dbf1f9cc")
+	actual, err := client.GetLoadBalancerMonitor(context.Background(), AccountIdentifier(testAccountID), "f1aba936b94213e5b8dca0c0dbf1f9cc")
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 
-	_, err = client.LoadBalancerMonitorDetails(context.Background(), "bar")
+	_, err = client.GetLoadBalancerMonitor(context.Background(), AccountIdentifier(testAccountID), "bar")
 	assert.Error(t, err)
 }
 
+func TestGetLoadBalancerMonitor_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.GetLoadBalancerMonitor(context.Background(), ZoneIdentifier(testZoneID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
 func TestDeleteLoadBalancerMonitor(t *testing.T) {
 	setup()
 	defer teardown()
@@ -760,12 +840,22 @@ func TestDeleteLoadBalancerMonitor(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/monitors/f1aba936b94213e5b8dca0c0dbf1f9cc", handler)
-	assert.NoError(t, client.DeleteLoadBalancerMonitor(context.Background(), "f1aba936b94213e5b8dca0c0dbf1f9cc"))
-	assert.Error(t, client.DeleteLoadBalancerMonitor(context.Background(), "bar"))
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/monitors/f1aba936b94213e5b8dca0c0dbf1f9cc", handler)
+	assert.NoError(t, client.DeleteLoadBalancerMonitor(context.Background(), AccountIdentifier(testAccountID), "f1aba936b94213e5b8dca0c0dbf1f9cc"))
+	assert.Error(t, client.DeleteLoadBalancerMonitor(context.Background(), AccountIdentifier(testAccountID), "bar"))
 }
 
-func TestModifyLoadBalancerMonitor(t *testing.T) {
+func TestDeleteLoadBalancerMonitor_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	err := client.DeleteLoadBalancerMonitor(context.Background(), ZoneIdentifier(testZoneID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
+func TestUpdateLoadBalancerMonitor(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -831,7 +921,7 @@ func TestModifyLoadBalancerMonitor(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/monitors/f1aba936b94213e5b8dca0c0dbf1f9cc", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/monitors/f1aba936b94213e5b8dca0c0dbf1f9cc", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2017-02-01T05:20:00.12345Z")
 	want := LoadBalancerMonitor{
@@ -875,12 +965,22 @@ func TestModifyLoadBalancerMonitor(t *testing.T) {
 		AllowInsecure:   true,
 	}
 
-	actual, err := client.ModifyLoadBalancerMonitor(context.Background(), request)
+	actual, err := client.UpdateLoadBalancerMonitor(context.Background(), AccountIdentifier(testAccountID), UpdateLoadBalancerMonitorParams{LoadBalancerMonitor: request})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
+func TestUpdateLoadBalancerMonitor_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.UpdateLoadBalancerMonitor(context.Background(), ZoneIdentifier(testZoneID), UpdateLoadBalancerMonitorParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}
+
 func TestCreateLoadBalancer(t *testing.T) {
 	setup()
 	defer teardown()
@@ -962,6 +1062,7 @@ func TestCreateLoadBalancer(t *testing.T) {
               }
             }`, string(b))
 		}
+
 		fmt.Fprint(w, `{
             "success": true,
             "errors": [],
@@ -1040,7 +1141,7 @@ func TestCreateLoadBalancer(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/zones/199d98642c564d2e855e9661899b7252/load_balancers", handler)
+	mux.HandleFunc("/zones/"+testZoneID+"/load_balancers", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := LoadBalancer{
@@ -1183,12 +1284,22 @@ func TestCreateLoadBalancer(t *testing.T) {
 		},
 	}
 
-	actual, err := client.CreateLoadBalancer(context.Background(), "199d98642c564d2e855e9661899b7252", request)
+	actual, err := client.CreateLoadBalancer(context.Background(), ZoneIdentifier(testZoneID), CreateLoadBalancerParams{LoadBalancer: request})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
+func TestCreateLoadBalancer_AccountIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.CreateLoadBalancer(context.Background(), AccountIdentifier(testAccountID), CreateLoadBalancerParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, AccountRouteLevel), err.Error())
+	}
+}
+
 func TestListLoadBalancers(t *testing.T) {
 	setup()
 	defer teardown()
@@ -1263,7 +1374,7 @@ func TestListLoadBalancers(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/zones/199d98642c564d2e855e9661899b7252/load_balancers", handler)
+	mux.HandleFunc("/zones/"+testZoneID+"/load_balancers", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := []LoadBalancer{
@@ -1321,13 +1432,23 @@ func TestListLoadBalancers(t *testing.T) {
 		},
 	}
 
-	actual, err := client.ListLoadBalancers(context.Background(), "199d98642c564d2e855e9661899b7252")
+	actual, err := client.ListLoadBalancers(context.Background(), ZoneIdentifier(testZoneID), ListLoadBalancerParams{})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
-func TestLoadBalancerDetails(t *testing.T) {
+func TestListLoadBalancer_AccountIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.ListLoadBalancers(context.Background(), AccountIdentifier(testAccountID), ListLoadBalancerParams{})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, AccountRouteLevel), err.Error())
+	}
+}
+
+func TestGetLoadBalancer(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -1393,7 +1514,7 @@ func TestLoadBalancerDetails(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/zones/199d98642c564d2e855e9661899b7252/load_balancers/699d98642c564d2e855e9661899b7252", handler)
+	mux.HandleFunc("/zones/"+testZoneID+"/load_balancers/699d98642c564d2e855e9661899b7252", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2014-02-01T05:20:00.12345Z")
 	want := LoadBalancer{
@@ -1449,15 +1570,25 @@ func TestLoadBalancerDetails(t *testing.T) {
 		Proxied: true,
 	}
 
-	actual, err := client.LoadBalancerDetails(context.Background(), "199d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252")
+	actual, err := client.GetLoadBalancer(context.Background(), ZoneIdentifier(testZoneID), "699d98642c564d2e855e9661899b7252")
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 
-	_, err = client.LoadBalancerDetails(context.Background(), "199d98642c564d2e855e9661899b7252", "bar")
+	_, err = client.GetLoadBalancer(context.Background(), ZoneIdentifier(testZoneID), "bar")
 	assert.Error(t, err)
 }
 
+func TestGetLoadBalancer_AccountIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.GetLoadBalancer(context.Background(), AccountIdentifier(testAccountID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, AccountRouteLevel), err.Error())
+	}
+}
+
 func TestDeleteLoadBalancer(t *testing.T) {
 	setup()
 	defer teardown()
@@ -1475,12 +1606,22 @@ func TestDeleteLoadBalancer(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/zones/199d98642c564d2e855e9661899b7252/load_balancers/699d98642c564d2e855e9661899b7252", handler)
-	assert.NoError(t, client.DeleteLoadBalancer(context.Background(), "199d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"))
-	assert.Error(t, client.DeleteLoadBalancer(context.Background(), "199d98642c564d2e855e9661899b7252", "bar"))
+	mux.HandleFunc("/zones/"+testZoneID+"/load_balancers/699d98642c564d2e855e9661899b7252", handler)
+	assert.NoError(t, client.DeleteLoadBalancer(context.Background(), ZoneIdentifier(testZoneID), "699d98642c564d2e855e9661899b7252"))
+	assert.Error(t, client.DeleteLoadBalancer(context.Background(), ZoneIdentifier(testZoneID), "bar"))
+}
+
+func TestDeleteLoadBalancer_AccountIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	err := client.DeleteLoadBalancer(context.Background(), AccountIdentifier(testAccountID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, AccountRouteLevel), err.Error())
+	}
 }
 
-func TestModifyLoadBalancer(t *testing.T) {
+func TestUpdateLoadBalancer(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -1600,7 +1741,7 @@ func TestModifyLoadBalancer(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/zones/199d98642c564d2e855e9661899b7252/load_balancers/699d98642c564d2e855e9661899b7252", handler)
+	mux.HandleFunc("/zones/"+testZoneID+"/load_balancers/699d98642c564d2e855e9661899b7252", handler)
 	createdOn, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
 	modifiedOn, _ := time.Parse(time.RFC3339, "2017-02-01T05:20:00.12345Z")
 	want := LoadBalancer{
@@ -1706,12 +1847,22 @@ func TestModifyLoadBalancer(t *testing.T) {
 		},
 	}
 
-	actual, err := client.ModifyLoadBalancer(context.Background(), "199d98642c564d2e855e9661899b7252", request)
+	actual, err := client.UpdateLoadBalancer(context.Background(), ZoneIdentifier(testZoneID), UpdateLoadBalancerParams{LoadBalancer: request})
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
 
+func TestUpdateLoadBalancer_AccountIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.UpdateLoadBalancer(context.Background(), AccountIdentifier(testAccountID), UpdateLoadBalancerParams{LoadBalancer: LoadBalancer{}})
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, AccountRouteLevel), err.Error())
+	}
+}
+
 func TestLoadBalancerPoolHealthDetails(t *testing.T) {
 	setup()
 	defer teardown()
@@ -1744,7 +1895,7 @@ func TestLoadBalancerPoolHealthDetails(t *testing.T) {
         }`)
 	}
 
-	mux.HandleFunc("/user/load_balancers/pools/699d98642c564d2e855e9661899b7252/health", handler)
+	mux.HandleFunc("/accounts/"+testAccountID+"/load_balancers/pools/699d98642c564d2e855e9661899b7252/health", handler)
 	want := LoadBalancerPoolHealth{
 		ID: "699d98642c564d2e855e9661899b7252",
 		PopHealth: map[string]LoadBalancerPoolPopHealth{
@@ -1764,8 +1915,18 @@ func TestLoadBalancerPoolHealthDetails(t *testing.T) {
 		},
 	}
 
-	actual, err := client.PoolHealthDetails(context.Background(), "699d98642c564d2e855e9661899b7252")
+	actual, err := client.GetLoadBalancerPoolHealth(context.Background(), AccountIdentifier(testAccountID), "699d98642c564d2e855e9661899b7252")
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
 }
+
+func TestLoadBalancerPoolHealthDetails_ZoneIsNotSupported(t *testing.T) {
+	setup()
+	defer teardown()
+
+	_, err := client.GetLoadBalancerPoolHealth(context.Background(), ZoneIdentifier(testZoneID), "foo")
+	if assert.Error(t, err) {
+		assert.Equal(t, fmt.Sprintf(errInvalidResourceContainerAccess, ZoneRouteLevel), err.Error())
+	}
+}