1. Packages
  2. Datadog Provider
  3. API Docs
  4. Webhook
Datadog v4.33.2 published on Tuesday, Sep 24, 2024 by Pulumi

datadog.Webhook

Explore with Pulumi AI

datadog logo
Datadog v4.33.2 published on Tuesday, Sep 24, 2024 by Pulumi

    Provides a Datadog webhook resource. This can be used to create and manage Datadog webhooks.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as datadog from "@pulumi/datadog";
    
    // Create a new Datadog webhook
    const foo = new datadog.Webhook("foo", {
        name: "test-webhook",
        url: "example.com",
        encodeAs: "json",
        customHeaders: JSON.stringify({
            custom: "header",
        }),
        payload: JSON.stringify({
            custom: "payload",
        }),
    });
    
    import pulumi
    import json
    import pulumi_datadog as datadog
    
    # Create a new Datadog webhook
    foo = datadog.Webhook("foo",
        name="test-webhook",
        url="example.com",
        encode_as="json",
        custom_headers=json.dumps({
            "custom": "header",
        }),
        payload=json.dumps({
            "custom": "payload",
        }))
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-datadog/sdk/v4/go/datadog"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"custom": "header",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		tmpJSON1, err := json.Marshal(map[string]interface{}{
    			"custom": "payload",
    		})
    		if err != nil {
    			return err
    		}
    		json1 := string(tmpJSON1)
    		// Create a new Datadog webhook
    		_, err = datadog.NewWebhook(ctx, "foo", &datadog.WebhookArgs{
    			Name:          pulumi.String("test-webhook"),
    			Url:           pulumi.String("example.com"),
    			EncodeAs:      pulumi.String("json"),
    			CustomHeaders: pulumi.String(json0),
    			Payload:       pulumi.String(json1),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Datadog = Pulumi.Datadog;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a new Datadog webhook
        var foo = new Datadog.Webhook("foo", new()
        {
            Name = "test-webhook",
            Url = "example.com",
            EncodeAs = "json",
            CustomHeaders = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["custom"] = "header",
            }),
            Payload = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["custom"] = "payload",
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.datadog.Webhook;
    import com.pulumi.datadog.WebhookArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            // Create a new Datadog webhook
            var foo = new Webhook("foo", WebhookArgs.builder()
                .name("test-webhook")
                .url("example.com")
                .encodeAs("json")
                .customHeaders(serializeJson(
                    jsonObject(
                        jsonProperty("custom", "header")
                    )))
                .payload(serializeJson(
                    jsonObject(
                        jsonProperty("custom", "payload")
                    )))
                .build());
    
        }
    }
    
    resources:
      # Create a new Datadog webhook
      foo:
        type: datadog:Webhook
        properties:
          name: test-webhook
          url: example.com
          encodeAs: json
          customHeaders:
            fn::toJSON:
              custom: header
          payload:
            fn::toJSON:
              custom: payload
    

    Create Webhook Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Webhook(name: string, args: WebhookArgs, opts?: CustomResourceOptions);
    @overload
    def Webhook(resource_name: str,
                args: WebhookArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Webhook(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                name: Optional[str] = None,
                url: Optional[str] = None,
                custom_headers: Optional[str] = None,
                encode_as: Optional[str] = None,
                payload: Optional[str] = None)
    func NewWebhook(ctx *Context, name string, args WebhookArgs, opts ...ResourceOption) (*Webhook, error)
    public Webhook(string name, WebhookArgs args, CustomResourceOptions? opts = null)
    public Webhook(String name, WebhookArgs args)
    public Webhook(String name, WebhookArgs args, CustomResourceOptions options)
    
    type: datadog:Webhook
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args WebhookArgs
    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 WebhookArgs
    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 WebhookArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WebhookArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WebhookArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var webhookResource = new Datadog.Webhook("webhookResource", new()
    {
        Name = "string",
        Url = "string",
        CustomHeaders = "string",
        EncodeAs = "string",
        Payload = "string",
    });
    
    example, err := datadog.NewWebhook(ctx, "webhookResource", &datadog.WebhookArgs{
    	Name:          pulumi.String("string"),
    	Url:           pulumi.String("string"),
    	CustomHeaders: pulumi.String("string"),
    	EncodeAs:      pulumi.String("string"),
    	Payload:       pulumi.String("string"),
    })
    
    var webhookResource = new Webhook("webhookResource", WebhookArgs.builder()
        .name("string")
        .url("string")
        .customHeaders("string")
        .encodeAs("string")
        .payload("string")
        .build());
    
    webhook_resource = datadog.Webhook("webhookResource",
        name="string",
        url="string",
        custom_headers="string",
        encode_as="string",
        payload="string")
    
    const webhookResource = new datadog.Webhook("webhookResource", {
        name: "string",
        url: "string",
        customHeaders: "string",
        encodeAs: "string",
        payload: "string",
    });
    
    type: datadog:Webhook
    properties:
        customHeaders: string
        encodeAs: string
        name: string
        payload: string
        url: string
    

    Webhook 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 Webhook resource accepts the following input properties:

    Name string
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    Url string
    The URL of the webhook.
    CustomHeaders string
    The headers attached to the webhook.
    EncodeAs string
    Encoding type. Valid values are json, form.
    Payload string
    The payload of the webhook.
    Name string
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    Url string
    The URL of the webhook.
    CustomHeaders string
    The headers attached to the webhook.
    EncodeAs string
    Encoding type. Valid values are json, form.
    Payload string
    The payload of the webhook.
    name String
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    url String
    The URL of the webhook.
    customHeaders String
    The headers attached to the webhook.
    encodeAs String
    Encoding type. Valid values are json, form.
    payload String
    The payload of the webhook.
    name string
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    url string
    The URL of the webhook.
    customHeaders string
    The headers attached to the webhook.
    encodeAs string
    Encoding type. Valid values are json, form.
    payload string
    The payload of the webhook.
    name str
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    url str
    The URL of the webhook.
    custom_headers str
    The headers attached to the webhook.
    encode_as str
    Encoding type. Valid values are json, form.
    payload str
    The payload of the webhook.
    name String
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    url String
    The URL of the webhook.
    customHeaders String
    The headers attached to the webhook.
    encodeAs String
    Encoding type. Valid values are json, form.
    payload String
    The payload of the webhook.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Webhook Resource

    Get an existing Webhook 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?: WebhookState, opts?: CustomResourceOptions): Webhook
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            custom_headers: Optional[str] = None,
            encode_as: Optional[str] = None,
            name: Optional[str] = None,
            payload: Optional[str] = None,
            url: Optional[str] = None) -> Webhook
    func GetWebhook(ctx *Context, name string, id IDInput, state *WebhookState, opts ...ResourceOption) (*Webhook, error)
    public static Webhook Get(string name, Input<string> id, WebhookState? state, CustomResourceOptions? opts = null)
    public static Webhook get(String name, Output<String> id, WebhookState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    CustomHeaders string
    The headers attached to the webhook.
    EncodeAs string
    Encoding type. Valid values are json, form.
    Name string
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    Payload string
    The payload of the webhook.
    Url string
    The URL of the webhook.
    CustomHeaders string
    The headers attached to the webhook.
    EncodeAs string
    Encoding type. Valid values are json, form.
    Name string
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    Payload string
    The payload of the webhook.
    Url string
    The URL of the webhook.
    customHeaders String
    The headers attached to the webhook.
    encodeAs String
    Encoding type. Valid values are json, form.
    name String
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    payload String
    The payload of the webhook.
    url String
    The URL of the webhook.
    customHeaders string
    The headers attached to the webhook.
    encodeAs string
    Encoding type. Valid values are json, form.
    name string
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    payload string
    The payload of the webhook.
    url string
    The URL of the webhook.
    custom_headers str
    The headers attached to the webhook.
    encode_as str
    Encoding type. Valid values are json, form.
    name str
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    payload str
    The payload of the webhook.
    url str
    The URL of the webhook.
    customHeaders String
    The headers attached to the webhook.
    encodeAs String
    Encoding type. Valid values are json, form.
    name String
    The name of the webhook. It corresponds with <WEBHOOK_NAME>.
    payload String
    The payload of the webhook.
    url String
    The URL of the webhook.

    Import

    $ pulumi import datadog:index/webhook:Webhook foo example-webhook
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Datadog pulumi/pulumi-datadog
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the datadog Terraform Provider.
    datadog logo
    Datadog v4.33.2 published on Tuesday, Sep 24, 2024 by Pulumi