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

newrelic.NrqlDropRule

Explore with Pulumi AI

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = new newrelic.NrqlDropRule("foo", {
        accountId: "12345",
        description: "Drops all data for MyCustomEvent that comes from the LoadGeneratingApp in the dev environment, because there is too much and we don’t look at it.",
        action: "drop_data",
        nrql: "SELECT * FROM MyCustomEvent WHERE appName='LoadGeneratingApp' AND environment='development'",
    });
    const bar = new newrelic.NrqlDropRule("bar", {
        accountId: "12345",
        description: "Removes the user name and email fields from MyCustomEvent",
        action: "drop_attributes",
        nrql: "SELECT userEmail, userName FROM MyCustomEvent",
    });
    const baz = new newrelic.NrqlDropRule("baz", {
        accountId: "12345",
        description: "Removes containerId from metric aggregates to reduce metric cardinality.",
        action: "drop_attributes_from_metric_aggregates",
        nrql: "SELECT containerId FROM Metric",
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.NrqlDropRule("foo",
        account_id="12345",
        description="Drops all data for MyCustomEvent that comes from the LoadGeneratingApp in the dev environment, because there is too much and we don’t look at it.",
        action="drop_data",
        nrql="SELECT * FROM MyCustomEvent WHERE appName='LoadGeneratingApp' AND environment='development'")
    bar = newrelic.NrqlDropRule("bar",
        account_id="12345",
        description="Removes the user name and email fields from MyCustomEvent",
        action="drop_attributes",
        nrql="SELECT userEmail, userName FROM MyCustomEvent")
    baz = newrelic.NrqlDropRule("baz",
        account_id="12345",
        description="Removes containerId from metric aggregates to reduce metric cardinality.",
        action="drop_attributes_from_metric_aggregates",
        nrql="SELECT containerId FROM Metric")
    
    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 {
    		_, err := newrelic.NewNrqlDropRule(ctx, "foo", &newrelic.NrqlDropRuleArgs{
    			AccountId:   pulumi.String("12345"),
    			Description: pulumi.String("Drops all data for MyCustomEvent that comes from the LoadGeneratingApp in the dev environment, because there is too much and we don’t look at it."),
    			Action:      pulumi.String("drop_data"),
    			Nrql:        pulumi.String("SELECT * FROM MyCustomEvent WHERE appName='LoadGeneratingApp' AND environment='development'"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewNrqlDropRule(ctx, "bar", &newrelic.NrqlDropRuleArgs{
    			AccountId:   pulumi.String("12345"),
    			Description: pulumi.String("Removes the user name and email fields from MyCustomEvent"),
    			Action:      pulumi.String("drop_attributes"),
    			Nrql:        pulumi.String("SELECT userEmail, userName FROM MyCustomEvent"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewNrqlDropRule(ctx, "baz", &newrelic.NrqlDropRuleArgs{
    			AccountId:   pulumi.String("12345"),
    			Description: pulumi.String("Removes containerId from metric aggregates to reduce metric cardinality."),
    			Action:      pulumi.String("drop_attributes_from_metric_aggregates"),
    			Nrql:        pulumi.String("SELECT containerId FROM Metric"),
    		})
    		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 foo = new NewRelic.NrqlDropRule("foo", new()
        {
            AccountId = "12345",
            Description = "Drops all data for MyCustomEvent that comes from the LoadGeneratingApp in the dev environment, because there is too much and we don’t look at it.",
            Action = "drop_data",
            Nrql = "SELECT * FROM MyCustomEvent WHERE appName='LoadGeneratingApp' AND environment='development'",
        });
    
        var bar = new NewRelic.NrqlDropRule("bar", new()
        {
            AccountId = "12345",
            Description = "Removes the user name and email fields from MyCustomEvent",
            Action = "drop_attributes",
            Nrql = "SELECT userEmail, userName FROM MyCustomEvent",
        });
    
        var baz = new NewRelic.NrqlDropRule("baz", new()
        {
            AccountId = "12345",
            Description = "Removes containerId from metric aggregates to reduce metric cardinality.",
            Action = "drop_attributes_from_metric_aggregates",
            Nrql = "SELECT containerId FROM Metric",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NrqlDropRule;
    import com.pulumi.newrelic.NrqlDropRuleArgs;
    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 foo = new NrqlDropRule("foo", NrqlDropRuleArgs.builder()
                .accountId(12345)
                .description("Drops all data for MyCustomEvent that comes from the LoadGeneratingApp in the dev environment, because there is too much and we don’t look at it.")
                .action("drop_data")
                .nrql("SELECT * FROM MyCustomEvent WHERE appName='LoadGeneratingApp' AND environment='development'")
                .build());
    
            var bar = new NrqlDropRule("bar", NrqlDropRuleArgs.builder()
                .accountId(12345)
                .description("Removes the user name and email fields from MyCustomEvent")
                .action("drop_attributes")
                .nrql("SELECT userEmail, userName FROM MyCustomEvent")
                .build());
    
            var baz = new NrqlDropRule("baz", NrqlDropRuleArgs.builder()
                .accountId(12345)
                .description("Removes containerId from metric aggregates to reduce metric cardinality.")
                .action("drop_attributes_from_metric_aggregates")
                .nrql("SELECT containerId FROM Metric")
                .build());
    
        }
    }
    
    resources:
      foo:
        type: newrelic:NrqlDropRule
        properties:
          accountId: 12345
          description: Drops all data for MyCustomEvent that comes from the LoadGeneratingApp in the dev environment, because there is too much and we don’t look at it.
          action: drop_data
          nrql: SELECT * FROM MyCustomEvent WHERE appName='LoadGeneratingApp' AND environment='development'
      bar:
        type: newrelic:NrqlDropRule
        properties:
          accountId: 12345
          description: Removes the user name and email fields from MyCustomEvent
          action: drop_attributes
          nrql: SELECT userEmail, userName FROM MyCustomEvent
      baz:
        type: newrelic:NrqlDropRule
        properties:
          accountId: 12345
          description: Removes containerId from metric aggregates to reduce metric cardinality.
          action: drop_attributes_from_metric_aggregates
          nrql: SELECT containerId FROM Metric
    

    Using newrelic-cli to List Out Drop Rules

    All NRQL Drop Rules associated with a New Relic account may be listed out using the following newrelic-cli command:

    newrelic nrql droprules
    

    This would print all drop rules associated with your New Relic account to the terminal. The number of rules to be printed can be customized using the limit argument of this command. For instance, the following command limits the number of drop rules printed to two.

    newrelic nrql droprules --limit 2
    

    More details on the command and its arguments (for instance, the format in which the droprules are to be listed in the terminal, which is JSON by default) can be found in the output of the newrelic nrql droprules --help command. If you do not have newrelic-cli installed on your device already, head over to this page for instructions.

    Create NrqlDropRule Resource

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

    Constructor syntax

    new NrqlDropRule(name: string, args: NrqlDropRuleArgs, opts?: CustomResourceOptions);
    @overload
    def NrqlDropRule(resource_name: str,
                     args: NrqlDropRuleArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def NrqlDropRule(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     action: Optional[str] = None,
                     nrql: Optional[str] = None,
                     account_id: Optional[str] = None,
                     description: Optional[str] = None)
    func NewNrqlDropRule(ctx *Context, name string, args NrqlDropRuleArgs, opts ...ResourceOption) (*NrqlDropRule, error)
    public NrqlDropRule(string name, NrqlDropRuleArgs args, CustomResourceOptions? opts = null)
    public NrqlDropRule(String name, NrqlDropRuleArgs args)
    public NrqlDropRule(String name, NrqlDropRuleArgs args, CustomResourceOptions options)
    
    type: newrelic:NrqlDropRule
    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 NrqlDropRuleArgs
    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 NrqlDropRuleArgs
    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 NrqlDropRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NrqlDropRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NrqlDropRuleArgs
    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 nrqlDropRuleResource = new NewRelic.NrqlDropRule("nrqlDropRuleResource", new()
    {
        Action = "string",
        Nrql = "string",
        AccountId = "string",
        Description = "string",
    });
    
    example, err := newrelic.NewNrqlDropRule(ctx, "nrqlDropRuleResource", &newrelic.NrqlDropRuleArgs{
    	Action:      pulumi.String("string"),
    	Nrql:        pulumi.String("string"),
    	AccountId:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    })
    
    var nrqlDropRuleResource = new NrqlDropRule("nrqlDropRuleResource", NrqlDropRuleArgs.builder()
        .action("string")
        .nrql("string")
        .accountId("string")
        .description("string")
        .build());
    
    nrql_drop_rule_resource = newrelic.NrqlDropRule("nrqlDropRuleResource",
        action="string",
        nrql="string",
        account_id="string",
        description="string")
    
    const nrqlDropRuleResource = new newrelic.NrqlDropRule("nrqlDropRuleResource", {
        action: "string",
        nrql: "string",
        accountId: "string",
        description: "string",
    });
    
    type: newrelic:NrqlDropRule
    properties:
        accountId: string
        action: string
        description: string
        nrql: string
    

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

    Action string
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    Nrql string
    A NRQL string that specifies what data types to drop.
    AccountId string
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    Description string
    The description of the drop rule.
    Action string
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    Nrql string
    A NRQL string that specifies what data types to drop.
    AccountId string
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    Description string
    The description of the drop rule.
    action String
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    nrql String
    A NRQL string that specifies what data types to drop.
    accountId String
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    description String
    The description of the drop rule.
    action string
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    nrql string
    A NRQL string that specifies what data types to drop.
    accountId string
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    description string
    The description of the drop rule.
    action str
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    nrql str
    A NRQL string that specifies what data types to drop.
    account_id str
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    description str
    The description of the drop rule.
    action String
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    nrql String
    A NRQL string that specifies what data types to drop.
    accountId String
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    description String
    The description of the drop rule.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId string
    The id, uniquely identifying the rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId string
    The id, uniquely identifying the rule.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId String
    The id, uniquely identifying the rule.
    id string
    The provider-assigned unique ID for this managed resource.
    ruleId string
    The id, uniquely identifying the rule.
    id str
    The provider-assigned unique ID for this managed resource.
    rule_id str
    The id, uniquely identifying the rule.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId String
    The id, uniquely identifying the rule.

    Look up Existing NrqlDropRule Resource

    Get an existing NrqlDropRule 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?: NrqlDropRuleState, opts?: CustomResourceOptions): NrqlDropRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            action: Optional[str] = None,
            description: Optional[str] = None,
            nrql: Optional[str] = None,
            rule_id: Optional[str] = None) -> NrqlDropRule
    func GetNrqlDropRule(ctx *Context, name string, id IDInput, state *NrqlDropRuleState, opts ...ResourceOption) (*NrqlDropRule, error)
    public static NrqlDropRule Get(string name, Input<string> id, NrqlDropRuleState? state, CustomResourceOptions? opts = null)
    public static NrqlDropRule get(String name, Output<String> id, NrqlDropRuleState 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
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    Action string
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    Description string
    The description of the drop rule.
    Nrql string
    A NRQL string that specifies what data types to drop.
    RuleId string
    The id, uniquely identifying the rule.
    AccountId string
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    Action string
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    Description string
    The description of the drop rule.
    Nrql string
    A NRQL string that specifies what data types to drop.
    RuleId string
    The id, uniquely identifying the rule.
    accountId String
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    action String
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    description String
    The description of the drop rule.
    nrql String
    A NRQL string that specifies what data types to drop.
    ruleId String
    The id, uniquely identifying the rule.
    accountId string
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    action string
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    description string
    The description of the drop rule.
    nrql string
    A NRQL string that specifies what data types to drop.
    ruleId string
    The id, uniquely identifying the rule.
    account_id str
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    action str
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    description str
    The description of the drop rule.
    nrql str
    A NRQL string that specifies what data types to drop.
    rule_id str
    The id, uniquely identifying the rule.
    accountId String
    Account where the drop rule will be put. Defaults to the account associated with the API key used.
    action String
    An action type specifying how to apply the NRQL string (either drop_data, drop_attributes, or drop_attributes_from_metric_aggregates).
    description String
    The description of the drop rule.
    nrql String
    A NRQL string that specifies what data types to drop.
    ruleId String
    The id, uniquely identifying the rule.

    Import

    New Relic NRQL drop rules can be imported using a concatenated string of the format

    <account_id>:<rule_id>, e.g.

    bash

    $ pulumi import newrelic:index/nrqlDropRule:NrqlDropRule foo 12345: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