Repository: cloudflare/cloudflare-go (go)

Issue:
support account-level logpush jobs
### Current cloudflare-go version

latest

### Description

Logpush supports both zone-level and account-level logpush jobs, however the provider currently requires zone_id arguments for both both cloudflare_logpush_job and cloudflare_logpush_ownership_challenge resources. Account-level jobs therefore can't be created in Terraform. If the provider accepted either a zone ID or an account ID, it could create either type of job.

The API supports both, but it appears cloudflare-go only supports zone IDs as well.
https://github.com/cloudflare/cloudflare-go/blob/master/logpush.go#L98-L99

Docs link:
https://developers.cloudflare.com/logs/reference/log-fields

### Use cases

required to support this feature in the terraform provider to manage logpush jobs for:
* Audit Logs
* Gateway DNS
* Gateway HTTP
* Gateway Network (when that lands)

### Potential cloudflare-go usage
To keep API compatibility, existing functions could add a new `scope` or `IDtype` or similar parameter to determine if the ID being passed in is a zone or account scope.  It could default to `zone`
```go
func (api *API) CreateLogpushJob(ctx context.Context, ID string, job LogpushJob, IDtype string) (*LogpushJob, error) {
    APIscope := "zones"
    if IDtype == "account" {
        APIscope := "accounts"
    }
    uri := fmt.Sprintf("/%s/%s/logpush/jobs", APIscope, ID)
}
```
similarly, Logpush jobs could get scope-specific functions:
```go
func (api *API) CreateAccountLogpushJob(ctx context.Context, accountID string, job LogpushJob) (*LogpushJob, error) {
    return CreateLogpushJob(ctx, accountID, job, "account")
}
func (api *API) CreateZoneLogpushJob(ctx context.Context, zoneID string, job LogpushJob) (*LogpushJob, error) {
    return CreateLogpushJob(ctx, zoneID, job, "zone")
}
```

### References

https://github.com/cloudflare/terraform-provider-cloudflare/issues/1311

Pull request:
closes #750 - support account-level logpush jobs
## Description

This closes #750 and changes the logpush functions to use zone and account-specific function names that each take either the zoneID or accountID as an argument.  The previous names remain for compatibility and a deprecation message has been added to their log comment, pointing folks to the new zone-specific names.

## Has your change been tested?

No additional tests have been created.  I've renamed the existing logpush functions and marked the old names as deprecated in the log comments.  I still need to update the tests to test the account-level additions.

## Screenshots (if appropriate):

## Types of changes

What sort of change does your code introduce/modify?

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [x] This change is using publicly documented (api.cloudflare.com or developers.cloudflare.com) and stable APIs.


Patch:
diff --git a/access_application.go b/access_application.go
index 6ca570ece..61db77f14 100644
--- a/access_application.go
+++ b/access_application.go
@@ -21,7 +21,6 @@ const (
 	SSH        AccessApplicationType = "ssh"
 	VNC        AccessApplicationType = "vnc"
 	File       AccessApplicationType = "file"
-	Bookmark   AccessApplicationType = "bookmark"
 )
 
 // AccessApplication represents an Access application.
diff --git a/logpush.go b/logpush.go
index 1e5f363aa..c4aed24e0 100644
--- a/logpush.go
+++ b/logpush.go
@@ -92,11 +92,32 @@ type LogpushDestinationExistsRequest struct {
 	DestinationConf string `json:"destination_conf"`
 }
 
