Skip to content

Commit 7aa9f12

Browse files
committed
Remove "enterprise only" error message from Worker scripts methods. Fixes https://github.com/terraform-providers/terraform-provider-cloudflare/issues/607
1 parent 73f366b commit 7aa9f12

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

workers.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,12 @@ func (api *API) DeleteWorker(requestParams *WorkerRequestParams) (WorkerScriptRe
244244
}
245245

246246
// DeleteWorkerWithName deletes worker for a zone.
247-
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise
248-
// account must be specified as api option https://godoc.org/github.com/cloudflare/cloudflare-go#UsingAccount
247+
// Sccount must be specified as api option https://godoc.org/github.com/cloudflare/cloudflare-go#UsingAccount
249248
//
250-
// API reference: https://api.cloudflare.com/#worker-script-delete-worker
249+
// API reference: https://developers.cloudflare.com/workers/tooling/api/scripts/
251250
func (api *API) deleteWorkerWithName(scriptName string) (WorkerScriptResponse, error) {
252251
if api.AccountID == "" {
253-
return WorkerScriptResponse{}, errors.New("account ID required for enterprise only request")
252+
return WorkerScriptResponse{}, errors.New("account ID required")
254253
}
255254
uri := "/accounts/" + api.AccountID + "/workers/scripts/" + scriptName
256255
res, err := api.makeRequest("DELETE", uri, nil)
@@ -284,12 +283,11 @@ func (api *API) DownloadWorker(requestParams *WorkerRequestParams) (WorkerScript
284283
}
285284

286285
// DownloadWorkerWithName fetch raw script content for your worker returns string containing worker code js
287-
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise/
288286
//
289-
// API reference: https://api.cloudflare.com/#worker-script-download-worker
287+
// API reference: https://developers.cloudflare.com/workers/tooling/api/scripts/
290288
func (api *API) downloadWorkerWithName(scriptName string) (WorkerScriptResponse, error) {
291289
if api.AccountID == "" {
292-
return WorkerScriptResponse{}, errors.New("account ID required for enterprise only request")
290+
return WorkerScriptResponse{}, errors.New("account ID required")
293291
}
294292
uri := "/accounts/" + api.AccountID + "/workers/scripts/" + scriptName
295293
res, err := api.makeRequest("GET", uri, nil)
@@ -412,12 +410,10 @@ func (b *bindingContentReader) Read(p []byte) (n int, err error) {
412410

413411
// ListWorkerScripts returns list of worker scripts for given account.
414412
//
415-
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise
416-
//
417-
// API reference: https://developers.cloudflare.com/workers/api/config-api-for-enterprise/
413+
// API reference: https://developers.cloudflare.com/workers/tooling/api/scripts/
418414
func (api *API) ListWorkerScripts() (WorkerListResponse, error) {
419415
if api.AccountID == "" {
420-
return WorkerListResponse{}, errors.New("account ID required for enterprise only request")
416+
return WorkerListResponse{}, errors.New("account ID required")
421417
}
422418
uri := "/accounts/" + api.AccountID + "/workers/scripts"
423419
res, err := api.makeRequest("GET", uri, nil)
@@ -474,7 +470,7 @@ func (api *API) uploadWorkerForZone(zoneID, contentType string, body []byte) (Wo
474470

475471
func (api *API) uploadWorkerWithName(scriptName, contentType string, body []byte) (WorkerScriptResponse, error) {
476472
if api.AccountID == "" {
477-
return WorkerScriptResponse{}, errors.New("account ID required for enterprise only request")
473+
return WorkerScriptResponse{}, errors.New("account ID required")
478474
}
479475
uri := "/accounts/" + api.AccountID + "/workers/scripts/" + scriptName
480476
headers := make(http.Header)

0 commit comments

Comments
 (0)