1. Packages
  2. New Relic
  3. API Docs
  4. ObfuscationRule
New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi

newrelic.ObfuscationRule

Explore with Pulumi AI

newrelic logo
New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi

    Use this resource to create, update and delete New Relic Obfuscation Rule.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const bar = new newrelic.ObfuscationExpression("bar", {
        name: "expressionName",
        description: "description of the expression",
        regex: "(^http)",
    });
    const foo = new newrelic.ObfuscationRule("foo", {
        name: "ruleName",
        description: "description of the rule",
        filter: "hostStatus=running",
        enabled: true,
        actions: [{
            attributes: ["message"],
            expressionId: bar.id,
            method: "MASK",
        }],
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    bar = newrelic.ObfuscationExpression("bar",
        name="expressionName",
        description="description of the expression",
        regex="(^http)")
    foo = newrelic.ObfuscationRule("foo",
        name="ruleName",
        description="description of the rule",
        filter="hostStatus=running",
        enabled=True,
        actions=[{
            "attributes": ["message"],
            "expression_id": bar.id,
            "method": "MASK",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		bar, err := newrelic.NewObfuscationExpression(ctx, "bar", &newrelic.ObfuscationExpressionArgs{
    			Name:        pulumi.String("expressionName"),
    			Description: pulumi.String("description of the expression"),
    			Regex:       pulumi.String("(^http)"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewObfuscationRule(ctx, "foo", &newrelic.ObfuscationRuleArgs{
    			Name:        pulumi.String("ruleName"),
    			Description: pulumi.String("description of the rule"),
    			Filter:      pulumi.String("hostStatus=running"),
    			Enabled:     pulumi.Bool(true),
    			Actions: newrelic.ObfuscationRuleActionArray{
    				&newrelic.ObfuscationRuleActionArgs{
    					Attributes: pulumi.StringArray{
    						pulumi.String("message"),
    					},
    					ExpressionId: bar.ID(),
    					Method:       pulumi.String("MASK"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var bar = new NewRelic.ObfuscationExpression("bar", new()
        {
            Name = "expressionName",
            Description = "description of the expression",
            Regex = "(^http)",
        });
    
        var foo = new NewRelic.ObfuscationRule("foo", new()
        {
            Name = "ruleName",
            Description = "description of the rule",
            Filter = "hostStatus=running",
            Enabled = true,
            Actions = new[]
            {
                new NewRelic.Inputs.ObfuscationRuleActionArgs
                {
                    Attributes = new[]
                    {
                        "message",
                    },
                    ExpressionId = bar.Id,
                    Method = "MASK",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.ObfuscationExpression;
    import com.pulumi.newrelic.ObfuscationExpressionArgs;
    import com.pulumi.newrelic.ObfuscationRule;
    import com.pulumi.newrelic.ObfuscationRuleArgs;
    import com.pulumi.newrelic.inputs.ObfuscationRuleActionArgs;
    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) {
            var bar = new ObfuscationExpression("bar", ObfuscationExpressionArgs.builder()
                .name("expressionName")
                .description("description of the expression")
                .regex("(^http)")
                .build());
    
            var foo = new ObfuscationRule("foo", ObfuscationRuleArgs.builder()
                .name("ruleName")
                .description("description of the rule")
                .filter("hostStatus=running")
                .enabled(true)
                .actions(ObfuscationRuleActionArgs.builder()
                    .attributes("message")
                    .expressionId(bar.id())
                    .method("MASK")
                    .build())
                .build());
    
        }
    }
    
    resources:
      bar:
        type: newrelic:ObfuscationExpression
        properties:
          name: expressionName
          description: description of the expression
          regex: (^http)
      foo:
        type: newrelic:ObfuscationRule
        properties:
          name: ruleName
          description: description of the rule
          filter: hostStatus=running
          enabled: true
          actions:
            - attributes:
                - message
              expressionId: ${bar.id}
              method: MASK
    

    Create ObfuscationRule Resource

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

    Constructor syntax

    new ObfuscationRule(name: string, args: ObfuscationRuleArgs, opts?: CustomResourceOptions);
    @overload
    def ObfuscationRule(resource_name: str,
                        args: ObfuscationRuleArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ObfuscationRule(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        actions: Optional[Sequence[ObfuscationRuleActionArgs]] = None,
                        enabled: Optional[bool] = None,
                        filter: Optional[str] = None,
                        account_id: Optional[str] = None,
                        description: Optional[str] = None,
                        name: Optional[str] = None)
    func NewObfuscationRule(ctx *Context, name string, args ObfuscationRuleArgs, opts ...ResourceOption) (*ObfuscationRule, error)
    public ObfuscationRule(string name, ObfuscationRuleArgs args, CustomResourceOptions? opts = null)
    public ObfuscationRule(String name, ObfuscationRuleArgs args)
    public ObfuscationRule(String name, ObfuscationRuleArgs args, CustomResourceOptions options)
    
    type: newrelic:ObfuscationRule
    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 ObfuscationRuleArgs
    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 ObfuscationRuleArgs
    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 ObfuscationRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ObfuscationRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ObfuscationRuleArgs
    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 obfuscationRuleResource = new NewRelic.ObfuscationRule("obfuscationRuleResource", new()
    {
        Actions = new[]
        {
            new NewRelic.Inputs.ObfuscationRuleActionArgs
            {
                Attributes = new[]
                {
                    "string",
                },
                ExpressionId = "string",
                Method = "string",
            },
        },
        Enabled = false,
        Filter = "string",
        AccountId = "string",
        Description = "string",
        Name = "string",
    });
    
    example, err := newrelic.NewObfuscationRule(ctx, "obfuscationRuleResource", &newrelic.ObfuscationRuleArgs{
    	Actions: newrelic.ObfuscationRuleActionArray{
    		&newrelic.ObfuscationRuleActionArgs{
    			Attributes: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			ExpressionId: pulumi.String("string"),
    			Method:       pulumi.String("string"),
    		},
    	},
    	Enabled:     pulumi.Bool(false),
    	Filter:      pulumi.String("string"),
    	AccountId:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var obfuscationRuleResource = new ObfuscationRule("obfuscationRuleResource", ObfuscationRuleArgs.builder()
        .actions(ObfuscationRuleActionArgs.builder()
            .attributes("string")
            .expressionId("string")
            .method("string")
            .build())
        .enabled(false)
        .filter("string")
        .accountId("string")
        .description("string")
        .name("string")
        .build());
    
    obfuscation_rule_resource = newrelic.ObfuscationRule("obfuscationRuleResource",
        actions=[{
            "attributes": ["string"],
            "expression_id": "string",
            "method": "string",
        }],
        enabled=False,
        filter="string",
        account_id="string",
        description="string",
        name="string")
    
    const obfuscationRuleResource = new newrelic.ObfuscationRule("obfuscationRuleResource", {
        actions: [{
            attributes: ["string"],
            expressionId: "string",
            method: "string",
        }],
        enabled: false,
        filter: "string",
        accountId: "string",
        description: "string",
        name: "string",
    });
    
    type: newrelic:ObfuscationRule
    properties:
        accountId: string
        actions:
            - attributes:
                - string
              expressionId: string
              method: string
        description: string
        enabled: false
        filter: string
        name: string
    

    ObfuscationRule 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 ObfuscationRule resource accepts the following input properties:

    Actions List<Pulumi.NewRelic.Inputs.ObfuscationRuleAction>
    Actions for the rule. The actions will be applied in the order specified by this list.
    Enabled bool
    Whether the rule should be applied or not to incoming data.
    Filter string
    NRQL for determining whether a given log record should have obfuscation actions applied.
    AccountId string
    The account id associated with the obfuscation rule.
    Description string
    Description of rule.
    Name string
    Name of rule.
    Actions []ObfuscationRuleActionArgs
    Actions for the rule. The actions will be applied in the order specified by this list.
    Enabled bool
    Whether the rule should be applied or not to incoming data.
    Filter string
    NRQL for determining whether a given log record should have obfuscation actions applied.
    AccountId string
    The account id associated with the obfuscation rule.
    Description string
    Description of rule.
    Name string
    Name of rule.
    actions List<ObfuscationRuleAction>
    Actions for the rule. The actions will be applied in the order specified by this list.
    enabled Boolean
    Whether the rule should be applied or not to incoming data.
    filter String
    NRQL for determining whether a given log record should have obfuscation actions applied.
    accountId String
    The account id associated with the obfuscation rule.
    description String
    Description of rule.
    name String
    Name of rule.
    actions ObfuscationRuleAction[]
    Actions for the rule. The actions will be applied in the order specified by this list.
    enabled boolean
    Whether the rule should be applied or not to incoming data.
    filter string
    NRQL for determining whether a given log record should have obfuscation actions applied.
    accountId string
    The account id associated with the obfuscation rule.
    description string
    Description of rule.
    name string
    Name of rule.
    actions Sequence[ObfuscationRuleActionArgs]
    Actions for the rule. The actions will be applied in the order specified by this list.
    enabled bool
    Whether the rule should be applied or not to incoming data.
    filter str
    NRQL for determining whether a given log record should have obfuscation actions applied.
    account_id str
    The account id associated with the obfuscation rule.
    description str
    Description of rule.
    name str
    Name of rule.
    actions List<Property Map>
    Actions for the rule. The actions will be applied in the order specified by this list.
    enabled Boolean
    Whether the rule should be applied or not to incoming data.
    filter String
    NRQL for determining whether a given log record should have obfuscation actions applied.
    accountId String
    The account id associated with the obfuscation rule.
    description String
    Description of rule.
    name String
    Name of rule.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ObfuscationRule 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 ObfuscationRule Resource

    Get an existing ObfuscationRule 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?: ObfuscationRuleState, opts?: CustomResourceOptions): ObfuscationRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            actions: Optional[Sequence[ObfuscationRuleActionArgs]] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            filter: Optional[str] = None,
            name: Optional[str] = None) -> ObfuscationRule
    func GetObfuscationRule(ctx *Context, name string, id IDInput, state *ObfuscationRuleState, opts ...ResourceOption) (*ObfuscationRule, error)
    public static ObfuscationRule Get(string name, Input<string> id, ObfuscationRuleState? state, CustomResourceOptions? opts = null)
    public static ObfuscationRule get(String name, Output<String> id, ObfuscationRuleState 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:
    AccountId string
    The account id associated with the obfuscation rule.
    Actions List<Pulumi.NewRelic.Inputs.ObfuscationRuleAction>
    Actions for the rule. The actions will be applied in the order specified by this list.
    Description string
    Description of rule.
    Enabled bool
    Whether the rule should be applied or not to incoming data.
    Filter string
    NRQL for determining whether a given log record should have obfuscation actions applied.
    Name string
    Name of rule.
    AccountId string
    The account id associated with the obfuscation rule.
    Actions []ObfuscationRuleActionArgs
    Actions for the rule. The actions will be applied in the order specified by this list.
    Description string
    Description of rule.
    Enabled bool
    Whether the rule should be applied or not to incoming data.
    Filter string
    NRQL for determining whether a given log record should have obfuscation actions applied.
    Name string
    Name of rule.
    accountId String
    The account id associated with the obfuscation rule.
    actions List<ObfuscationRuleAction>
    Actions for the rule. The actions will be applied in the order specified by this list.
    description String
    Description of rule.
    enabled Boolean
    Whether the rule should be applied or not to incoming data.
    filter String
    NRQL for determining whether a given log record should have obfuscation actions applied.
    name String
    Name of rule.
    accountId string
    The account id associated with the obfuscation rule.
    actions ObfuscationRuleAction[]
    Actions for the rule. The actions will be applied in the order specified by this list.
    description string
    Description of rule.
    enabled boolean
    Whether the rule should be applied or not to incoming data.
    filter string
    NRQL for determining whether a given log record should have obfuscation actions applied.
    name string
    Name of rule.
    account_id str
    The account id associated with the obfuscation rule.
    actions Sequence[ObfuscationRuleActionArgs]
    Actions for the rule. The actions will be applied in the order specified by this list.
    description str
    Description of rule.
    enabled bool
    Whether the rule should be applied or not to incoming data.
    filter str
    NRQL for determining whether a given log record should have obfuscation actions applied.
    name str
    Name of rule.
    accountId String
    The account id associated with the obfuscation rule.
    actions List<Property Map>
    Actions for the rule. The actions will be applied in the order specified by this list.
    description String
    Description of rule.
    enabled Boolean
    Whether the rule should be applied or not to incoming data.
    filter String
    NRQL for determining whether a given log record should have obfuscation actions applied.
    name String
    Name of rule.

    Supporting Types

    ObfuscationRuleAction, ObfuscationRuleActionArgs

    Attributes List<string>
    Attribute names for action. An empty list applies the action to all the attributes.
    ExpressionId string
    Expression Id for action.
    Method string
    Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.
    Attributes []string
    Attribute names for action. An empty list applies the action to all the attributes.
    ExpressionId string
    Expression Id for action.
    Method string
    Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.
    attributes List<String>
    Attribute names for action. An empty list applies the action to all the attributes.
    expressionId String
    Expression Id for action.
    method String
    Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.
    attributes string[]
    Attribute names for action. An empty list applies the action to all the attributes.
    expressionId string
    Expression Id for action.
    method string
    Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.
    attributes Sequence[str]
    Attribute names for action. An empty list applies the action to all the attributes.
    expression_id str
    Expression Id for action.
    method str
    Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.
    attributes List<String>
    Attribute names for action. An empty list applies the action to all the attributes.
    expressionId String
    Expression Id for action.
    method String
    Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

    Import

    New Relic obfuscation rule can be imported using the rule ID, e.g.

    bash

    $ pulumi import newrelic:index/obfuscationRule:ObfuscationRule foo 34567
    

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

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi