Show / Hide Table of Contents

Class AlertChannel

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

Example Usage

Email

using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            IncludeJsonAttachment = "1",
            Recipients = "foo@example.com",
        },
        Type = "email",
    });
}

}

Additional Examples

Slack
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Channel = "example-alerts-channel",
            Url = "https://<YourOrganization>.slack.com",
        },
        Type = "slack",
    });
}

}
OpsGenie
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            ApiKey = "abc123",
            Recipients = "user1@domain.com, user2@domain.com",
            Tags = "tag1, tag2",
            Teams = "team1, team2",
        },
        Type = "opsgenie",
    });
}

}
PagerDuty
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            ServiceKey = "abc123",
        },
        Type = "pagerduty",
    });
}

}
VictorOps
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Key = "abc123",
            RouteKey = "/example",
        },
        Type = "victorops",
    });
}

}
Webhook
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Type = "webhook",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            BaseUrl = "http://www.test.com",
            PayloadType = "application/json",
            Payload = 
            {
                { "condition_name", "$CONDITION_NAME" },
                { "policy_name", "$POLICY_NAME" },
            },
            Headers = 
            {
                { "header1", value1 },
                { "header2", value2 },
            },
        },
    });
}

}
Webhook with complex payload
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            BaseUrl = "http://www.test.com",
            PayloadString = @"{
""my_custom_values"": {
""condition_name"": ""$$CONDITION_NAME"",
""policy_name"": ""$$POLICY_NAME""
}
}

",
            PayloadType = "application/json",
        },
        Type = "webhook",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
AlertChannel
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 AlertChannel : CustomResource

Constructors

View Source

AlertChannel(String, AlertChannelArgs, CustomResourceOptions)

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

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

The unique name of the resource

AlertChannelArgs 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

Config

A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.

Declaration
public Output<AlertChannelConfig> Config { get; }
Property Value
Type Description
Output<AlertChannelConfig>
View Source

Configuration

Deprecated (Optional) A map of key/value pairs with channel type specific values. This argument is deprecated. Use the config argument instead.

Declaration
public Output<ImmutableDictionary<string, object>> Configuration { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>
View Source

Name

The name of the channel.

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

Type

The type of channel. One of: email, slack, opsgenie, pagerduty, victorops, or webhook.

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

Methods

View Source

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

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

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

AlertChannelState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

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