Wavefront

v1.1.0 published on Wednesday, Nov 24, 2021 by Pulumi

AlertTarget

Provides a wavefront Alert Target resource. This allows alert targets to created, updated, and deleted.

Attributes Reference

  • target_id - The target ID prefixed with target: for interpolating into a Wavefront Alert.

Route

The route mapping supports the following:

  • method - (Required) The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
  • target - (Required) The endpoint for the alert route. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
  • filter - (Required) String that filters the route. Space delimited. Currently only allows a single key value pair. (e.g. env prod)

Example

import * as pulumi from "@pulumi/pulumi";
import * as wavefront from "@pulumi/wavefront";

const testTarget = new wavefront.AlertTarget("test_target", {
    contentType: "application/json",
    customHeaders: {
        Testing: "true",
    },
    description: "Test target",
    method: "WEBHOOK",
    recipient: "https://hooks.slack.com/services/test/me",
    routes: [
        {
            filter: {
                key: "env",
                value: "prod",
            },
            method: "WEBHOOK",
            target: "https://hooks.slack.com/services/test/me/prod",
        },
        {
            filter: {
                key: "env",
                value: "dev",
            },
            method: "WEBHOOK",
            target: "https://hooks.slack.com/services/test/me/dev",
        },
    ],
    template: "{}",
    triggers: [
        "ALERT_OPENED",
        "ALERT_RESOLVED",
    ],
});
import pulumi
import pulumi_wavefront as wavefront

test_target = wavefront.AlertTarget("testTarget",
    content_type="application/json",
    custom_headers={
        "Testing": "true",
    },
    description="Test target",
    method="WEBHOOK",
    recipient="https://hooks.slack.com/services/test/me",
    routes=[
        wavefront.AlertTargetRouteArgs(
            filter={
                "key": "env",
                "value": "prod",
            },
            method="WEBHOOK",
            target="https://hooks.slack.com/services/test/me/prod",
        ),
        wavefront.AlertTargetRouteArgs(
            filter={
                "key": "env",
                "value": "dev",
            },
            method="WEBHOOK",
            target="https://hooks.slack.com/services/test/me/dev",
        ),
    ],
    template="{}",
    triggers=[
        "ALERT_OPENED",
        "ALERT_RESOLVED",
    ])
using Pulumi;
using Wavefront = Pulumi.Wavefront;

