Show / Hide Table of Contents

Class AlertPolicy

Use this resource to create and manage New Relic alert policies.

Additional Examples

Provision multiple notification channels and add those channels to a policy
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    // Provision a Slack notification channel.
    var slackChannel = new NewRelic.AlertChannel("slackChannel", new NewRelic.AlertChannelArgs
    {
        Type = "slack",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Url = "https://hooks.slack.com/services/<*****>/<*****>",
            Channel = "example-alerts-channel",
        },
    });
    // Provision an email notification channel.
    var emailChannel = new NewRelic.AlertChannel("emailChannel", new NewRelic.AlertChannelArgs
    {
        Type = "email",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Recipients = "example@testing.com",
            IncludeJsonAttachment = "1",
        },
    });
    // Provision the alert policy.
    var policyWithChannels = new NewRelic.AlertPolicy("policyWithChannels", new NewRelic.AlertPolicyArgs
    {
        IncidentPreference = "PER_CONDITION",
        ChannelIds = 
        {
            slackChannel.Id,
            emailChannel.Id,
        },
    });
}

}

<br>

Reference existing notification channels and add those channel to a policy
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var slackChannel = Output.Create(NewRelic.GetAlertChannel.InvokeAsync(new NewRelic.GetAlertChannelArgs
    {
        Name = &quot;slack-channel-notification&quot;,
    }));
    var emailChannel = Output.Create(NewRelic.GetAlertChannel.InvokeAsync(new NewRelic.GetAlertChannelArgs
    {
        Name = &quot;test@example.com&quot;,
    }));
    // Provision the alert policy.
    var policyWithChannels = new NewRelic.AlertPolicy(&quot;policyWithChannels&quot;, new NewRelic.AlertPolicyArgs
    {
        IncidentPreference = &quot;PER_CONDITION&quot;,
        ChannelIds = 
        {
            slackChannel.Apply(slackChannel => slackChannel.Id),
            emailChannel.Apply(emailChannel => emailChannel.Id),
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
AlertPolicy
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.NewRelic
Assembly: Pulumi.NewRelic.dll
Syntax
public class AlertPolicy : CustomResource

Constructors

View Source

AlertPolicy(String, AlertPolicyArgs, CustomResourceOptions)

Create a AlertPolicy resource with the given unique name, arguments, and options.

Declaration
public AlertPolicy(string name, AlertPolicyArgs args = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

AlertPolicyArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

ChannelIds

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported via terraform import.

Declaration
public Output<ImmutableArray<int>> ChannelIds { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.Int32>>
View Source

CreatedAt

DEPRECATED: The time the policy was created.

Declaration
public Output<string> CreatedAt { get; }
Property Value
Type Description
Output<System.String>
View Source

IncidentPreference

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

Declaration
public Output<string> IncidentPreference { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The name of the policy.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

UpdatedAt

DEPRECATED: The time the policy was last updated.

Declaration
public Output<string> UpdatedAt { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, AlertPolicyState, CustomResourceOptions)

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

Declaration
public static AlertPolicy Get(string name, Input<string> id, AlertPolicyState 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.

AlertPolicyState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
AlertPolicy
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.