"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowAutomation = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
 * Enables the creation and management of Datadog workflows using Workflow Automation. To easily export a workflow for use with Terraform, use the export button in the Datadog Workflow Automation UI. This resource requires a registered application key.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as datadog from "@pulumi/datadog";
 *
 * const workflow = new datadog.WorkflowAutomation("workflow", {
 *     name: "Send Email when Monitor Alerts",
 *     description: "This workflow alerts me by email when my monitor goes off. ",
 *     tags: [
 *         "service:foo",
 *         "source:alert",
 *         "team:bar",
 *     ],
 *     published: true,
 *     specJson: JSON.stringify({
 *         triggers: [{
 *             startStepNames: ["Send_Email"],
 *             monitorTrigger: {},
 *         }],
 *         steps: [{
 *             name: "Send_Email",
 *             actionId: "com.datadoghq.email.send",
 *             parameters: [
 *                 {
 *                     name: "to",
 *                     value: "REPLACE_ME",
 *                 },
 *                 {
 *                     name: "subject",
 *                     value: "Monitor \"{{ Source.monitor.name }}\" alerted",
 *                 },
 *                 {
 *                     name: "message",
 *                     value: `This message is from {{ WorkflowName }}.
 *
 * You can find a link to the monitor here: {{ Source.url }}.`,
 *                 },
 *             ],
 *             display: {
 *                 bounds: {
 *                     x: 0,
 *                     y: 216,
 *                 },
 *             },
 *         }],
 *         handle: "my-handle",
 *     }),
 * });
 * ```
 *
 * ## Import
 *
 * The `pulumi import` command can be used, for example:
 *
 * ```sh
 * $ pulumi import datadog:index/workflowAutomation:WorkflowAutomation my_workflow 11111111-2222-3333-4444-555555555555
 * ```
 */
class WorkflowAutomation extends pulumi.CustomResource {
    /**
     * Get an existing WorkflowAutomation 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, id, state, opts) {
        return new WorkflowAutomation(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'datadog:index/workflowAutomation:WorkflowAutomation';
    /**
     * Returns true if the given object is an instance of WorkflowAutomation.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === WorkflowAutomation.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["description"] = state?.description;
            resourceInputs["name"] = state?.name;
            resourceInputs["published"] = state?.published;
            resourceInputs["specJson"] = state?.specJson;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["webhookSecret"] = state?.webhookSecret;
        }
        else {
            const args = argsOrState;
            if (args?.description === undefined && !opts.urn) {
                throw new Error("Missing required property 'description'");
            }
            if (args?.name === undefined && !opts.urn) {
                throw new Error("Missing required property 'name'");
            }
            if (args?.published === undefined && !opts.urn) {
                throw new Error("Missing required property 'published'");
            }
            if (args?.specJson === undefined && !opts.urn) {
                throw new Error("Missing required property 'specJson'");
            }
            if (args?.tags === undefined && !opts.urn) {
                throw new Error("Missing required property 'tags'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["name"] = args?.name;
            resourceInputs["published"] = args?.published;
            resourceInputs["specJson"] = args?.specJson;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["webhookSecret"] = args?.webhookSecret ? pulumi.secret(args.webhookSecret) : undefined;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["webhookSecret"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(WorkflowAutomation.__pulumiType, name, resourceInputs, opts);
    }
}
exports.WorkflowAutomation = WorkflowAutomation;
//# sourceMappingURL=workflowAutomation.js.map