class MyStack : Stack
{
    public MyStack()
    {
        var testTarget = new Wavefront.AlertTarget("testTarget", new Wavefront.AlertTargetArgs
        {
            ContentType = "application/json",
            CustomHeaders = 
            {
                { "Testing", "true" },
            },
            Description = "Test target",
            Method = "WEBHOOK",
            Recipient = "https://hooks.slack.com/services/test/me",
            Routes = 
            {
                new Wavefront.Inputs.AlertTargetRouteArgs
                {
                    Filter = 
                    {
                        { "key", "env" },
                        { "value", "prod" },
                    },
                    Method = "WEBHOOK",
                    Target = "https://hooks.slack.com/services/test/me/prod",
                },
                new Wavefront.Inputs.AlertTargetRouteArgs
                {
                    Filter = 
                    {
                        { "key", "env" },
                        { "value", "dev" },
                    },
                    Method = "WEBHOOK",
                    Target = "https://hooks.slack.com/services/test/me/dev",
                },
            },
            Template = "{}",
            Triggers = 
            {
                "ALERT_OPENED",
                "ALERT_RESOLVED",
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-wavefront/sdk/go/wavefront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := wavefront.NewAlertTarget(ctx, "testTarget", &wavefront.AlertTargetArgs{
			ContentType: pulumi.String("application/json"),
			CustomHeaders: pulumi.StringMap{
				"Testing": pulumi.String("true"),
			},
			Description: pulumi.String("Test target"),
			Method:      pulumi.String("WEBHOOK"),
			Recipient:   pulumi.String("https://hooks.slack.com/services/test/me"),
			Routes: AlertTargetRouteArray{
				&AlertTargetRouteArgs{
					Filter: pulumi.StringMap{
						"key":   pulumi.String("env"),
						"value": pulumi.String("prod"),
					},
					Method: pulumi.String("WEBHOOK"),
					Target: pulumi.String("https://hooks.slack.com/services/test/me/prod"),
				},
				&AlertTargetRouteArgs{
					Filter: pulumi.StringMap{
						"key":   pulumi.String("env"),
						"value": pulumi.String("dev"),
					},
					Method: pulumi.String("WEBHOOK"),
					Target: pulumi.String("https://hooks.slack.com/services/test/me/dev"),
				},
			},
			Template: pulumi.String("{}"),
			Triggers: pulumi.StringArray{
				pulumi.String("ALERT_OPENED"),
				pulumi.String("ALERT_RESOLVED"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Example Usage

using Pulumi;
using Wavefront = Pulumi.Wavefront;

class MyStack : Stack
{
    public MyStack()
    {
        var testTarget = new Wavefront.AlertTarget("testTarget", new Wavefront.AlertTargetArgs
        {
            ContentType = "application/json",
            CustomHeaders = 
            {
                { "Testing", "true" },
            },
            Description = "Test target",
            Method = "WEBHOOK",
            Recipient = "https://hooks.slack.com/services/test/me",
            Template = "{}",
            Triggers = 
            {
                "ALERT_OPENED",
                "ALERT_RESOLVED",
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-wavefront/sdk/go/wavefront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := wavefront.NewAlertTarget(ctx, "testTarget", &wavefront.AlertTargetArgs{
			ContentType: pulumi.String("application/json"),
			CustomHeaders: pulumi.StringMap{
				"Testing": pulumi.String("true"),
			},
			Description: pulumi.String("Test target"),
			Method:      pulumi.String("WEBHOOK"),
			Recipient:   pulumi.String("https://hooks.slack.com/services/test/me"),
			Template:    pulumi.String("{}"),
			Triggers: pulumi.StringArray{
				pulumi.String("ALERT_OPENED"),
				pulumi.String("ALERT_RESOLVED"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_wavefront as wavefront

test_target = wavefront.AlertTarget("testTarget",
    content_type="application/json",
    custom_headers={
        "Testing": "true",
    },
    description="Test target",
    method="WEBHOOK",
    recipient="https://hooks.slack.com/services/test/me",
    template="{}",
    triggers=[
        "ALERT_OPENED",
        "ALERT_RESOLVED",
    ])
import * as pulumi from "@pulumi/pulumi";
import * as wavefront from "@pulumi/wavefront";

const testTarget = new wavefront.AlertTarget("test_target", {
    contentType: "application/json",
    customHeaders: {
        Testing: "true",
    },
    description: "Test target",
    method: "WEBHOOK",
    recipient: "https://hooks.slack.com/services/test/me",
    template: "{}",
    triggers: [
        "ALERT_OPENED",
        "ALERT_RESOLVED",
    ],
});

Create a AlertTarget Resource

new AlertTarget(name: string, args: AlertTargetArgs, opts?: CustomResourceOptions);
@overload
def AlertTarget(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                content_type: Optional[str] = None,
                custom_headers: Optional[Mapping[str, str]] = None,
                description: Optional[str] = None,
                email_subject: Optional[str] = None,
                is_html_content: Optional[bool] = None,
                method: Optional[str] = None,
                name: Optional[str] = None,
                recipient: Optional[str] = None,
                routes: Optional[Sequence[AlertTargetRouteArgs]] = None,
                template: Optional[str] = None,
                triggers: Optional[Sequence[str]] = None)
@overload
def AlertTarget(resource_name: str,
                args: AlertTargetArgs,
                opts: Optional[ResourceOptions] = None)
func NewAlertTarget(ctx *Context, name string, args AlertTargetArgs, opts ...ResourceOption) (*AlertTarget, error)
public AlertTarget(string name, AlertTargetArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AlertTargetArgs
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 AlertTargetArgs
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 AlertTargetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AlertTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

AlertTarget Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The AlertTarget resource accepts the following input properties:

Description string
Description describing this alert target.
Recipient string
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
Template string
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
Triggers List<string>
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
ContentType string
The value of the Content-Type header of the webhook.
CustomHeaders Dictionary<string, string>
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
EmailSubject string
The subject title of an email notification target.
IsHtmlContent bool
Determine whether the email alert content is sent as HTML or text.
Method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
Name string
The name of the alert target as it is displayed in wavefront
Routes List<AlertTargetRouteArgs>
List of routing targets that this alert target will notify. See Route
Description string
Description describing this alert target.
Recipient string
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
Template string
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
Triggers []string
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
ContentType string
The value of the Content-Type header of the webhook.
CustomHeaders map[string]string
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
EmailSubject string
The subject title of an email notification target.
IsHtmlContent bool
Determine whether the email alert content is sent as HTML or text.
Method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
Name string
The name of the alert target as it is displayed in wavefront
Routes []AlertTargetRouteArgs
List of routing targets that this alert target will notify. See Route
description string
Description describing this alert target.
recipient string
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
template string
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
triggers string[]
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
contentType string
The value of the Content-Type header of the webhook.
customHeaders {[key: string]: string}
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
emailSubject string
The subject title of an email notification target.
isHtmlContent boolean
Determine whether the email alert content is sent as HTML or text.
method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
name string
The name of the alert target as it is displayed in wavefront
routes AlertTargetRouteArgs[]
List of routing targets that this alert target will notify. See Route
description str
Description describing this alert target.
recipient str
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
template str
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
triggers Sequence[str]
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
content_type str
The value of the Content-Type header of the webhook.
custom_headers Mapping[str, str]
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
email_subject str
The subject title of an email notification target.
is_html_content bool
Determine whether the email alert content is sent as HTML or text.
method str
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
name str
The name of the alert target as it is displayed in wavefront
routes Sequence[AlertTargetRouteArgs]
List of routing targets that this alert target will notify. See Route

Outputs

All input properties are implicitly available as output properties. Additionally, the AlertTarget resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
TargetId string
Id string
The provider-assigned unique ID for this managed resource.
TargetId string
id string
The provider-assigned unique ID for this managed resource.
targetId string
id str
The provider-assigned unique ID for this managed resource.
target_id str

Look up an Existing AlertTarget Resource

Get an existing AlertTarget 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?: AlertTargetState, opts?: CustomResourceOptions): AlertTarget
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        content_type: Optional[str] = None,
        custom_headers: Optional[Mapping[str, str]] = None,
        description: Optional[str] = None,
        email_subject: Optional[str] = None,
        is_html_content: Optional[bool] = None,
        method: Optional[str] = None,
        name: Optional[str] = None,
        recipient: Optional[str] = None,
        routes: Optional[Sequence[AlertTargetRouteArgs]] = None,
        target_id: Optional[str] = None,
        template: Optional[str] = None,
        triggers: Optional[Sequence[str]] = None) -> AlertTarget
func GetAlertTarget(ctx *Context, name string, id IDInput, state *AlertTargetState, opts ...ResourceOption) (*AlertTarget, error)
public static AlertTarget Get(string name, Input<string> id, AlertTargetState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

ContentType string
The value of the Content-Type header of the webhook.
CustomHeaders Dictionary<string, string>
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
Description string
Description describing this alert target.
EmailSubject string
The subject title of an email notification target.
IsHtmlContent bool
Determine whether the email alert content is sent as HTML or text.
Method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
Name string
The name of the alert target as it is displayed in wavefront
Recipient string
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
Routes List<AlertTargetRouteArgs>
List of routing targets that this alert target will notify. See Route
TargetId string
Template string
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
Triggers List<string>
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
ContentType string
The value of the Content-Type header of the webhook.
CustomHeaders map[string]string
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
Description string
Description describing this alert target.
EmailSubject string
The subject title of an email notification target.
IsHtmlContent bool
Determine whether the email alert content is sent as HTML or text.
Method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
Name string
The name of the alert target as it is displayed in wavefront
Recipient string
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
Routes []AlertTargetRouteArgs
List of routing targets that this alert target will notify. See Route
TargetId string
Template string
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
Triggers []string
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
contentType string
The value of the Content-Type header of the webhook.
customHeaders {[key: string]: string}
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
description string
Description describing this alert target.
emailSubject string
The subject title of an email notification target.
isHtmlContent boolean
Determine whether the email alert content is sent as HTML or text.
method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
name string
The name of the alert target as it is displayed in wavefront
recipient string
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
routes AlertTargetRouteArgs[]
List of routing targets that this alert target will notify. See Route
targetId string
template string
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
triggers string[]
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.
content_type str
The value of the Content-Type header of the webhook.
custom_headers Mapping[str, str]
A string->string map specifying the custome HTTP header key/value pairs that will be sent in the requests with a method of WEBHOOK.
description str
Description describing this alert target.
email_subject str
The subject title of an email notification target.
is_html_content bool
Determine whether the email alert content is sent as HTML or text.
method str
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
name str
The name of the alert target as it is displayed in wavefront
recipient str
The end point for the notification Target. EMAIL: email address. PAGERDUTY: PagerDuty routing key. WEBHOOK: URL endpoint.
routes Sequence[AlertTargetRouteArgs]
List of routing targets that this alert target will notify. See Route
target_id str
template str
A mustache template that will form the body of the POST request, email and summary of the PagerDuty.
triggers Sequence[str]
A list of occurrences on which this webhook will be fired. Valid values are ALERT_OPENED, ALERT_UPDATED, ALERT_RESOLVED, ALERT_MAINTENANCE, ALERT_SNOOZED, ALERT_NO_DATA, ALERT_NO_DATA_RESOLVED, ALERT_NO_DATA_MAINTENANCE.

Supporting Types

AlertTargetRoute

Method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
Target string
Filter Dictionary<string, string>
Method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
Target string
Filter map[string]string
method string
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
target string
filter {[key: string]: string}
method str
The notification method used for notification target. One of WEBHOOK, EMAIL, PAGERDUTY.
target str
filter Mapping[str, str]

Import

Alert Targets can be imported using the id, e.g.

 $ pulumi import wavefront:index/alertTarget:AlertTarget alert_target abcdEFGhijKLMNO

Package Details

Repository
https://github.com/pulumi/pulumi-wavefront
License
Apache-2.0
Notes
This Pulumi package is based on the wavefront Terraform Provider.