-// CreateLogpushJob creates a new LogpushJob for a zone.
+// CreateAccountLogpushJob creates a new account-level Logpush Job.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job
+func (api *API) CreateAccountLogpushJob(ctx context.Context, accountID string, job LogpushJob) (*LogpushJob, error) {
+	return api.createLogpushJob(ctx, AccountRouteRoot, accountID, job)
+}
+
+// CreateZoneLogpushJob creates a new zone-level Logpush Job.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job
+func (api *API) CreateZoneLogpushJob(ctx context.Context, zoneID string, job LogpushJob) (*LogpushJob, error) {
+	return api.createLogpushJob(ctx, ZoneRouteRoot, zoneID, job)
+}
+
+// CreateLogpushJob creates a new zone-level Logpush Job.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job
+//
+// Deprecated: Use `CreateZoneLogpushJob` or `CreateAccountLogpushJob` depending 
+// on the desired resource to target.
 func (api *API) CreateLogpushJob(ctx context.Context, zoneID string, job LogpushJob) (*LogpushJob, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/jobs", zoneID)
+	return api.createLogpushJob(ctx, ZoneRouteRoot, zoneID, job)
+}
+
+func (api *API) createLogpushJob(ctx context.Context, identifierType RouteRoot, identifier string, job LogpushJob) (*LogpushJob, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/jobs", identifierType, identifier)
 	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, job)
 	if err != nil {
 		return nil, err
@@ -109,11 +130,32 @@ func (api *API) CreateLogpushJob(ctx context.Context, zoneID string, job Logpush
 	return &r.Result, nil
 }
 
-// LogpushJobs returns all Logpush Jobs for a zone.
+// ListAccountLogpushJobs returns all account-level Logpush Jobs for all datasets.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs
+func (api *API) ListAccountLogpushJobs(ctx context.Context, accountID string) ([]LogpushJob, error) {
+	return api.listLogpushJobs(ctx, AccountRouteRoot, accountID)
+}
+
+// ListZoneLogpushJobs returns all zone-level Logpush Jobs for all datasets.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs
+func (api *API) ListZoneLogpushJobs(ctx context.Context, zoneID string) ([]LogpushJob, error) {
+	return api.listLogpushJobs(ctx, ZoneRouteRoot, zoneID)
+}
+
+// LogpushJobs returns all zone-level Logpush Jobs for all datasets.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs
+//
+// Deprecated: Use `ListZoneLogpushJobs` or `ListAccountLogpushJobs`
+// depending on the desired resource to target.
 func (api *API) LogpushJobs(ctx context.Context, zoneID string) ([]LogpushJob, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/jobs", zoneID)
+	return api.listLogpushJobs(ctx, ZoneRouteRoot, zoneID)
+}
+
+func (api *API) listLogpushJobs(ctx context.Context, identifierType RouteRoot, identifier string) ([]LogpushJob, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/jobs", identifierType, identifier)
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return []LogpushJob{}, err
@@ -126,11 +168,33 @@ func (api *API) LogpushJobs(ctx context.Context, zoneID string) ([]LogpushJob, e
 	return r.Result, nil
 }
 
-// LogpushJobsForDataset returns all Logpush Jobs for a dataset in a zone.
+// ListAccountLogpushJobsForDataset returns all account-level Logpush Jobs for a dataset.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs-for-a-dataset
+func (api *API) ListAccountLogpushJobsForDataset(ctx context.Context, accountID, dataset string) ([]LogpushJob, error) {
+	return api.listLogpushJobsForDataset(ctx, AccountRouteRoot, accountID, dataset)
+}
+
+// ListZoneLogpushJobsForDataset returns all zone-level Logpush Jobs for a dataset.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs-for-a-dataset
+func (api *API) ListZoneLogpushJobsForDataset(ctx context.Context, zoneID, dataset string) ([]LogpushJob, error) {
+	return api.listLogpushJobsForDataset(ctx, ZoneRouteRoot, zoneID, dataset)
+}
+
+// LogpushJobsForDataset returns all zone-level Logpush Jobs for a dataset.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs-for-a-dataset
+//
+// Deprecated: Use `ListZoneLogpushJobsForDataset` or 
+// `ListAccountLogpushJobsForDataset` depending on the desired resource
+// to target.
 func (api *API) LogpushJobsForDataset(ctx context.Context, zoneID, dataset string) ([]LogpushJob, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/datasets/%s/jobs", zoneID, dataset)
+	return api.listLogpushJobsForDataset(ctx, ZoneRouteRoot, zoneID, dataset)
+}
+
+func (api *API) listLogpushJobsForDataset(ctx context.Context, identifierType RouteRoot, identifier, dataset string) ([]LogpushJob, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/datasets/%s/jobs", identifierType, identifier, dataset)
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return []LogpushJob{}, err
@@ -143,11 +207,36 @@ func (api *API) LogpushJobsForDataset(ctx context.Context, zoneID, dataset strin
 	return r.Result, nil
 }
 
+// GetAccountLogpushFields returns fields for a given account-level dataset.
+//
+// Account fields documentation: https://developers.cloudflare.com/logs/reference/log-fields/account
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs
+func (api *API) GetAccountLogpushFields(ctx context.Context, accountID, dataset string) (LogpushFields, error) {
+	return api.getLogpushFields(ctx, AccountRouteRoot, accountID, dataset)
+}
+
+// GetZoneLogpushFields returns fields for a given zone-level dataset.
+//
+// Zone fields documentation: https://developers.cloudflare.com/logs/reference/log-fields/zone
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs
+func (api *API) GetZoneLogpushFields(ctx context.Context, zoneID, dataset string) (LogpushFields, error) {
+	return api.getLogpushFields(ctx, ZoneRouteRoot, zoneID, dataset)
+}
+
 // LogpushFields returns fields for a given dataset.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs
+//
+// Deprecated: Use `GetZoneLogpushFields` or `GetAccountLogpushFields` 
+// depending on the desired resource to target.
 func (api *API) LogpushFields(ctx context.Context, zoneID, dataset string) (LogpushFields, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/datasets/%s/fields", zoneID, dataset)
+	return api.getLogpushFields(ctx, ZoneRouteRoot, zoneID, dataset)
+}
+
+func (api *API) getLogpushFields(ctx context.Context, identifierType RouteRoot, identifier, dataset string) (LogpushFields, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/datasets/%s/fields", identifierType, identifier, dataset)
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return LogpushFields{}, err
@@ -160,11 +249,32 @@ func (api *API) LogpushFields(ctx context.Context, zoneID, dataset string) (Logp
 	return r.Result, nil
 }
 
+// GetAccountLogpushJob fetches detail about one account-level Logpush Job.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details
+func (api *API) GetAccountLogpushJob(ctx context.Context, accountID string, jobID int) (LogpushJob, error) {
+	return api.getLogpushJob(ctx, AccountRouteRoot, accountID, jobID)
+}
+
+// GetZoneLogpushJob fetches detail about one Logpush Job for a zone.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details
+func (api *API) GetZoneLogpushJob(ctx context.Context, zoneID string, jobID int) (LogpushJob, error) {
+	return api.getLogpushJob(ctx, ZoneRouteRoot, zoneID, jobID)
+}
+
 // LogpushJob fetches detail about one Logpush Job for a zone.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details
+//
+// Deprecated: Use `GetZoneLogpushJob` or `GetAccountLogpushJob` 
+// depending on the desired resource to target.
 func (api *API) LogpushJob(ctx context.Context, zoneID string, jobID int) (LogpushJob, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/jobs/%d", zoneID, jobID)
+	return api.getLogpushJob(ctx, ZoneRouteRoot, zoneID, jobID)
+}
+
+func (api *API) getLogpushJob(ctx context.Context, identifierType RouteRoot, identifier string, jobID int) (LogpushJob, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/jobs/%d", identifierType, identifier, jobID)
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return LogpushJob{}, err
@@ -177,11 +287,32 @@ func (api *API) LogpushJob(ctx context.Context, zoneID string, jobID int) (Logpu
 	return r.Result, nil
 }
 
+// UpdateAccountLogpushJob lets you update an account-level Logpush Job.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job
+func (api *API) UpdateAccountLogpushJob(ctx context.Context, accountID string, jobID int, job LogpushJob) error {
+	return api.updateLogpushJob(ctx, AccountRouteRoot, accountID, jobID, job)
+}
+
+// UpdateZoneLogpushJob lets you update a Logpush Job for a zone.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job
+func (api *API) UpdateZoneLogpushJob(ctx context.Context, zoneID string, jobID int, job LogpushJob) error {
+	return api.updateLogpushJob(ctx, ZoneRouteRoot, zoneID, jobID, job)
+}
+
 // UpdateLogpushJob lets you update a Logpush Job.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job
+//
+// Deprecated: Use `UpdateZoneLogpushJob` or `UpdateAccountLogpushJob` 
+// depending on the desired resource to target.
 func (api *API) UpdateLogpushJob(ctx context.Context, zoneID string, jobID int, job LogpushJob) error {
-	uri := fmt.Sprintf("/zones/%s/logpush/jobs/%d", zoneID, jobID)
+	return api.updateLogpushJob(ctx, ZoneRouteRoot, zoneID, jobID, job)
+}
+
+func (api *API) updateLogpushJob(ctx context.Context, identifierType RouteRoot, identifier string, jobID int, job LogpushJob) error {
+	uri := fmt.Sprintf("/%s/%s/logpush/jobs/%d", identifierType, identifier, jobID)
 	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, job)
 	if err != nil {
 		return err
@@ -194,11 +325,32 @@ func (api *API) UpdateLogpushJob(ctx context.Context, zoneID string, jobID int,
 	return nil
 }
 
+// DeleteAccountLogpushJob deletes an account-level Logpush Job.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job
+func (api *API) DeleteAccountLogpushJob(ctx context.Context, accountID string, jobID int) error {
+	return api.deleteLogpushJob(ctx, AccountRouteRoot, accountID, jobID)
+}
+
+// DeleteZoneLogpushJob deletes a Logpush Job for a zone.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job
+func (api *API) DeleteZoneLogpushJob(ctx context.Context, zoneID string, jobID int) error {
+	return api.deleteLogpushJob(ctx, ZoneRouteRoot, zoneID, jobID)
+}
+
 // DeleteLogpushJob deletes a Logpush Job for a zone.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job
+//
+// Deprecated: Use `DeleteZoneLogpushJob` or `DeleteAccountLogpushJob` 
+// depending on the desired resource to target.
 func (api *API) DeleteLogpushJob(ctx context.Context, zoneID string, jobID int) error {
-	uri := fmt.Sprintf("/zones/%s/logpush/jobs/%d", zoneID, jobID)
+	return api.deleteLogpushJob(ctx, ZoneRouteRoot, zoneID, jobID)
+}
+
+func (api *API) deleteLogpushJob(ctx context.Context, identifierType RouteRoot, identifier string, jobID int) error {
+	uri := fmt.Sprintf("/%s/%s/logpush/jobs/%d", identifierType, identifier, jobID)
 	res, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil)
 	if err != nil {
 		return err
@@ -211,11 +363,33 @@ func (api *API) DeleteLogpushJob(ctx context.Context, zoneID string, jobID int)
 	return nil
 }
 
+// GetAccountLogpushOwnershipChallenge returns ownership challenge.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge
+func (api *API) GetAccountLogpushOwnershipChallenge(ctx context.Context, accountID, destinationConf string) (*LogpushGetOwnershipChallenge, error) {
+	return api.getLogpushOwnershipChallenge(ctx, AccountRouteRoot, accountID, destinationConf)
+}
+
+// GetZoneLogpushOwnershipChallenge returns ownership challenge.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge
+func (api *API) GetZoneLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf string) (*LogpushGetOwnershipChallenge, error) {
+	return api.getLogpushOwnershipChallenge(ctx, ZoneRouteRoot, zoneID, destinationConf)
+}
+
 // GetLogpushOwnershipChallenge returns ownership challenge.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge
+//
+// Deprecated: Use `GetZoneLogpushOwnershipChallenge` or
+// `GetAccountLogpushOwnershipChallenge` depending on the 
+// desired resource to target.
 func (api *API) GetLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf string) (*LogpushGetOwnershipChallenge, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/ownership", zoneID)
+	return api.getLogpushOwnershipChallenge(ctx, ZoneRouteRoot, zoneID, destinationConf)
+}
+
+func (api *API) getLogpushOwnershipChallenge(ctx context.Context, identifierType RouteRoot, identifier, destinationConf string) (*LogpushGetOwnershipChallenge, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/ownership", identifierType, identifier)
 	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, LogpushGetOwnershipChallengeRequest{
 		DestinationConf: destinationConf,
 	})
@@ -235,11 +409,33 @@ func (api *API) GetLogpushOwnershipChallenge(ctx context.Context, zoneID, destin
 	return &r.Result, nil
 }
 
-// ValidateLogpushOwnershipChallenge returns ownership challenge validation result.
+// ValidateAccountLogpushOwnershipChallenge returns account-level ownership challenge validation result.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge
+func (api *API) ValidateAccountLogpushOwnershipChallenge(ctx context.Context, accountID, destinationConf, ownershipChallenge string) (bool, error) {
+	return api.validateLogpushOwnershipChallenge(ctx, AccountRouteRoot, accountID, destinationConf, ownershipChallenge)
+}
+
+// ValidateZoneLogpushOwnershipChallenge returns zone-level ownership challenge validation result.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge
+func (api *API) ValidateZoneLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf, ownershipChallenge string) (bool, error) {
+	return api.validateLogpushOwnershipChallenge(ctx, ZoneRouteRoot, zoneID, destinationConf, ownershipChallenge)
+}
+
+// ValidateLogpushOwnershipChallenge returns zone-level ownership challenge validation result.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge
+//
+// Deprecated: Use `ValidateZoneLogpushOwnershipChallenge` or
+// `ValidateAccountLogpushOwnershipChallenge` depending on the 
+// desired resource to target.
 func (api *API) ValidateLogpushOwnershipChallenge(ctx context.Context, zoneID, destinationConf, ownershipChallenge string) (bool, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/ownership/validate", zoneID)
+	return api.validateLogpushOwnershipChallenge(ctx, ZoneRouteRoot, zoneID, destinationConf, ownershipChallenge)
+}
+
+func (api *API) validateLogpushOwnershipChallenge(ctx context.Context, identifierType RouteRoot, identifier, destinationConf, ownershipChallenge string) (bool, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/ownership/validate", identifierType, identifier)
 	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, LogpushValidateOwnershipChallengeRequest{
 		DestinationConf:    destinationConf,
 		OwnershipChallenge: ownershipChallenge,
@@ -255,11 +451,33 @@ func (api *API) ValidateLogpushOwnershipChallenge(ctx context.Context, zoneID, d
 	return r.Result.Valid, nil
 }
 
-// CheckLogpushDestinationExists returns destination exists check result.
+// CheckAccountLogpushDestinationExists returns account-level destination exists check result.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists
+func (api *API) CheckAccountLogpushDestinationExists(ctx context.Context, accountID, destinationConf string) (bool, error) {
+	return api.checkLogpushDestinationExists(ctx, AccountRouteRoot, accountID, destinationConf)
+}
+
+// CheckZoneLogpushDestinationExists returns zone-level destination exists check result.
 //
 // API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists
+func (api *API) CheckZoneLogpushDestinationExists(ctx context.Context, zoneID, destinationConf string) (bool, error) {
+	return api.checkLogpushDestinationExists(ctx, ZoneRouteRoot, zoneID, destinationConf)
+}
+
+// CheckLogpushDestinationExists returns zone-level destination exists check result.
+//
+// API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists
+//
+// Deprecated: Use `CheckZoneLogpushDestinationExists` or
+// `CheckAccountLogpushDestinationExists` depending 
+// on the desired resource to target.
 func (api *API) CheckLogpushDestinationExists(ctx context.Context, zoneID, destinationConf string) (bool, error) {
-	uri := fmt.Sprintf("/zones/%s/logpush/validate/destination/exists", zoneID)
+	return api.checkLogpushDestinationExists(ctx, ZoneRouteRoot, zoneID, destinationConf)
+}
+
+func (api *API) checkLogpushDestinationExists(ctx context.Context, identifierType RouteRoot, identifier, destinationConf string) (bool, error) {
+	uri := fmt.Sprintf("/%s/%s/logpush/validate/destination/exists", identifierType, identifier)
 	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, LogpushDestinationExistsRequest{
 		DestinationConf: destinationConf,
 	})


Test patch:
diff --git a/logpush_example_test.go b/logpush_example_test.go
index 05e690d05..cf4ef3e62 100644
--- a/logpush_example_test.go
+++ b/logpush_example_test.go
@@ -22,7 +22,7 @@ var exampleUpdatedLogpushJob = cloudflare.LogpushJob{
 	DestinationConf: "gs://mybucket/logs",
 }
 
-func ExampleAPI_CreateLogpushJob() {
+func ExampleAPI_CreateZoneLogpushJob() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -33,7 +33,7 @@ func ExampleAPI_CreateLogpushJob() {
 		log.Fatal(err)
 	}
 
-	job, err := api.CreateLogpushJob(context.Background(), zoneID, exampleNewLogpushJob)
+	job, err := api.CreateZoneLogpushJob(context.Background(), zoneID, exampleNewLogpushJob)
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -41,7 +41,7 @@ func ExampleAPI_CreateLogpushJob() {
 	fmt.Printf("%+v\n", job)
 }
 
-func ExampleAPI_UpdateLogpushJob() {
+func ExampleAPI_UpdateZoneLogpushJob() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -52,13 +52,13 @@ func ExampleAPI_UpdateLogpushJob() {
 		log.Fatal(err)
 	}
 
-	err = api.UpdateLogpushJob(context.Background(), zoneID, 1, exampleUpdatedLogpushJob)
+	err = api.UpdateZoneLogpushJob(context.Background(), zoneID, 1, exampleUpdatedLogpushJob)
 	if err != nil {
 		log.Fatal(err)
 	}
 }
 
-func ExampleAPI_LogpushJobs() {
+func ExampleAPI_ListZoneLogpushJobs() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -69,7 +69,7 @@ func ExampleAPI_LogpushJobs() {
 		log.Fatal(err)
 	}
 
-	jobs, err := api.LogpushJobs(context.Background(), zoneID)
+	jobs, err := api.ListZoneLogpushJobs(context.Background(), zoneID)
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -80,7 +80,7 @@ func ExampleAPI_LogpushJobs() {
 	}
 }
 
-func ExampleAPI_LogpushJob() {
+func ExampleAPI_GetZoneLogpushJob() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -91,7 +91,7 @@ func ExampleAPI_LogpushJob() {
 		log.Fatal(err)
 	}
 
-	job, err := api.LogpushJob(context.Background(), zoneID, 1)
+	job, err := api.GetZoneLogpushJob(context.Background(), zoneID, 1)
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -99,7 +99,7 @@ func ExampleAPI_LogpushJob() {
 	fmt.Printf("%+v\n", job)
 }
 
-func ExampleAPI_DeleteLogpushJob() {
+func ExampleAPI_DeleteZoneLogpushJob() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -110,13 +110,13 @@ func ExampleAPI_DeleteLogpushJob() {
 		log.Fatal(err)
 	}
 
-	err = api.DeleteLogpushJob(context.Background(), zoneID, 1)
+	err = api.DeleteZoneLogpushJob(context.Background(), zoneID, 1)
 	if err != nil {
 		log.Fatal(err)
 	}
 }
 
-func ExampleAPI_GetLogpushOwnershipChallenge() {
+func ExampleAPI_GetZoneLogpushOwnershipChallenge() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -127,7 +127,7 @@ func ExampleAPI_GetLogpushOwnershipChallenge() {
 		log.Fatal(err)
 	}
 
-	ownershipChallenge, err := api.GetLogpushOwnershipChallenge(context.Background(), zoneID, "destination_conf")
+	ownershipChallenge, err := api.GetZoneLogpushOwnershipChallenge(context.Background(), zoneID, "destination_conf")
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -135,7 +135,7 @@ func ExampleAPI_GetLogpushOwnershipChallenge() {
 	fmt.Printf("%+v\n", ownershipChallenge)
 }
 
-func ExampleAPI_ValidateLogpushOwnershipChallenge() {
+func ExampleAPI_ValidateZoneLogpushOwnershipChallenge() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -146,7 +146,7 @@ func ExampleAPI_ValidateLogpushOwnershipChallenge() {
 		log.Fatal(err)
 	}
 
-	isValid, err := api.ValidateLogpushOwnershipChallenge(context.Background(), zoneID, "destination_conf", "ownership_challenge")
+	isValid, err := api.ValidateZoneLogpushOwnershipChallenge(context.Background(), zoneID, "destination_conf", "ownership_challenge")
 	if err != nil {
 		log.Fatal(err)
 	}
@@ -154,7 +154,7 @@ func ExampleAPI_ValidateLogpushOwnershipChallenge() {
 	fmt.Printf("%+v\n", isValid)
 }
 
-func ExampleAPI_CheckLogpushDestinationExists() {
+func ExampleAPI_CheckZoneLogpushDestinationExists() {
 	api, err := cloudflare.New(apiKey, user)
 	if err != nil {
 		log.Fatal(err)
@@ -165,7 +165,7 @@ func ExampleAPI_CheckLogpushDestinationExists() {
 		log.Fatal(err)
 	}
 
-	exists, err := api.CheckLogpushDestinationExists(context.Background(), zoneID, "destination_conf")
+	exists, err := api.CheckZoneLogpushDestinationExists(context.Background(), zoneID, "destination_conf")
 	if err != nil {
 		log.Fatal(err)
 	}
diff --git a/logpush_test.go b/logpush_test.go
index 249d19e97..a2f0463aa 100644
--- a/logpush_test.go
+++ b/logpush_test.go
@@ -87,7 +87,7 @@ func TestLogpushJobs(t *testing.T) {
 	mux.HandleFunc("/zones/"+testZoneID+"/logpush/jobs", handler)
 	want := []LogpushJob{expectedLogpushJobStruct}
 
-	actual, err := client.LogpushJobs(context.Background(), testZoneID)
+	actual, err := client.ListZoneLogpushJobs(context.Background(), testZoneID)
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
@@ -112,7 +112,7 @@ func TestGetLogpushJob(t *testing.T) {
 	mux.HandleFunc("/zones/"+testZoneID+"/logpush/jobs/"+strconv.Itoa(jobID), handler)
 	want := expectedLogpushJobStruct
 
-	actual, err := client.LogpushJob(context.Background(), testZoneID, jobID)
+	actual, err := client.GetZoneLogpushJob(context.Background(), testZoneID, jobID)
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
@@ -143,7 +143,7 @@ func TestCreateLogpushJob(t *testing.T) {
 	mux.HandleFunc("/zones/"+testZoneID+"/logpush/jobs", handler)
 	want := &expectedLogpushJobStruct
 
-	actual, err := client.CreateLogpushJob(context.Background(), testZoneID, newJob)
+	actual, err := client.CreateZoneLogpushJob(context.Background(), testZoneID, newJob)
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
@@ -195,7 +195,7 @@ func TestDeleteLogpushJob(t *testing.T) {
 
 	mux.HandleFunc("/zones/"+testZoneID+"/logpush/jobs/"+strconv.Itoa(jobID), handler)
 
-	err := client.DeleteLogpushJob(context.Background(), testZoneID, jobID)
+	err := client.DeleteZoneLogpushJob(context.Background(), testZoneID, jobID)
 	assert.NoError(t, err)
 }
 
@@ -219,7 +219,7 @@ func TestGetLogpushOwnershipChallenge(t *testing.T) {
 
 	want := &expectedLogpushGetOwnershipChallengeStruct
 
-	actual, err := client.GetLogpushOwnershipChallenge(context.Background(), testZoneID, "destination_conf")
+	actual, err := client.GetZoneLogpushOwnershipChallenge(context.Background(), testZoneID, "destination_conf")
 	if assert.NoError(t, err) {
 		assert.Equal(t, want, actual)
 	}
@@ -242,7 +242,7 @@ func TestGetLogpushOwnershipChallengeWithInvalidResponse(t *testing.T) {
 	}
 
 	mux.HandleFunc("/zones/"+testZoneID+"/logpush/ownership", handler)
-	_, err := client.GetLogpushOwnershipChallenge(context.Background(), testZoneID, "destination_conf")
+	_, err := client.GetZoneLogpushOwnershipChallenge(context.Background(), testZoneID, "destination_conf")
 
 	assert.Error(t, err)
 }
@@ -280,7 +280,7 @@ func TestValidateLogpushOwnershipChallenge(t *testing.T) {
 
 			mux.HandleFunc("/zones/"+testZoneID+"/logpush/ownership/validate", handler)
 
-			actual, err := client.ValidateLogpushOwnershipChallenge(context.Background(), testZoneID, "destination_conf", "ownership_challenge")
+			actual, err := client.ValidateZoneLogpushOwnershipChallenge(context.Background(), testZoneID, "destination_conf", "ownership_challenge")
 			if assert.NoError(t, err) {
 				assert.Equal(t, tc.isValid, actual)
 			}
@@ -321,7 +321,7 @@ func TestCheckLogpushDestinationExists(t *testing.T) {
 
 			mux.HandleFunc("/zones/"+testZoneID+"/logpush/validate/destination/exists", handler)
 
-			actual, err := client.CheckLogpushDestinationExists(context.Background(), testZoneID, "destination_conf")
+			actual, err := client.CheckZoneLogpushDestinationExists(context.Background(), testZoneID, "destination_conf")
 			if assert.NoError(t, err) {
 				assert.Equal(t, tc.exists, actual)
 			}