import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Use this resource to create and manage New Relic alert channels.
*
* > **WARNING:** The `newrelic.AlertChannel` resource is **deprecated** and will be **removed in a future major release**. As an alternative, you can set up channels using a combination of the newer resources `newrelic.NotificationDestination` and `newrelic.NotificationChannel`. We **strongly recommend** migrating to these new resources at the earliest. Please refer to this example for a detailed illustration on setting up channels with these resources.
*
* > **A note on the availability of this resource in Japan (JP).** The `newrelic.AlertChannel` resource is backed by the legacy REST v2 Alert Channels API, which was globally deprecated in 2024 - the same reason this resource has been marked deprecated for a while, as noted in the warning above. Because REST v2 is not provisioned on the New Relic Japan region, `newrelic.AlertChannel` simply cannot be used there; a `pulumi preview` against a provider configured with `region = "JP"` fails early with an actionable error message.
Moving to the NerdGraph-based `newrelic.NotificationDestination` and `newrelic.NotificationChannel` resources is not a JP-only concern - it is highly essential in every region, so that your alerting keeps working when the REST v2 Alert Channels API is formally sunsetted. See the getting started guide for a walkthrough of wiring alert conditions, alert policies, notification destinations, notification channels, and workflows together in Terraform.
*
* ## Example Usage
*
* ##### Email
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "foo",
* type: "email",
* config: {
* recipients: "foo@example.com",
* includeJsonAttachment: "true",
* },
* });
* ```
* See additional examples.
*
* ## Additional Examples
*
* ##### Slack
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "slack-example",
* type: "slack",
* config: {
* url: "https://hooks.slack.com/services/XXXXXXX/XXXXXXX/XXXXXXXXXX",
* channel: "example-alerts-channel",
* },
* });
* ```
*
* > **NOTE:** For instructions on setting up Webhooks with Slack, please visit the article linked under the argument `slack` in the aforementioned configuration, or [this article](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-notifications/notification-channels-control-where-send-alerts/#slack) in New Relic's docs for additional details on setting up the `New Relic Alerts` Slack application, and subsequently using the generated Webhook URL.
*
* ##### OpsGenie
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "opsgenie-example",
* type: "opsgenie",
* config: {
* apiKey: "abc123",
* teams: "team1, team2",
* tags: "tag1, tag2",
* recipients: "user1@domain.com, user2@domain.com",
* },
* });
* ```
*
* ##### PagerDuty
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "pagerduty-example",
* type: "pagerduty",
* config: {
* serviceKey: "abc123",
* },
* });
* ```
*
* ##### VictorOps
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "victorops-example",
* type: "victorops",
* config: {
* key: "abc123",
* routeKey: "/example",
* },
* });
* ```
*
* ##### Webhook
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "webhook-example",
* type: "webhook",
* config: {
* 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
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* const foo = new newrelic.AlertChannel("foo", {
* name: "webhook-example",
* type: "webhook",
* config: {
* baseUrl: "http://www.test.com",
* payloadType: "application/json",
* payloadString: `{
* \\"my_custom_values\\": {
* \\"condition_name\\": \\"CONDITION_NAME\\",
* \\"policy_name\\": \\"POLICY_NAME\\"
* }
* }
* `,
* },
* });
* ```
*
* ## Import
*
* Alert channels can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import newrelic:index/alertChannel:AlertChannel main
* ```
*
* > **NOTE:** Sensitive data such as channel API keys, service keys, etc are not returned from the underlying API for security reasons and may not be set in state when importing.
*/
export declare class AlertChannel extends pulumi.CustomResource {
/**
* Get an existing AlertChannel resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input, state?: AlertChannelState, opts?: pulumi.CustomResourceOptions): AlertChannel;
/**
* Returns true if the given object is an instance of AlertChannel. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is AlertChannel;
/**
* Determines the New Relic account where the alert channel will be created. Defaults to the account associated with the API key used.
*/
readonly accountId: pulumi.Output;
/**
* 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.
*/
readonly config: pulumi.Output;
/**
* The name of the channel.
*/
readonly name: pulumi.Output;
/**
* The type of channel. One of: `email`, `slack`, `opsgenie`, `pagerduty`, `victorops`, or `webhook`.
*/
readonly type: pulumi.Output;
/**
* Create a AlertChannel resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: AlertChannelArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering AlertChannel resources.
*/
export interface AlertChannelState {
/**
* Determines the New Relic account where the alert channel will be created. Defaults to the account associated with the API key used.
*/
accountId?: pulumi.Input;
/**
* 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.
*/
config?: pulumi.Input;
/**
* The name of the channel.
*/
name?: pulumi.Input;
/**
* The type of channel. One of: `email`, `slack`, `opsgenie`, `pagerduty`, `victorops`, or `webhook`.
*/
type?: pulumi.Input;
}
/**
* The set of arguments for constructing a AlertChannel resource.
*/
export interface AlertChannelArgs {
/**
* Determines the New Relic account where the alert channel will be created. Defaults to the account associated with the API key used.
*/
accountId?: pulumi.Input;
/**
* 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.
*/
config?: pulumi.Input;
/**
* The name of the channel.
*/
name?: pulumi.Input;
/**
* The type of channel. One of: `email`, `slack`, `opsgenie`, `pagerduty`, `victorops`, or `webhook`.
*/
type: pulumi.Input;
}
//# sourceMappingURL=alertChannel.d.ts.map