Class WorkerRoute
Provides a Cloudflare worker route resource. A route will also require a cloudflare..WorkerScript. NOTE: This resource uses the Cloudflare account APIs. This requires setting the CLOUDFLARE_ACCOUNT_ID environment variable or account_id provider argument.
Example Usage
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
class MyStack : Stack
{
public MyStack()
{
var myScript = new Cloudflare.WorkerScript("myScript", new Cloudflare.WorkerScriptArgs
{
});
// see "cloudflare..WorkerScript" documentation ...
// Runs the specified worker script for all URLs that match `example.com/*`
var myRoute = new Cloudflare.WorkerRoute("myRoute", new Cloudflare.WorkerRouteArgs
{
ZoneId = "d41d8cd98f00b204e9800998ecf8427e",
Pattern = "example.com/*",
ScriptName = myScript.Name,
});
}
}
Inherited Members
Namespace: Pulumi.Cloudflare
Assembly: Pulumi.Cloudflare.dll
Syntax
public class WorkerRoute : CustomResource
Constructors
View SourceWorkerRoute(String, WorkerRouteArgs, CustomResourceOptions)
Create a WorkerRoute resource with the given unique name, arguments, and options.
Declaration
public WorkerRoute(string name, WorkerRouteArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| WorkerRouteArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourcePattern
The route pattern
Declaration
public Output<string> Pattern { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ScriptName
Which worker script to run for requests that match the route pattern. If script_name is empty, workers will be skipped for matching requests.
Declaration
public Output<string> ScriptName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ZoneId
The zone ID to add the route to.
Declaration
public Output<string> ZoneId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, WorkerRouteState, CustomResourceOptions)
Get an existing WorkerRoute resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static WorkerRoute Get(string name, Input<string> id, WorkerRouteState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| WorkerRouteState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| WorkerRoute |