# Workers For Platforms # Dispatch # Namespaces ## List dispatch namespaces `client.WorkersForPlatforms.Dispatch.Namespaces.List(ctx, query) (*SinglePage[DispatchNamespaceListResponse], error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces` Fetch a list of Workers for Platforms namespaces. ### Parameters - `query DispatchNamespaceListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceListResponse struct{…}` - `CreatedBy string` Identifier. - `CreatedOn Time` When the script was created. - `ModifiedBy string` Identifier. - `ModifiedOn Time` When the script was last modified. - `NamespaceID string` API Resource UUID tag. - `NamespaceName string` Name of the Workers for Platforms dispatch namespace. - `ScriptCount int64` The current number of scripts in this Dispatch Namespace. - `TrustedWorkers bool` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.WorkersForPlatforms.Dispatch.Namespaces.List(context.TODO(), workers_for_platforms.DispatchNamespaceListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "created_by": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2017-01-01T00:00:00Z", "modified_by": "023e105f4ecef8ad9ca31a8372d0c353", "modified_on": "2017-01-01T00:00:00Z", "namespace_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "namespace_name": "my-dispatch-namespace", "script_count": 800, "trusted_workers": false } ] } ``` ## Get dispatch namespace `client.WorkersForPlatforms.Dispatch.Namespaces.Get(ctx, dispatchNamespace, query) (*DispatchNamespaceGetResponse, error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}` Get a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `query DispatchNamespaceGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceGetResponse struct{…}` - `CreatedBy string` Identifier. - `CreatedOn Time` When the script was created. - `ModifiedBy string` Identifier. - `ModifiedOn Time` When the script was last modified. - `NamespaceID string` API Resource UUID tag. - `NamespaceName string` Name of the Workers for Platforms dispatch namespace. - `ScriptCount int64` The current number of scripts in this Dispatch Namespace. - `TrustedWorkers bool` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) namespace, err := client.WorkersForPlatforms.Dispatch.Namespaces.Get( context.TODO(), "my-dispatch-namespace", workers_for_platforms.DispatchNamespaceGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", namespace.NamespaceID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_by": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2017-01-01T00:00:00Z", "modified_by": "023e105f4ecef8ad9ca31a8372d0c353", "modified_on": "2017-01-01T00:00:00Z", "namespace_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "namespace_name": "my-dispatch-namespace", "script_count": 800, "trusted_workers": false } } ``` ## Create dispatch namespace `client.WorkersForPlatforms.Dispatch.Namespaces.New(ctx, params) (*DispatchNamespaceNewResponse, error)` **post** `/accounts/{account_id}/workers/dispatch/namespaces` Create a new Workers for Platforms namespace. ### Parameters - `params DispatchNamespaceNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: The name of the dispatch namespace. ### Returns - `type DispatchNamespaceNewResponse struct{…}` - `CreatedBy string` Identifier. - `CreatedOn Time` When the script was created. - `ModifiedBy string` Identifier. - `ModifiedOn Time` When the script was last modified. - `NamespaceID string` API Resource UUID tag. - `NamespaceName string` Name of the Workers for Platforms dispatch namespace. - `ScriptCount int64` The current number of scripts in this Dispatch Namespace. - `TrustedWorkers bool` Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted". ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) namespace, err := client.WorkersForPlatforms.Dispatch.Namespaces.New(context.TODO(), workers_for_platforms.DispatchNamespaceNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", namespace.NamespaceID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created_by": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2017-01-01T00:00:00Z", "modified_by": "023e105f4ecef8ad9ca31a8372d0c353", "modified_on": "2017-01-01T00:00:00Z", "namespace_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "namespace_name": "my-dispatch-namespace", "script_count": 800, "trusted_workers": false } } ``` ## Delete dispatch namespace `client.WorkersForPlatforms.Dispatch.Namespaces.Delete(ctx, dispatchNamespace, body) (*DispatchNamespaceDeleteResponse, error)` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}` Delete a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `body DispatchNamespaceDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) namespace, err := client.WorkersForPlatforms.Dispatch.Namespaces.Delete( context.TODO(), "my-dispatch-namespace", workers_for_platforms.DispatchNamespaceDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", namespace) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` # Scripts ## Worker Details `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Get(ctx, dispatchNamespace, scriptName, query) (*Script, error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}` Fetch information about a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `query DispatchNamespaceScriptGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Script struct{…}` Details about a worker uploaded to a Workers for Platforms namespace. - `CreatedOn Time` When the script was created. - `DispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `ModifiedOn Time` When the script was last modified. - `Script Script` - `ID string` The name used to identify the script. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `CreatedOn Time` When the script was created. - `Etag string` Hashed script content, can be used in a If-None-Match header when updating. - `Handlers []string` The names of handlers exported as part of the default export. - `HasAssets bool` Whether a Worker contains assets. - `HasModules bool` Whether a Worker contains modules. - `LastDeployedFrom string` The client most recently used to deploy this Worker. - `Logpush bool` Whether Logpush is turned on for the Worker. - `MigrationTag string` The tag of the Durable Object migration that was most recently applied for this Worker. - `ModifiedOn Time` When the script was last modified. - `NamedHandlers []ScriptNamedHandler` Named exports, such as Durable Object class implementations and named entrypoints. - `Handlers []string` The names of handlers exported as part of the named export. - `Name string` The name of the export. - `Observability ScriptObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs ScriptObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces ScriptObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement ScriptPlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `Target []ScriptPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type ScriptPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type ScriptPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type ScriptPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `PlacementMode ScriptPlacementMode` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"` - `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"` - `PlacementStatus ScriptPlacementStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"` - `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"` - `Tag string` The immutable ID of the script. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel ScriptUsageModel` Usage model for the Worker invocations. - `const ScriptUsageModelStandard ScriptUsageModel = "standard"` - `const ScriptUsageModelBundled ScriptUsageModel = "bundled"` - `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) script, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Get( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", script.CreatedOn) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_on": "2017-01-01T00:00:00Z", "dispatch_namespace": "my-dispatch-namespace", "modified_on": "2017-01-01T00:00:00Z", "script": { "id": "my-workers-script", "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "created_on": "2017-01-01T00:00:00Z", "etag": "ea95132c15732412d22c1476fa83f27a", "handlers": [ "fetch", "scheduled" ], "has_assets": false, "has_modules": false, "last_deployed_from": "wrangler", "logpush": false, "migration_tag": "v1", "modified_on": "2017-01-01T00:00:00Z", "named_handlers": [ { "handlers": [ "class" ], "name": "MyDurableObject" } ], "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart", "last_analyzed_at": "2025-01-01T00:00:00Z", "status": "SUCCESS" }, "placement_mode": "smart", "placement_status": "SUCCESS", "tag": "e8f70fdbc8b1fb0b8ddb1af166186758", "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" } }, "success": true } ``` ## Upload Worker Module `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Update(ctx, dispatchNamespace, scriptName, params) (*DispatchNamespaceScriptUpdateResponse, error)` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}` Upload a worker module to a Workers for Platforms namespace. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `Metadata param.Field[DispatchNamespaceScriptUpdateParamsMetadata]` Body param: JSON-encoded metadata about the uploaded parts and Worker configuration. - `Assets DispatchNamespaceScriptUpdateParamsMetadataAssets` Configuration for assets within a Worker. - `Config DispatchNamespaceScriptUpdateParamsMetadataAssetsConfig` Configuration for assets within a Worker. - `Headers string` The contents of a _headers file (used to attach custom headers on asset responses). - `Redirects string` The contents of a _redirects file (used to apply redirects or proxy paths ahead of asset serving). - `HTMLHandling DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandling` Determines the redirects and rewrites of requests for HTML content. - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandlingAutoTrailingSlash DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "auto-trailing-slash"` - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandlingForceTrailingSlash DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "force-trailing-slash"` - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandlingDropTrailingSlash DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "drop-trailing-slash"` - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandlingNone DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigHTMLHandling = "none"` - `NotFoundHandling DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandling` Determines the response when a request does not match a static asset, and there is no Worker script. - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingNone DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "none"` - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandling404Page DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "404-page"` - `const DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandlingSinglePageApplication DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigNotFoundHandling = "single-page-application"` - `RunWorkerFirst DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstUnion` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `type DispatchNamespaceScriptUpdateParamsMetadataAssetsConfigRunWorkerFirstArray []string` Contains a list path rules to control routing to either the Worker or assets. Glob (*) and negative (!) rules are supported. Rules must start with either '/' or '!/'. At least one non-negative rule must be provided, and negative rules have higher precedence than non-negative rules. - `UnionBool` - `ServeDirectly bool` When true and the incoming request matches an asset, that will be served instead of invoking the Worker script. When false, requests will always invoke the Worker script. - `JWT string` Token provided upon successful upload of all files from a registered manifest. - `Bindings []DispatchNamespaceScriptUpdateParamsMetadataBinding` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAITypeAI DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAIType = "ai"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearch struct{…}` - `InstanceName string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchTypeAISearch DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchType = "ai_search"` - `Namespace string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsTypeAssets DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindAssetsType = "assets"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserTypeBrowser DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindBrowserType = "browser"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindD1TypeD1 DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindD1Type = "d1"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobTypeDataBlob DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` Outbound worker. - `Entrypoint string` Entrypoint to invoke on the outbound worker. - `Environment string` Environment of the outbound worker. - `Service string` Name of the outbound worker. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"` - `ClassName string` The exported class name of the Durable Object. - `DispatchNamespace string` The dispatch namespace the Durable Object script belongs to. - `Environment string` The environment of the script_name to bind to. - `NamespaceID string` Namespace identifier tag. - `ScriptName string` The script where the Durable Object is defined, if it is external to this Worker. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveTypeHyperdrive DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritTypeInherit DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindInheritType = "inherit"` - `OldName string` The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions. - `VersionID string` Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesTypeImages DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindImagesType = "images"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonTypeJson DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindJsonType = "json"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceTypeKVNamespace DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaTypeMedia DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMediaType = "media"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextTypePlainText DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesTypePipelines DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueTypeQueue DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindQueueType = "queue"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitTypeRatelimit DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketTypeR2Bucket DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionEu DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedramp DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailTypeSendEmail DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceTypeService DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobTypeTextBlob DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeTypeVectorize DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecret struct{…}` - `Name string` A JavaScript variable name for the binding. - `SecretName string` Name of the secret in the store. - `StoreID string` ID of the store containing the secret. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowTypeWorkflow DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWorkflowType = "workflow"` - `WorkflowName string` Name of the Workflow to bind to. - `ClassName string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `ScriptName string` Script name that contains the Workflow. If not provided, defaults to this script name. - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModule struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleTypeWasmModule DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceTypeVPCService DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork DispatchNamespaceScriptUpdateParamsMetadataBindingsWorkersBindingKindVPCNetworkType = "vpc_network"` - `NetworkID string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `TunnelID string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `BodyPart string` Name of the uploaded file that contains the script (e.g. the file adding a listener to the `fetch` event). Indicates a `service worker syntax` Worker. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `KeepAssets bool` Retain assets which exist for a previously uploaded Worker version; used in lieu of providing a completion token. - `KeepBindings []string` List of binding types to keep from previous_upload. - `Limits DispatchNamespaceScriptUpdateParamsMetadataLimits` Limits to apply for this Worker. - `CPUMs int64` The amount of CPU time this Worker can use in milliseconds. - `Logpush bool` Whether Logpush is turned on for the Worker. - `MainModule string` Name of the uploaded file that contains the main module (e.g. the file exporting a `fetch` handler). Indicates a `module syntax` Worker. - `Migrations DispatchNamespaceScriptUpdateParamsMetadataMigrations` Migrations to apply for Durable Objects associated with this Worker. - `type SingleStepMigration struct{…}` A single set of migrations to apply. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `RenamedClasses []SingleStepMigrationRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []SingleStepMigrationTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `type DispatchNamespaceScriptUpdateParamsMetadataMigrationsWorkersMultipleStepMigrations struct{…}` - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `Steps []MigrationStep` Migrations to apply in order. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `RenamedClasses []MigrationStepRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []MigrationStepTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `Observability DispatchNamespaceScriptUpdateParamsMetadataObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs DispatchNamespaceScriptUpdateParamsMetadataObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces DispatchNamespaceScriptUpdateParamsMetadataObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement DispatchNamespaceScriptUpdateParamsMetadataPlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Mode DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectModeSmart DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode = "smart"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Mode DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectModeTargeted DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectModeTargeted DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectModeTargeted DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObject struct{…}` - `Mode DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectModeTargeted DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectMode = "targeted"` - `Target []DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusSuccess DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateParamsMetadataPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `Tags []string` List of strings to use as tags for this Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel DispatchNamespaceScriptUpdateParamsMetadataUsageModel` Usage model for the Worker invocations. - `const DispatchNamespaceScriptUpdateParamsMetadataUsageModelStandard DispatchNamespaceScriptUpdateParamsMetadataUsageModel = "standard"` - `const DispatchNamespaceScriptUpdateParamsMetadataUsageModelBundled DispatchNamespaceScriptUpdateParamsMetadataUsageModel = "bundled"` - `const DispatchNamespaceScriptUpdateParamsMetadataUsageModelUnbound DispatchNamespaceScriptUpdateParamsMetadataUsageModel = "unbound"` - `BindingsInherit param.Field[DispatchNamespaceScriptUpdateParamsBindingsInherit]` Query param: When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the script. Without this, unresolvable inherit bindings are silently dropped. - `const DispatchNamespaceScriptUpdateParamsBindingsInheritStrict DispatchNamespaceScriptUpdateParamsBindingsInherit = "strict"` - `Files param.Field[[]Reader]` Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`. ### Returns - `type DispatchNamespaceScriptUpdateResponse struct{…}` - `StartupTimeMs int64` - `ID string` The name used to identify the script. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `CreatedOn Time` When the script was created. - `EntryPoint string` The entry point for the script. - `Etag string` Hashed script content, can be used in a If-None-Match header when updating. - `Handlers []string` The names of handlers exported as part of the default export. - `HasAssets bool` Whether a Worker contains assets. - `HasModules bool` Whether a Worker contains modules. - `LastDeployedFrom string` The client most recently used to deploy this Worker. - `Logpush bool` Whether Logpush is turned on for the Worker. - `MigrationTag string` The tag of the Durable Object migration that was most recently applied for this Worker. - `ModifiedOn Time` When the script was last modified. - `NamedHandlers []DispatchNamespaceScriptUpdateResponseNamedHandler` Named exports, such as Durable Object class implementations and named entrypoints. - `Handlers []string` The names of handlers exported as part of the named export. - `Name string` The name of the export. - `Observability DispatchNamespaceScriptUpdateResponseObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs DispatchNamespaceScriptUpdateResponseObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces DispatchNamespaceScriptUpdateResponseObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement DispatchNamespaceScriptUpdateResponsePlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptUpdateResponsePlacementObjectMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectModeSmart DispatchNamespaceScriptUpdateResponsePlacementObjectMode = "smart"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptUpdateResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateResponsePlacementObjectModeTargeted DispatchNamespaceScriptUpdateResponsePlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode DispatchNamespaceScriptUpdateResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateResponsePlacementObjectModeTargeted DispatchNamespaceScriptUpdateResponsePlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode DispatchNamespaceScriptUpdateResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateResponsePlacementObjectModeTargeted DispatchNamespaceScriptUpdateResponsePlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type DispatchNamespaceScriptUpdateResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptUpdateResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptUpdateResponsePlacementObjectModeTargeted DispatchNamespaceScriptUpdateResponsePlacementObjectMode = "targeted"` - `Target []DispatchNamespaceScriptUpdateResponsePlacementObjectTarget` Array of placement targets (currently limited to single target). - `type DispatchNamespaceScriptUpdateResponsePlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type DispatchNamespaceScriptUpdateResponsePlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptUpdateResponsePlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status DispatchNamespaceScriptUpdateResponsePlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementObjectStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `PlacementMode DispatchNamespaceScriptUpdateResponsePlacementMode` - `const DispatchNamespaceScriptUpdateResponsePlacementModeSmart DispatchNamespaceScriptUpdateResponsePlacementMode = "smart"` - `const DispatchNamespaceScriptUpdateResponsePlacementModeTargeted DispatchNamespaceScriptUpdateResponsePlacementMode = "targeted"` - `PlacementStatus DispatchNamespaceScriptUpdateResponsePlacementStatus` - `const DispatchNamespaceScriptUpdateResponsePlacementStatusSuccess DispatchNamespaceScriptUpdateResponsePlacementStatus = "SUCCESS"` - `const DispatchNamespaceScriptUpdateResponsePlacementStatusUnsupportedApplication DispatchNamespaceScriptUpdateResponsePlacementStatus = "UNSUPPORTED_APPLICATION"` - `const DispatchNamespaceScriptUpdateResponsePlacementStatusInsufficientInvocations DispatchNamespaceScriptUpdateResponsePlacementStatus = "INSUFFICIENT_INVOCATIONS"` - `Tag string` The immutable ID of the script. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel DispatchNamespaceScriptUpdateResponseUsageModel` Usage model for the Worker invocations. - `const DispatchNamespaceScriptUpdateResponseUsageModelStandard DispatchNamespaceScriptUpdateResponseUsageModel = "standard"` - `const DispatchNamespaceScriptUpdateResponseUsageModelBundled DispatchNamespaceScriptUpdateResponseUsageModel = "bundled"` - `const DispatchNamespaceScriptUpdateResponseUsageModelUnbound DispatchNamespaceScriptUpdateResponseUsageModel = "unbound"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) script, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Update( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Metadata: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptUpdateParamsMetadata{ }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", script.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "startup_time_ms": 10, "id": "this-is_my_script-01", "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "created_on": "2022-05-05T05:15:11.602148Z", "entry_point": "index.js", "etag": "777f24a43bef5f69174aa69ceaf1dea67968d510a31d1vw3e49d34a0187c06d1", "handlers": [ "fetch" ], "has_assets": false, "has_modules": false, "last_deployed_from": "wrangler", "logpush": false, "migration_tag": "v1", "modified_on": "2022-05-20T19:02:56.446492Z", "named_handlers": [ { "handlers": [ "class" ], "name": "MyDurableObject" } ], "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart", "last_analyzed_at": "2025-01-01T00:00:00Z", "status": "SUCCESS" }, "placement_mode": "smart", "placement_status": "SUCCESS", "tag": "e8f70fdbc8b1fb0b8ddb1af166186758", "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" }, "success": true } ``` ## Delete Worker `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Delete(ctx, dispatchNamespace, scriptName, params) (*DispatchNamespaceScriptDeleteResponse, error)` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}` Delete a worker from a Workers for Platforms namespace. This call has no response body on a successful delete. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptDeleteParams` - `AccountID param.Field[string]` Path param: Identifier. - `Force param.Field[bool]` Query param: If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script. ### Returns - `type DispatchNamespaceScriptDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) script, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Delete( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", script) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Script - `type Script struct{…}` Details about a worker uploaded to a Workers for Platforms namespace. - `CreatedOn Time` When the script was created. - `DispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `ModifiedOn Time` When the script was last modified. - `Script Script` - `ID string` The name used to identify the script. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `CreatedOn Time` When the script was created. - `Etag string` Hashed script content, can be used in a If-None-Match header when updating. - `Handlers []string` The names of handlers exported as part of the default export. - `HasAssets bool` Whether a Worker contains assets. - `HasModules bool` Whether a Worker contains modules. - `LastDeployedFrom string` The client most recently used to deploy this Worker. - `Logpush bool` Whether Logpush is turned on for the Worker. - `MigrationTag string` The tag of the Durable Object migration that was most recently applied for this Worker. - `ModifiedOn Time` When the script was last modified. - `NamedHandlers []ScriptNamedHandler` Named exports, such as Durable Object class implementations and named entrypoints. - `Handlers []string` The names of handlers exported as part of the named export. - `Name string` The name of the export. - `Observability ScriptObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs ScriptObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces ScriptObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement ScriptPlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `Target []ScriptPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type ScriptPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type ScriptPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type ScriptPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `PlacementMode ScriptPlacementMode` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"` - `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"` - `PlacementStatus ScriptPlacementStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"` - `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"` - `Tag string` The immutable ID of the script. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel ScriptUsageModel` Usage model for the Worker invocations. - `const ScriptUsageModelStandard ScriptUsageModel = "standard"` - `const ScriptUsageModelBundled ScriptUsageModel = "bundled"` - `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"` # Asset Upload ## Create Assets Upload Session `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.AssetUpload.New(ctx, dispatchNamespace, scriptName, params) (*DispatchNamespaceScriptAssetUploadNewResponse, error)` **post** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/assets-upload-session` Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptAssetUploadNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Manifest param.Field[map[string, DispatchNamespaceScriptAssetUploadNewParamsManifest]]` Body param: A manifest ([path]: {hash, size}) map of files to upload. As an example, `/blog/hello-world.html` would be a valid path key. - `Hash string` The hash of the file. - `Size int64` The size of the file in bytes. ### Returns - `type DispatchNamespaceScriptAssetUploadNewResponse struct{…}` - `Buckets [][]string` The requests to make to upload assets. - `JWT string` A JWT to use as authentication for uploading assets. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) assetUpload, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.AssetUpload.New( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptAssetUploadNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Manifest: cloudflare.F(map[string]workers_for_platforms.DispatchNamespaceScriptAssetUploadNewParamsManifest{ "foo": workers_for_platforms.DispatchNamespaceScriptAssetUploadNewParamsManifest{ Hash: cloudflare.F("hash"), Size: cloudflare.F(int64(0)), }, }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", assetUpload.Buckets) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "buckets": [ [ "string" ] ], "jwt": "jwt" } } ``` # Content ## Get Script Content `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Content.Get(ctx, dispatchNamespace, scriptName, query) (*Response, error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content` Fetch script content from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `query DispatchNamespaceScriptContentGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceScriptContentGetResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) content, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Content.Get( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptContentGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", content) } ``` ## Put Script Content `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Content.Update(ctx, dispatchNamespace, scriptName, params) (*Script, error)` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content` Put script content for a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptContentUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `Metadata param.Field[WorkerMetadata]` Body param: JSON-encoded metadata about the uploaded parts and Worker configuration. - `Files param.Field[[]Reader]` Body param: An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.
Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`. - `CfWorkerBodyPart param.Field[string]` Header param: The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part. - `CfWorkerMainModulePart param.Field[string]` Header param: The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part. ### Returns - `type Script struct{…}` - `ID string` The name used to identify the script. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `CreatedOn Time` When the script was created. - `Etag string` Hashed script content, can be used in a If-None-Match header when updating. - `Handlers []string` The names of handlers exported as part of the default export. - `HasAssets bool` Whether a Worker contains assets. - `HasModules bool` Whether a Worker contains modules. - `LastDeployedFrom string` The client most recently used to deploy this Worker. - `Logpush bool` Whether Logpush is turned on for the Worker. - `MigrationTag string` The tag of the Durable Object migration that was most recently applied for this Worker. - `ModifiedOn Time` When the script was last modified. - `NamedHandlers []ScriptNamedHandler` Named exports, such as Durable Object class implementations and named entrypoints. - `Handlers []string` The names of handlers exported as part of the named export. - `Name string` The name of the export. - `Observability ScriptObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs ScriptObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces ScriptObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement ScriptPlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectModeSmart ScriptPlacementObjectMode = "smart"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `type ScriptPlacementObject struct{…}` - `Mode ScriptPlacementObjectMode` Targeted placement mode. - `const ScriptPlacementObjectModeTargeted ScriptPlacementObjectMode = "targeted"` - `Target []ScriptPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type ScriptPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type ScriptPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type ScriptPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `LastAnalyzedAt Time` The last time the script was analyzed for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `Status ScriptPlacementObjectStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementObjectStatusSuccess ScriptPlacementObjectStatus = "SUCCESS"` - `const ScriptPlacementObjectStatusUnsupportedApplication ScriptPlacementObjectStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementObjectStatusInsufficientInvocations ScriptPlacementObjectStatus = "INSUFFICIENT_INVOCATIONS"` - `PlacementMode ScriptPlacementMode` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `const ScriptPlacementModeSmart ScriptPlacementMode = "smart"` - `const ScriptPlacementModeTargeted ScriptPlacementMode = "targeted"` - `PlacementStatus ScriptPlacementStatus` Status of [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const ScriptPlacementStatusSuccess ScriptPlacementStatus = "SUCCESS"` - `const ScriptPlacementStatusUnsupportedApplication ScriptPlacementStatus = "UNSUPPORTED_APPLICATION"` - `const ScriptPlacementStatusInsufficientInvocations ScriptPlacementStatus = "INSUFFICIENT_INVOCATIONS"` - `Tag string` The immutable ID of the script. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel ScriptUsageModel` Usage model for the Worker invocations. - `const ScriptUsageModelStandard ScriptUsageModel = "standard"` - `const ScriptUsageModelBundled ScriptUsageModel = "bundled"` - `const ScriptUsageModelUnbound ScriptUsageModel = "unbound"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) script, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Content.Update( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptContentUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Metadata: cloudflare.F(workers.WorkerMetadataParam{ }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", script.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "my-workers-script", "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "created_on": "2017-01-01T00:00:00Z", "etag": "ea95132c15732412d22c1476fa83f27a", "handlers": [ "fetch", "scheduled" ], "has_assets": false, "has_modules": false, "last_deployed_from": "wrangler", "logpush": false, "migration_tag": "v1", "modified_on": "2017-01-01T00:00:00Z", "named_handlers": [ { "handlers": [ "class" ], "name": "MyDurableObject" } ], "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart", "last_analyzed_at": "2025-01-01T00:00:00Z", "status": "SUCCESS" }, "placement_mode": "smart", "placement_status": "SUCCESS", "tag": "e8f70fdbc8b1fb0b8ddb1af166186758", "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" }, "success": true } ``` # Settings ## Get Script Settings `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Get(ctx, dispatchNamespace, scriptName, query) (*DispatchNamespaceScriptSettingGetResponse, error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings` Get script settings from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `query DispatchNamespaceScriptSettingGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceScriptSettingGetResponse struct{…}` Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `Bindings []DispatchNamespaceScriptSettingGetResponseBinding` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAITypeAI DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAIType = "ai"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearch struct{…}` - `InstanceName string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchTypeAISearch DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchType = "ai_search"` - `Namespace string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAssetsTypeAssets DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindAssetsType = "assets"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindBrowserTypeBrowser DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindBrowserType = "browser"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindD1TypeD1 DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindD1Type = "d1"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDataBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDataBlobTypeDataBlob DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` Outbound worker. - `Entrypoint string` Entrypoint to invoke on the outbound worker. - `Environment string` Environment of the outbound worker. - `Service string` Name of the outbound worker. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"` - `ClassName string` The exported class name of the Durable Object. - `DispatchNamespace string` The dispatch namespace the Durable Object script belongs to. - `Environment string` The environment of the script_name to bind to. - `NamespaceID string` Namespace identifier tag. - `ScriptName string` The script where the Durable Object is defined, if it is external to this Worker. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindHyperdriveTypeHyperdrive DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindInheritTypeInherit DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindInheritType = "inherit"` - `OldName string` The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions. - `VersionID string` Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindImagesTypeImages DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindImagesType = "images"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindJsonTypeJson DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindJsonType = "json"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindKVNamespaceTypeKVNamespace DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMediaTypeMedia DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMediaType = "media"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPlainTextTypePlainText DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPipelinesTypePipelines DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindQueueTypeQueue DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindQueueType = "queue"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindRatelimitTypeRatelimit DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketTypeR2Bucket DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionEu DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionFedramp DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSendEmailTypeSendEmail DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindServiceTypeService DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindTextBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindTextBlobTypeTextBlob DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVectorizeTypeVectorize DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecret struct{…}` - `Name string` A JavaScript variable name for the binding. - `SecretName string` Name of the secret in the store. - `StoreID string` ID of the store containing the secret. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWorkflowTypeWorkflow DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWorkflowType = "workflow"` - `WorkflowName string` Name of the Workflow to bind to. - `ClassName string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `ScriptName string` Script name that contains the Workflow. If not provided, defaults to this script name. - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWasmModule struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWasmModuleTypeWasmModule DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCServiceTypeVPCService DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork DispatchNamespaceScriptSettingGetResponseBindingsWorkersBindingKindVPCNetworkType = "vpc_network"` - `NetworkID string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `TunnelID string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `Limits DispatchNamespaceScriptSettingGetResponseLimits` Limits to apply for this Worker. - `CPUMs int64` The amount of CPU time this Worker can use in milliseconds. - `Logpush bool` Whether Logpush is turned on for the Worker. - `Migrations DispatchNamespaceScriptSettingGetResponseMigrations` Migrations to apply for Durable Objects associated with this Worker. - `type SingleStepMigration struct{…}` A single set of migrations to apply. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `RenamedClasses []SingleStepMigrationRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []SingleStepMigrationTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `type DispatchNamespaceScriptSettingGetResponseMigrationsWorkersMultipleStepMigrations struct{…}` - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `Steps []MigrationStep` Migrations to apply in order. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `RenamedClasses []MigrationStepRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []MigrationStepTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `Observability DispatchNamespaceScriptSettingGetResponseObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs DispatchNamespaceScriptSettingGetResponseObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces DispatchNamespaceScriptSettingGetResponseObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement DispatchNamespaceScriptSettingGetResponsePlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type DispatchNamespaceScriptSettingGetResponsePlacementMode struct{…}` - `Mode DispatchNamespaceScriptSettingGetResponsePlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptSettingGetResponsePlacementModeModeSmart DispatchNamespaceScriptSettingGetResponsePlacementModeMode = "smart"` - `type DispatchNamespaceScriptSettingGetResponsePlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type DispatchNamespaceScriptSettingGetResponsePlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptSettingGetResponsePlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type DispatchNamespaceScriptSettingGetResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptSettingGetResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingGetResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingGetResponsePlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type DispatchNamespaceScriptSettingGetResponsePlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode DispatchNamespaceScriptSettingGetResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingGetResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingGetResponsePlacementObjectMode = "targeted"` - `type DispatchNamespaceScriptSettingGetResponsePlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode DispatchNamespaceScriptSettingGetResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingGetResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingGetResponsePlacementObjectMode = "targeted"` - `type DispatchNamespaceScriptSettingGetResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptSettingGetResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingGetResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingGetResponsePlacementObjectMode = "targeted"` - `Target []DispatchNamespaceScriptSettingGetResponsePlacementObjectTarget` Array of placement targets (currently limited to single target). - `type DispatchNamespaceScriptSettingGetResponsePlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type DispatchNamespaceScriptSettingGetResponsePlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptSettingGetResponsePlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel DispatchNamespaceScriptSettingGetResponseUsageModel` Usage model for the Worker invocations. - `const DispatchNamespaceScriptSettingGetResponseUsageModelStandard DispatchNamespaceScriptSettingGetResponseUsageModel = "standard"` - `const DispatchNamespaceScriptSettingGetResponseUsageModelBundled DispatchNamespaceScriptSettingGetResponseUsageModel = "bundled"` - `const DispatchNamespaceScriptSettingGetResponseUsageModelUnbound DispatchNamespaceScriptSettingGetResponseUsageModel = "unbound"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) setting, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Get( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptSettingGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", setting.Bindings) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "logpush": false, "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart" }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" } } ``` ## Patch Script Settings `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Edit(ctx, dispatchNamespace, scriptName, params) (*DispatchNamespaceScriptSettingEditResponse, error)` **patch** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings` Patch script metadata, such as bindings. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptSettingEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `Settings param.Field[DispatchNamespaceScriptSettingEditParamsSettings]` Body param: Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `Bindings []DispatchNamespaceScriptSettingEditParamsSettingsBinding` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAITypeAI DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAIType = "ai"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearch struct{…}` - `InstanceName string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchTypeAISearch DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchType = "ai_search"` - `Namespace string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAssetsTypeAssets DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindAssetsType = "assets"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindBrowserTypeBrowser DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindBrowserType = "browser"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindD1TypeD1 DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindD1Type = "d1"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDataBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobTypeDataBlob DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` Outbound worker. - `Entrypoint string` Entrypoint to invoke on the outbound worker. - `Environment string` Environment of the outbound worker. - `Service string` Name of the outbound worker. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"` - `ClassName string` The exported class name of the Durable Object. - `DispatchNamespace string` The dispatch namespace the Durable Object script belongs to. - `Environment string` The environment of the script_name to bind to. - `NamespaceID string` Namespace identifier tag. - `ScriptName string` The script where the Durable Object is defined, if it is external to this Worker. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveTypeHyperdrive DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindInheritTypeInherit DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindInheritType = "inherit"` - `OldName string` The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions. - `VersionID string` Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindImagesTypeImages DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindImagesType = "images"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindJsonTypeJson DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindJsonType = "json"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceTypeKVNamespace DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMediaTypeMedia DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMediaType = "media"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextTypePlainText DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesTypePipelines DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindQueueTypeQueue DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindQueueType = "queue"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitTypeRatelimit DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketTypeR2Bucket DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionEu DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionFedramp DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailTypeSendEmail DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindServiceTypeService DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindTextBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobTypeTextBlob DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeTypeVectorize DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecret struct{…}` - `Name string` A JavaScript variable name for the binding. - `SecretName string` Name of the secret in the store. - `StoreID string` ID of the store containing the secret. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowTypeWorkflow DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWorkflowType = "workflow"` - `WorkflowName string` Name of the Workflow to bind to. - `ClassName string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `ScriptName string` Script name that contains the Workflow. If not provided, defaults to this script name. - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWasmModule struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleTypeWasmModule DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceTypeVPCService DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork DispatchNamespaceScriptSettingEditParamsSettingsBindingsWorkersBindingKindVPCNetworkType = "vpc_network"` - `NetworkID string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `TunnelID string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `Limits DispatchNamespaceScriptSettingEditParamsSettingsLimits` Limits to apply for this Worker. - `CPUMs int64` The amount of CPU time this Worker can use in milliseconds. - `Logpush bool` Whether Logpush is turned on for the Worker. - `Migrations DispatchNamespaceScriptSettingEditParamsSettingsMigrations` Migrations to apply for Durable Objects associated with this Worker. - `type SingleStepMigration struct{…}` A single set of migrations to apply. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `RenamedClasses []SingleStepMigrationRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []SingleStepMigrationTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `type DispatchNamespaceScriptSettingEditParamsSettingsMigrationsWorkersMultipleStepMigrations struct{…}` - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `Steps []MigrationStep` Migrations to apply in order. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `RenamedClasses []MigrationStepRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []MigrationStepTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `Observability DispatchNamespaceScriptSettingEditParamsSettingsObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs DispatchNamespaceScriptSettingEditParamsSettingsObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces DispatchNamespaceScriptSettingEditParamsSettingsObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement DispatchNamespaceScriptSettingEditParamsSettingsPlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementMode struct{…}` - `Mode DispatchNamespaceScriptSettingEditParamsSettingsPlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptSettingEditParamsSettingsPlacementModeModeSmart DispatchNamespaceScriptSettingEditParamsSettingsPlacementModeMode = "smart"` - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObject struct{…}` - `Mode DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectModeTargeted DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectModeTargeted DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode = "targeted"` - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectModeTargeted DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode = "targeted"` - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObject struct{…}` - `Mode DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectModeTargeted DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectMode = "targeted"` - `Target []DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectTarget` Array of placement targets (currently limited to single target). - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptSettingEditParamsSettingsPlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel DispatchNamespaceScriptSettingEditParamsSettingsUsageModel` Usage model for the Worker invocations. - `const DispatchNamespaceScriptSettingEditParamsSettingsUsageModelStandard DispatchNamespaceScriptSettingEditParamsSettingsUsageModel = "standard"` - `const DispatchNamespaceScriptSettingEditParamsSettingsUsageModelBundled DispatchNamespaceScriptSettingEditParamsSettingsUsageModel = "bundled"` - `const DispatchNamespaceScriptSettingEditParamsSettingsUsageModelUnbound DispatchNamespaceScriptSettingEditParamsSettingsUsageModel = "unbound"` ### Returns - `type DispatchNamespaceScriptSettingEditResponse struct{…}` Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. - `Bindings []DispatchNamespaceScriptSettingEditResponseBinding` List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAIType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAITypeAI DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAIType = "ai"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearch struct{…}` - `InstanceName string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchTypeAISearch DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchType = "ai_search"` - `Namespace string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceTypeAISearchNamespace DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAssetsTypeAssets DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindAssetsType = "assets"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindBrowserTypeBrowser DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindBrowserType = "browser"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindD1TypeD1 DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindD1Type = "d1"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDataBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDataBlobTypeDataBlob DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDataBlobType = "data_blob"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceTypeDispatchNamespace DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDispatchNamespaceOutboundWorker` Outbound worker. - `Entrypoint string` Entrypoint to invoke on the outbound worker. - `Environment string` Environment of the outbound worker. - `Service string` Name of the outbound worker. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"` - `ClassName string` The exported class name of the Durable Object. - `DispatchNamespace string` The dispatch namespace the Durable Object script belongs to. - `Environment string` The environment of the script_name to bind to. - `NamespaceID string` Namespace identifier tag. - `ScriptName string` The script where the Durable Object is defined, if it is external to this Worker. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindHyperdriveTypeHyperdrive DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindHyperdriveType = "hyperdrive"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindInheritTypeInherit DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindInheritType = "inherit"` - `OldName string` The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions. - `VersionID string` Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindImagesTypeImages DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindImagesType = "images"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindJsonTypeJson DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindJsonType = "json"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindKVNamespaceTypeKVNamespace DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMediaTypeMedia DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMediaType = "media"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMTLSCertificateTypeMTLSCertificate DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPlainTextTypePlainText DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPlainTextType = "plain_text"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPipelinesTypePipelines DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindPipelinesType = "pipelines"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindQueueTypeQueue DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindQueueType = "queue"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindRatelimitTypeRatelimit DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindRatelimitType = "ratelimit"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketTypeR2Bucket DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionEu DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "eu"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionFedramp DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdictionFedrampHigh DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSendEmailTypeSendEmail DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindServiceTypeService DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindTextBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindTextBlobTypeTextBlob DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindTextBlobType = "text_blob"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVectorizeTypeVectorize DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVectorizeType = "vectorize"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVersionMetadataTypeVersionMetadata DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVersionMetadataType = "version_metadata"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecret struct{…}` - `Name string` A JavaScript variable name for the binding. - `SecretName string` Name of the secret in the store. - `StoreID string` ID of the store containing the secret. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWorkflowTypeWorkflow DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWorkflowType = "workflow"` - `WorkflowName string` Name of the Workflow to bind to. - `ClassName string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `ScriptName string` Script name that contains the Workflow. If not provided, defaults to this script name. - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWasmModule struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWasmModuleTypeWasmModule DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindWasmModuleType = "wasm_module"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCServiceTypeVPCService DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCServiceType = "vpc_service"` - `type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCNetworkTypeVPCNetwork DispatchNamespaceScriptSettingEditResponseBindingsWorkersBindingKindVPCNetworkType = "vpc_network"` - `NetworkID string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `TunnelID string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. - `CompatibilityDate string` Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. - `CompatibilityFlags []string` Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. - `Limits DispatchNamespaceScriptSettingEditResponseLimits` Limits to apply for this Worker. - `CPUMs int64` The amount of CPU time this Worker can use in milliseconds. - `Logpush bool` Whether Logpush is turned on for the Worker. - `Migrations DispatchNamespaceScriptSettingEditResponseMigrations` Migrations to apply for Durable Objects associated with this Worker. - `type SingleStepMigration struct{…}` A single set of migrations to apply. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `RenamedClasses []SingleStepMigrationRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []SingleStepMigrationTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `type DispatchNamespaceScriptSettingEditResponseMigrationsWorkersMultipleStepMigrations struct{…}` - `NewTag string` Tag to set as the latest migration tag. - `OldTag string` Tag used to verify against the latest migration tag for this Worker. If they don't match, the upload is rejected. - `Steps []MigrationStep` Migrations to apply in order. - `DeletedClasses []string` A list of classes to delete Durable Object namespaces from. - `NewClasses []string` A list of classes to create Durable Object namespaces from. - `NewSqliteClasses []string` A list of classes to create Durable Object namespaces with SQLite from. - `RenamedClasses []MigrationStepRenamedClass` A list of classes with Durable Object namespaces that were renamed. - `From string` - `To string` - `TransferredClasses []MigrationStepTransferredClass` A list of transfers for Durable Object namespaces from a different Worker and class to a class defined in this Worker. - `From string` - `FromScript string` - `To string` - `Observability DispatchNamespaceScriptSettingEditResponseObservability` Observability settings for the Worker. - `Enabled bool` Whether observability is enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Logs DispatchNamespaceScriptSettingEditResponseObservabilityLogs` Log settings for the Worker. - `Enabled bool` Whether logs are enabled for the Worker. - `InvocationLogs bool` Whether [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) are enabled for the Worker. - `Destinations []string` A list of destinations where logs will be exported to. - `HeadSamplingRate float64` The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether log persistence is enabled for the Worker. - `Traces DispatchNamespaceScriptSettingEditResponseObservabilityTraces` Trace settings for the Worker. - `Destinations []string` A list of destinations where traces will be exported to. - `Enabled bool` Whether traces are enabled for the Worker. - `HeadSamplingRate float64` The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. - `Persist bool` Whether trace persistence is enabled for the Worker. - `Placement DispatchNamespaceScriptSettingEditResponsePlacement` Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host. - `type DispatchNamespaceScriptSettingEditResponsePlacementMode struct{…}` - `Mode DispatchNamespaceScriptSettingEditResponsePlacementModeMode` Enables [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). - `const DispatchNamespaceScriptSettingEditResponsePlacementModeModeSmart DispatchNamespaceScriptSettingEditResponsePlacementModeMode = "smart"` - `type DispatchNamespaceScriptSettingEditResponsePlacementRegion struct{…}` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type DispatchNamespaceScriptSettingEditResponsePlacementHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptSettingEditResponsePlacementHost struct{…}` - `Host string` TCP host and port for targeted placement. - `type DispatchNamespaceScriptSettingEditResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptSettingEditResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingEditResponsePlacementObjectMode = "targeted"` - `Region string` Cloud region for targeted placement in format 'provider:region'. - `type DispatchNamespaceScriptSettingEditResponsePlacementObject struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `Mode DispatchNamespaceScriptSettingEditResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingEditResponsePlacementObjectMode = "targeted"` - `type DispatchNamespaceScriptSettingEditResponsePlacementObject struct{…}` - `Host string` TCP host and port for targeted placement. - `Mode DispatchNamespaceScriptSettingEditResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingEditResponsePlacementObjectMode = "targeted"` - `type DispatchNamespaceScriptSettingEditResponsePlacementObject struct{…}` - `Mode DispatchNamespaceScriptSettingEditResponsePlacementObjectMode` Targeted placement mode. - `const DispatchNamespaceScriptSettingEditResponsePlacementObjectModeTargeted DispatchNamespaceScriptSettingEditResponsePlacementObjectMode = "targeted"` - `Target []DispatchNamespaceScriptSettingEditResponsePlacementObjectTarget` Array of placement targets (currently limited to single target). - `type DispatchNamespaceScriptSettingEditResponsePlacementObjectTargetRegion struct{…}` - `Region string` Cloud region in format 'provider:region'. - `type DispatchNamespaceScriptSettingEditResponsePlacementObjectTargetHostname struct{…}` - `Hostname string` HTTP hostname for targeted placement. - `type DispatchNamespaceScriptSettingEditResponsePlacementObjectTargetHost struct{…}` - `Host string` TCP host:port for targeted placement. - `Tags []string` Tags associated with the Worker. - `TailConsumers []ConsumerScript` List of Workers that will consume logs from the attached Worker. - `Service string` Name of Worker that is to be the consumer. - `Environment string` Optional environment if the Worker utilizes one. - `Namespace string` Optional dispatch namespace the script belongs to. - `UsageModel DispatchNamespaceScriptSettingEditResponseUsageModel` Usage model for the Worker invocations. - `const DispatchNamespaceScriptSettingEditResponseUsageModelStandard DispatchNamespaceScriptSettingEditResponseUsageModel = "standard"` - `const DispatchNamespaceScriptSettingEditResponseUsageModelBundled DispatchNamespaceScriptSettingEditResponseUsageModel = "bundled"` - `const DispatchNamespaceScriptSettingEditResponseUsageModelUnbound DispatchNamespaceScriptSettingEditResponseUsageModel = "unbound"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Edit( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptSettingEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Bindings) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "bindings": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "compatibility_date": "2021-01-01", "compatibility_flags": [ "nodejs_compat" ], "limits": { "cpu_ms": 50 }, "logpush": false, "observability": { "enabled": true, "head_sampling_rate": 0.1, "logs": { "enabled": true, "invocation_logs": true, "destinations": [ "cloudflare" ], "head_sampling_rate": 0.1, "persist": true }, "traces": { "destinations": [ "cloudflare" ], "enabled": true, "head_sampling_rate": 0.1, "persist": true } }, "placement": { "mode": "smart" }, "tags": [ "my-team", "my-public-api" ], "tail_consumers": [ { "service": "my-log-consumer", "environment": "production", "namespace": "my-namespace" } ], "usage_model": "standard" } } ``` # Bindings ## Get Script Bindings `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Bindings.Get(ctx, dispatchNamespace, scriptName, query) (*SinglePage[DispatchNamespaceScriptBindingGetResponse], error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings` Fetch script bindings from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `query DispatchNamespaceScriptBindingGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceScriptBindingGetResponse interface{…}` A binding to allow the Worker to communicate with resources. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAI struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAIType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAITypeAI DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAIType = "ai"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearch struct{…}` - `InstanceName string` The user-chosen instance name. Must exist at deploy time. The worker can search, chat, update, and manage items/jobs on this instance. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchTypeAISearch DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchType = "ai_search"` - `Namespace string` The namespace the instance belongs to. Defaults to "default" if omitted. Customers who don't use namespaces can simply omit this field. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The user-chosen namespace name. Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2 bucket pattern). The "default" namespace is auto-created by config-api for new accounts. Grants full access (CRUD + search + chat) to all instances within the namespace. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchNamespaceTypeAISearchNamespace DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAISearchNamespaceType = "ai_search_namespace"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAnalyticsEngine struct{…}` - `Dataset string` The name of the dataset to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAnalyticsEngineType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAnalyticsEngineTypeAnalyticsEngine DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAnalyticsEngineType = "analytics_engine"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAssets struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAssetsType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAssetsTypeAssets DispatchNamespaceScriptBindingGetResponseWorkersBindingKindAssetsType = "assets"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindBrowser struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindBrowserType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindBrowserTypeBrowser DispatchNamespaceScriptBindingGetResponseWorkersBindingKindBrowserType = "browser"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindD1 struct{…}` - `ID string` Identifier of the D1 database to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindD1Type` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindD1TypeD1 DispatchNamespaceScriptBindingGetResponseWorkersBindingKindD1Type = "d1"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDataBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the data content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDataBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDataBlobTypeDataBlob DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDataBlobType = "data_blob"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Namespace string` The name of the dispatch namespace. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceTypeDispatchNamespace DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceType = "dispatch_namespace"` - `Outbound DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceOutbound` Outbound worker. - `Params []DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceOutboundParam` Pass information from the Dispatch Worker to the Outbound Worker through the parameters. - `Name string` Name of the parameter. - `Worker DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDispatchNamespaceOutboundWorker` Outbound worker. - `Entrypoint string` Entrypoint to invoke on the outbound worker. - `Environment string` Environment of the outbound worker. - `Service string` Name of the outbound worker. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDurableObjectNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDurableObjectNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDurableObjectNamespaceTypeDurableObjectNamespace DispatchNamespaceScriptBindingGetResponseWorkersBindingKindDurableObjectNamespaceType = "durable_object_namespace"` - `ClassName string` The exported class name of the Durable Object. - `DispatchNamespace string` The dispatch namespace the Durable Object script belongs to. - `Environment string` The environment of the script_name to bind to. - `NamespaceID string` Namespace identifier tag. - `ScriptName string` The script where the Durable Object is defined, if it is external to this Worker. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindHyperdrive struct{…}` - `ID string` Identifier of the Hyperdrive connection to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindHyperdriveType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindHyperdriveTypeHyperdrive DispatchNamespaceScriptBindingGetResponseWorkersBindingKindHyperdriveType = "hyperdrive"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindInherit struct{…}` - `Name string` The name of the inherited binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindInheritType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindInheritTypeInherit DispatchNamespaceScriptBindingGetResponseWorkersBindingKindInheritType = "inherit"` - `OldName string` The old name of the inherited binding. If set, the binding will be renamed from `old_name` to `name` in the new version. If not set, the binding will keep the same name between versions. - `VersionID string` Identifier for the version to inherit the binding from, which can be the version ID or the literal "latest" to inherit from the latest version. Defaults to inheriting the binding from the latest version. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindImages struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindImagesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindImagesTypeImages DispatchNamespaceScriptBindingGetResponseWorkersBindingKindImagesType = "images"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindJson struct{…}` - `Json unknown` JSON data to use. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindJsonType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindJsonTypeJson DispatchNamespaceScriptBindingGetResponseWorkersBindingKindJsonType = "json"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindKVNamespace struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Namespace identifier tag. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindKVNamespaceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindKVNamespaceTypeKVNamespace DispatchNamespaceScriptBindingGetResponseWorkersBindingKindKVNamespaceType = "kv_namespace"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMedia struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMediaType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMediaTypeMedia DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMediaType = "media"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMTLSCertificate struct{…}` - `CertificateID string` Identifier of the certificate to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMTLSCertificateType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMTLSCertificateTypeMTLSCertificate DispatchNamespaceScriptBindingGetResponseWorkersBindingKindMTLSCertificateType = "mtls_certificate"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPlainText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The text value to use. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPlainTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPlainTextTypePlainText DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPlainTextType = "plain_text"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPipelines struct{…}` - `Name string` A JavaScript variable name for the binding. - `Pipeline string` Name of the Pipeline to bind to. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPipelinesType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPipelinesTypePipelines DispatchNamespaceScriptBindingGetResponseWorkersBindingKindPipelinesType = "pipelines"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindQueue struct{…}` - `Name string` A JavaScript variable name for the binding. - `QueueName string` Name of the Queue to bind to. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindQueueType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindQueueTypeQueue DispatchNamespaceScriptBindingGetResponseWorkersBindingKindQueueType = "queue"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimit struct{…}` - `Name string` A JavaScript variable name for the binding. - `NamespaceID string` Identifier of the rate limit namespace to bind to. - `Simple DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimitSimple` The rate limit configuration. - `Limit float64` The limit (requests per period). - `Period int64` The period in seconds. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimitType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimitTypeRatelimit DispatchNamespaceScriptBindingGetResponseWorkersBindingKindRatelimitType = "ratelimit"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2Bucket struct{…}` - `BucketName string` R2 bucket to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketTypeR2Bucket DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketType = "r2_bucket"` - `Jurisdiction DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction` The [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions) of the R2 bucket. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionEu DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction = "eu"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionFedramp DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction = "fedramp"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdictionFedrampHigh DispatchNamespaceScriptBindingGetResponseWorkersBindingKindR2BucketJurisdiction = "fedramp-high"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSendEmail struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSendEmailType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSendEmailTypeSendEmail DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSendEmailType = "send_email"` - `AllowedDestinationAddresses []string` List of allowed destination addresses. - `AllowedSenderAddresses []string` List of allowed sender addresses. - `DestinationAddress string` Destination address for the email. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindService struct{…}` - `Name string` A JavaScript variable name for the binding. - `Service string` Name of Worker to bind to. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindServiceTypeService DispatchNamespaceScriptBindingGetResponseWorkersBindingKindServiceType = "service"` - `Entrypoint string` Entrypoint to invoke on the target Worker. - `Environment string` Optional environment if the Worker utilizes one. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindTextBlob struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the text content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindTextBlobType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindTextBlobTypeTextBlob DispatchNamespaceScriptBindingGetResponseWorkersBindingKindTextBlobType = "text_blob"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVectorize struct{…}` - `IndexName string` Name of the Vectorize index to bind to. - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVectorizeType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVectorizeTypeVectorize DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVectorizeType = "vectorize"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVersionMetadata struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVersionMetadataType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVersionMetadataTypeVersionMetadata DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVersionMetadataType = "version_metadata"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretsStoreSecret struct{…}` - `Name string` A JavaScript variable name for the binding. - `SecretName string` Name of the secret in the store. - `StoreID string` ID of the store containing the secret. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretsStoreSecretType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretsStoreSecretTypeSecretsStoreSecret DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretsStoreSecretType = "secrets_store_secret"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptBindingGetResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWorkflow struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWorkflowType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWorkflowTypeWorkflow DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWorkflowType = "workflow"` - `WorkflowName string` Name of the Workflow to bind to. - `ClassName string` Class name of the Workflow. Should only be provided if the Workflow belongs to this script. - `ScriptName string` Script name that contains the Workflow. If not provided, defaults to this script name. - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWasmModule struct{…}` - `Name string` A JavaScript variable name for the binding. - `Part string` The name of the file containing the WebAssembly module content. Only accepted for `service worker syntax` Workers. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWasmModuleType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWasmModuleTypeWasmModule DispatchNamespaceScriptBindingGetResponseWorkersBindingKindWasmModuleType = "wasm_module"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCService struct{…}` - `Name string` A JavaScript variable name for the binding. - `ServiceID string` Identifier of the VPC service to bind to. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCServiceType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCServiceTypeVPCService DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCServiceType = "vpc_service"` - `type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCNetwork struct{…}` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCNetworkType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCNetworkTypeVPCNetwork DispatchNamespaceScriptBindingGetResponseWorkersBindingKindVPCNetworkType = "vpc_network"` - `NetworkID string` Identifier of the network to bind to. Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id. - `TunnelID string` UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Bindings.Get( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptBindingGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "name": "MY_ENV_VAR", "text": "my_data", "type": "plain_text" } ], "success": true } ``` # Secrets ## List Script Secrets `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.List(ctx, dispatchNamespace, scriptName, query) (*SinglePage[DispatchNamespaceScriptSecretListResponse], error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets` List secrets bound to a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `query DispatchNamespaceScriptSecretListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceScriptSecretListResponse interface{…}` A secret value accessible through a binding. - `type DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptSecretListResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.List( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptSecretListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "name": "myBinding", "type": "secret_text" } ], "success": true } ``` ## Get secret binding `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Get(ctx, dispatchNamespace, scriptName, secretName, params) (*DispatchNamespaceScriptSecretGetResponse, error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}` Get a given secret binding (value omitted) on a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `secretName string` A JavaScript variable name for the secret binding. - `params DispatchNamespaceScriptSecretGetParams` - `AccountID param.Field[string]` Path param: Identifier. - `URLEncoded param.Field[bool]` Query param: Flag that indicates whether the secret name is URL encoded. ### Returns - `type DispatchNamespaceScriptSecretGetResponse interface{…}` A secret value accessible through a binding. - `type DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptSecretGetResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) secret, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Get( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", "mySecret", workers_for_platforms.DispatchNamespaceScriptSecretGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", secret) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "name": "myBinding", "type": "secret_text" }, "success": true } ``` ## Add script secret `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Update(ctx, dispatchNamespace, scriptName, params) (*DispatchNamespaceScriptSecretUpdateResponse, error)` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets` Add a secret to a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptSecretUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: A JavaScript variable name for the binding. - `Text param.Field[string]` Body param: The secret value to use. - `Type param.Field[DispatchNamespaceScriptSecretUpdateParamsWorkersBindingKindSecretTextType]` Body param: The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretUpdateParamsWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSecretUpdateParamsWorkersBindingKindSecretTextType = "secret_text"` ### Returns - `type DispatchNamespaceScriptSecretUpdateResponse interface{…}` A secret value accessible through a binding. - `type DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretText struct{…}` - `Name string` A JavaScript variable name for the binding. - `Text string` The secret value to use. - `Type DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretTextType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretTextTypeSecretText DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretTextType = "secret_text"` - `type DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKey struct{…}` - `Algorithm unknown` Algorithm-specific key parameters. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). - `Format DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat` Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatRaw DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "raw"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatPkcs8 DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "pkcs8"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatSpki DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "spki"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormatJwk DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyFormat = "jwk"` - `Name string` A JavaScript variable name for the binding. - `Type DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyType` The kind of resource that the binding provides. - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyTypeSecretKey DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyType = "secret_key"` - `Usages []DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage` Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageEncrypt DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "encrypt"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDecrypt DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "decrypt"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageSign DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "sign"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageVerify DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "verify"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDeriveKey DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "deriveKey"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageDeriveBits DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "deriveBits"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageWrapKey DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "wrapKey"` - `const DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsageUnwrapKey DispatchNamespaceScriptSecretUpdateResponseWorkersBindingKindSecretKeyUsage = "unwrapKey"` - `KeyBase64 string` Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". - `KeyJwk unknown` Key data in [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) format. Required if `format` is "jwk". ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) secret, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Update( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptSecretUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: workers_for_platforms.DispatchNamespaceScriptSecretUpdateParamsBodyWorkersBindingKindSecretText{ Name: cloudflare.F("myBinding"), Text: cloudflare.F("My secret."), Type: cloudflare.F(workers_for_platforms.DispatchNamespaceScriptSecretUpdateParamsBodyWorkersBindingKindSecretTextTypeSecretText), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", secret) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "name": "myBinding", "type": "secret_text" }, "success": true } ``` ## Delete script secret `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Delete(ctx, dispatchNamespace, scriptName, secretName, params) (*DispatchNamespaceScriptSecretDeleteResponse, error)` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets/{secret_name}` Remove a secret from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `secretName string` A JavaScript variable name for the secret binding. - `params DispatchNamespaceScriptSecretDeleteParams` - `AccountID param.Field[string]` Path param: Identifier. - `URLEncoded param.Field[bool]` Query param: Flag that indicates whether the secret name is URL encoded. ### Returns - `type DispatchNamespaceScriptSecretDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) secret, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Delete( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", "mySecret", workers_for_platforms.DispatchNamespaceScriptSecretDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", secret) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` # Tags ## Get Script Tags `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.List(ctx, dispatchNamespace, scriptName, query) (*SinglePage[string], error)` **get** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags` Fetch tags from a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `query DispatchNamespaceScriptTagListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceScriptTagListResponseEnvelopeResult string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.List( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptTagListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ "free", "customer" ] } ``` ## Put Script Tags `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Update(ctx, dispatchNamespace, scriptName, params) (*SinglePage[string], error)` **put** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags` Put script tags for a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `params DispatchNamespaceScriptTagUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `Body param.Field[[]string]` Body param: Tags associated with the Worker. ### Returns - `type DispatchNamespaceScriptTagUpdateResponseEnvelopeResult string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Update( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptTagUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: []string{"my-team", "my-public-api"}, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ "my-tag" ], "success": true } ``` ## Delete Script Tag `client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Delete(ctx, dispatchNamespace, scriptName, tag, body) (*DispatchNamespaceScriptTagDeleteResponse, error)` **delete** `/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags/{tag}` Delete script tag for a script uploaded to a Workers for Platforms namespace. ### Parameters - `dispatchNamespace string` Name of the Workers for Platforms dispatch namespace. - `scriptName string` Name of the script, used in URLs and route configuration. - `tag string` - `body DispatchNamespaceScriptTagDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DispatchNamespaceScriptTagDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) tag, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Tags.Delete( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", "my-tag", workers_for_platforms.DispatchNamespaceScriptTagDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", tag) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ```