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

newrelic.EventsToMetricsRule

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 Events to Metrics rules.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = new newrelic.EventsToMetricsRule("foo", {
        accountId: "12345",
        name: "Example events to metrics rule",
        description: "Example description",
        nrql: "SELECT uniqueCount(account_id) AS ``Transaction.account_id`` FROM Transaction FACET appName, name",
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.EventsToMetricsRule("foo",
        account_id="12345",
        name="Example events to metrics rule",
        description="Example description",
        nrql="SELECT uniqueCount(account_id) AS ``Transaction.account_id`` FROM Transaction FACET appName, name")
    
    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.NewEventsToMetricsRule(ctx, "foo", &newrelic.EventsToMetricsRuleArgs{
    			AccountId:   pulumi.String("12345"),
    			Name:        pulumi.String("Example events to metrics rule"),
    			Description: pulumi.String("Example description"),
    			Nrql:        pulumi.String("SELECT uniqueCount(account_id) AS ``Transaction.account_id`` FROM Transaction FACET appName, name"),
    		})
    		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.EventsToMetricsRule("foo", new()
        {
            AccountId = "12345",
            Name = "Example events to metrics rule",
            Description = "Example description",
            Nrql = "SELECT uniqueCount(account_id) AS ``Transaction.account_id`` FROM Transaction FACET appName, name",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.EventsToMetricsRule;
    import com.pulumi.newrelic.EventsToMetricsRuleArgs;
    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 EventsToMetricsRule("foo", EventsToMetricsRuleArgs.builder()
                .accountId(12345)
                .name("Example events to metrics rule")
                .description("Example description")
                .nrql("SELECT uniqueCount(account_id) AS ``Transaction.account_id`` FROM Transaction FACET appName, name")
                .build());
    
        }
    }
    
    resources:
      foo:
        type: newrelic:EventsToMetricsRule
        properties:
          accountId: 12345
          name: Example events to metrics rule
          description: Example description
          nrql: SELECT uniqueCount(account_id) AS ``Transaction.account_id`` FROM Transaction FACET appName, name
    

    Create EventsToMetricsRule Resource

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

    Constructor syntax

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

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

    Nrql string
    Explains how to create metrics from events.
    AccountId string
    Account with the event and where the metrics will be put.
    Description string
    Provides additional information about the rule.
    Enabled bool
    True means this rule is enabled. False means the rule is currently not creating metrics.
    Name string
    The name of the rule. This must be unique within an account.
    Nrql string
    Explains how to create metrics from events.
    AccountId string
    Account with the event and where the metrics will be put.
    Description string
    Provides additional information about the rule.
    Enabled bool
    True means this rule is enabled. False means the rule is currently not creating metrics.
    Name string
    The name of the rule. This must be unique within an account.
    nrql String
    Explains how to create metrics from events.
    accountId String
    Account with the event and where the metrics will be put.
    description String
    Provides additional information about the rule.
    enabled Boolean
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name String
    The name of the rule. This must be unique within an account.
    nrql string
    Explains how to create metrics from events.
    accountId string
    Account with the event and where the metrics will be put.
    description string
    Provides additional information about the rule.
    enabled boolean
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name string
    The name of the rule. This must be unique within an account.
    nrql str
    Explains how to create metrics from events.
    account_id str
    Account with the event and where the metrics will be put.
    description str
    Provides additional information about the rule.
    enabled bool
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name str
    The name of the rule. This must be unique within an account.
    nrql String
    Explains how to create metrics from events.
    accountId String
    Account with the event and where the metrics will be put.
    description String
    Provides additional information about the rule.
    enabled Boolean
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name String
    The name of the rule. This must be unique within an account.

    Outputs

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

    Get an existing EventsToMetricsRule 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?: EventsToMetricsRuleState, opts?: CustomResourceOptions): EventsToMetricsRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            nrql: Optional[str] = None,
            rule_id: Optional[str] = None) -> EventsToMetricsRule
    func GetEventsToMetricsRule(ctx *Context, name string, id IDInput, state *EventsToMetricsRuleState, opts ...ResourceOption) (*EventsToMetricsRule, error)
    public static EventsToMetricsRule Get(string name, Input<string> id, EventsToMetricsRuleState? state, CustomResourceOptions? opts = null)
    public static EventsToMetricsRule get(String name, Output<String> id, EventsToMetricsRuleState 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 with the event and where the metrics will be put.
    Description string
    Provides additional information about the rule.
    Enabled bool
    True means this rule is enabled. False means the rule is currently not creating metrics.
    Name string
    The name of the rule. This must be unique within an account.
    Nrql string
    Explains how to create metrics from events.
    RuleId string
    The id, uniquely identifying the rule.
    AccountId string
    Account with the event and where the metrics will be put.
    Description string
    Provides additional information about the rule.
    Enabled bool
    True means this rule is enabled. False means the rule is currently not creating metrics.
    Name string
    The name of the rule. This must be unique within an account.
    Nrql string
    Explains how to create metrics from events.
    RuleId string
    The id, uniquely identifying the rule.
    accountId String
    Account with the event and where the metrics will be put.
    description String
    Provides additional information about the rule.
    enabled Boolean
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name String
    The name of the rule. This must be unique within an account.
    nrql String
    Explains how to create metrics from events.
    ruleId String
    The id, uniquely identifying the rule.
    accountId string
    Account with the event and where the metrics will be put.
    description string
    Provides additional information about the rule.
    enabled boolean
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name string
    The name of the rule. This must be unique within an account.
    nrql string
    Explains how to create metrics from events.
    ruleId string
    The id, uniquely identifying the rule.
    account_id str
    Account with the event and where the metrics will be put.
    description str
    Provides additional information about the rule.
    enabled bool
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name str
    The name of the rule. This must be unique within an account.
    nrql str
    Explains how to create metrics from events.
    rule_id str
    The id, uniquely identifying the rule.
    accountId String
    Account with the event and where the metrics will be put.
    description String
    Provides additional information about the rule.
    enabled Boolean
    True means this rule is enabled. False means the rule is currently not creating metrics.
    name String
    The name of the rule. This must be unique within an account.
    nrql String
    Explains how to create metrics from events.
    ruleId String
    The id, uniquely identifying the rule.

    Import

    New Relic Events to Metrics rules can be imported using a concatenated string of the format

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

    bash

    $ pulumi import newrelic:index/eventsToMetricsRule:EventsToMetricsRule 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