1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. ContentScanningExpression
Cloudflare v5.47.0 published on Wednesday, Jan 8, 2025 by Pulumi

cloudflare.ContentScanningExpression

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.47.0 published on Wednesday, Jan 8, 2025 by Pulumi

    Provides a Cloudflare Content Scanning Expression resource for managing custom scan expression within a specific zone.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    // Enable Content Scanning before trying to add custom scan expressions
    const example = new cloudflare.ContentScanning("example", {
        zoneId: "399c6f4950c01a5a141b99ff7fbcbd8b",
        enabled: true,
    });
    const firstExample = new cloudflare.ContentScanningExpression("first_example", {
        zoneId: example.zoneId,
        payload: "lookup_json_string(http.request.body.raw, \"file\")",
    });
    const secondExample = new cloudflare.ContentScanningExpression("second_example", {
        zoneId: example.zoneId,
        payload: "lookup_json_string(http.request.body.raw, \"document\")",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    # Enable Content Scanning before trying to add custom scan expressions
    example = cloudflare.ContentScanning("example",
        zone_id="399c6f4950c01a5a141b99ff7fbcbd8b",
        enabled=True)
    first_example = cloudflare.ContentScanningExpression("first_example",
        zone_id=example.zone_id,
        payload="lookup_json_string(http.request.body.raw, \"file\")")
    second_example = cloudflare.ContentScanningExpression("second_example",
        zone_id=example.zone_id,
        payload="lookup_json_string(http.request.body.raw, \"document\")")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Enable Content Scanning before trying to add custom scan expressions
    		example, err := cloudflare.NewContentScanning(ctx, "example", &cloudflare.ContentScanningArgs{
    			ZoneId:  pulumi.String("399c6f4950c01a5a141b99ff7fbcbd8b"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cloudflare.NewContentScanningExpression(ctx, "first_example", &cloudflare.ContentScanningExpressionArgs{
    			ZoneId:  example.ZoneId,
    			Payload: pulumi.String("lookup_json_string(http.request.body.raw, \"file\")"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cloudflare.NewContentScanningExpression(ctx, "second_example", &cloudflare.ContentScanningExpressionArgs{
    			ZoneId:  example.ZoneId,
    			Payload: pulumi.String("lookup_json_string(http.request.body.raw, \"document\")"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        // Enable Content Scanning before trying to add custom scan expressions
        var example = new Cloudflare.ContentScanning("example", new()
        {
            ZoneId = "399c6f4950c01a5a141b99ff7fbcbd8b",
            Enabled = true,
        });
    
        var firstExample = new Cloudflare.ContentScanningExpression("first_example", new()
        {
            ZoneId = example.ZoneId,
            Payload = "lookup_json_string(http.request.body.raw, \"file\")",
        });
    
        var secondExample = new Cloudflare.ContentScanningExpression("second_example", new()
        {
            ZoneId = example.ZoneId,
            Payload = "lookup_json_string(http.request.body.raw, \"document\")",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.ContentScanning;
    import com.pulumi.cloudflare.ContentScanningArgs;
    import com.pulumi.cloudflare.ContentScanningExpression;
    import com.pulumi.cloudflare.ContentScanningExpressionArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            // Enable Content Scanning before trying to add custom scan expressions
            var example = new ContentScanning("example", ContentScanningArgs.builder()
                .zoneId("399c6f4950c01a5a141b99ff7fbcbd8b")
                .enabled(true)
                .build());
    
            var firstExample = new ContentScanningExpression("firstExample", ContentScanningExpressionArgs.builder()
                .zoneId(example.zoneId())
                .payload("lookup_json_string(http.request.body.raw, \"file\")")
                .build());
    
            var secondExample = new ContentScanningExpression("secondExample", ContentScanningExpressionArgs.builder()
                .zoneId(example.zoneId())
                .payload("lookup_json_string(http.request.body.raw, \"document\")")
                .build());
    
        }
    }
    
    resources:
      # Enable Content Scanning before trying to add custom scan expressions
      example:
        type: cloudflare:ContentScanning
        properties:
          zoneId: 399c6f4950c01a5a141b99ff7fbcbd8b
          enabled: true
      firstExample:
        type: cloudflare:ContentScanningExpression
        name: first_example
        properties:
          zoneId: ${example.zoneId}
          payload: lookup_json_string(http.request.body.raw, "file")
      secondExample:
        type: cloudflare:ContentScanningExpression
        name: second_example
        properties:
          zoneId: ${example.zoneId}
          payload: lookup_json_string(http.request.body.raw, "document")
    

    Create ContentScanningExpression Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ContentScanningExpression(name: string, args: ContentScanningExpressionArgs, opts?: CustomResourceOptions);
    @overload
    def ContentScanningExpression(resource_name: str,
                                  args: ContentScanningExpressionArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def ContentScanningExpression(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  payload: Optional[str] = None,
                                  zone_id: Optional[str] = None)
    func NewContentScanningExpression(ctx *Context, name string, args ContentScanningExpressionArgs, opts ...ResourceOption) (*ContentScanningExpression, error)
    public ContentScanningExpression(string name, ContentScanningExpressionArgs args, CustomResourceOptions? opts = null)
    public ContentScanningExpression(String name, ContentScanningExpressionArgs args)
    public ContentScanningExpression(String name, ContentScanningExpressionArgs args, CustomResourceOptions options)
    
    type: cloudflare:ContentScanningExpression
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ContentScanningExpressionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ContentScanningExpressionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ContentScanningExpressionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ContentScanningExpressionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ContentScanningExpressionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var contentScanningExpressionResource = new Cloudflare.ContentScanningExpression("contentScanningExpressionResource", new()
    {
        Payload = "string",
        ZoneId = "string",
    });
    
    example, err := cloudflare.NewContentScanningExpression(ctx, "contentScanningExpressionResource", &cloudflare.ContentScanningExpressionArgs{
    	Payload: pulumi.String("string"),
    	ZoneId:  pulumi.String("string"),
    })
    
    var contentScanningExpressionResource = new ContentScanningExpression("contentScanningExpressionResource", ContentScanningExpressionArgs.builder()
        .payload("string")
        .zoneId("string")
        .build());
    
    content_scanning_expression_resource = cloudflare.ContentScanningExpression("contentScanningExpressionResource",
        payload="string",
        zone_id="string")
    
    const contentScanningExpressionResource = new cloudflare.ContentScanningExpression("contentScanningExpressionResource", {
        payload: "string",
        zoneId: "string",
    });
    
    type: cloudflare:ContentScanningExpression
    properties:
        payload: string
        zoneId: string
    

    ContentScanningExpression Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ContentScanningExpression resource accepts the following input properties:

    Payload string
    Custom scan expression to tell the content scanner where to find the content objects.
    ZoneId string
    The zone identifier to target for the resource.
    Payload string
    Custom scan expression to tell the content scanner where to find the content objects.
    ZoneId string
    The zone identifier to target for the resource.
    payload String
    Custom scan expression to tell the content scanner where to find the content objects.
    zoneId String
    The zone identifier to target for the resource.
    payload string
    Custom scan expression to tell the content scanner where to find the content objects.
    zoneId string
    The zone identifier to target for the resource.
    payload str
    Custom scan expression to tell the content scanner where to find the content objects.
    zone_id str
    The zone identifier to target for the resource.
    payload String
    Custom scan expression to tell the content scanner where to find the content objects.
    zoneId String
    The zone identifier to target for the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ContentScanningExpression resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ContentScanningExpression Resource

    Get an existing ContentScanningExpression resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ContentScanningExpressionState, opts?: CustomResourceOptions): ContentScanningExpression
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            payload: Optional[str] = None,
            zone_id: Optional[str] = None) -> ContentScanningExpression
    func GetContentScanningExpression(ctx *Context, name string, id IDInput, state *ContentScanningExpressionState, opts ...ResourceOption) (*ContentScanningExpression, error)
    public static ContentScanningExpression Get(string name, Input<string> id, ContentScanningExpressionState? state, CustomResourceOptions? opts = null)
    public static ContentScanningExpression get(String name, Output<String> id, ContentScanningExpressionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Payload string
    Custom scan expression to tell the content scanner where to find the content objects.
    ZoneId string
    The zone identifier to target for the resource.
    Payload string
    Custom scan expression to tell the content scanner where to find the content objects.
    ZoneId string
    The zone identifier to target for the resource.
    payload String
    Custom scan expression to tell the content scanner where to find the content objects.
    zoneId String
    The zone identifier to target for the resource.
    payload string
    Custom scan expression to tell the content scanner where to find the content objects.
    zoneId string
    The zone identifier to target for the resource.
    payload str
    Custom scan expression to tell the content scanner where to find the content objects.
    zone_id str
    The zone identifier to target for the resource.
    payload String
    Custom scan expression to tell the content scanner where to find the content objects.
    zoneId String
    The zone identifier to target for the resource.

    Import

    $ pulumi import cloudflare:index/contentScanningExpression:ContentScanningExpression example <zone_id>/<resource_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.47.0 published on Wednesday, Jan 8, 2025 by Pulumi