Class AlertChannel
Use this resource to create and manage New Relic alert policies.
Example Usage
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",
});
}
}
Inherited Members
Namespace: Pulumi.NewRelic
Assembly: Pulumi.NewRelic.dll
Syntax
public class AlertChannel : CustomResource
Constructors
View SourceAlertChannel(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 SourceConfig
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> |
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>> |
Name
The name of the channel.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
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 SourceGet(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 |