UNPKG

@pulumiverse/dynatrace

Version:

A Pulumi package for creating and managing Dynatrace cloud resources.

193 lines 7.98 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.AutomationWorkflow = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * > **Dynatrace SaaS only** * * > To utilize this resource, please define the environment variables `DT_CLIENT_ID`, `DT_CLIENT_SECRET`, `DT_ACCOUNT_ID` with an OAuth client including the following permissions: **View workflows** (`automation:workflows:read`) and **Create and edit workflows** (`automation:workflows:write`). * * > This resource is excluded by default in the export utility, please explicitly specify the resource to retrieve existing configuration. * * ## Dynatrace Documentation * * - Dynatrace Workflows - https://www.dynatrace.com/support/help/platform-modules/cloud-automation/workflows * * ## Resource Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as dynatrace from "@pulumiverse/dynatrace"; * * const sampleWorklowTF = new dynatrace.AutomationWorkflow("sampleWorklowTF", { * description: "Desc", * actor: "########-####-####-####-############", * title: "Sample Worklow TF1", * owner: "########-####-####-####-############", * "private": true, * tasks: { * tasks: [ * { * name: "http_request_1", * description: "Issue an HTTP request to any API", * action: "dynatrace.automations:http-function", * active: true, * input: JSON.stringify({ * method: "GET", * url: "https://www.google.at/", * }), * position: { * x: 0, * y: 1, * }, * }, * { * name: "http_request_2", * description: "Issue an HTTP request to any API", * action: "dynatrace.automations:http-function", * active: false, * input: JSON.stringify({ * method: "GET", * url: "https://www.second-task.com/", * }), * conditions: { * states: { * http_request_1: "SUCCESS", * run_javascript_1: "OK", * }, * custom: "", * }, * position: { * x: -1, * y: 2, * }, * timeout: "50000", * }, * { * name: "http_request_3", * description: "Issue an HTTP request to any API", * action: "dynatrace.automations:http-function", * active: false, * input: JSON.stringify({ * method: "GET", * url: "https://www.third-task.com", * }), * conditions: { * states: { * http_request_2: "OK", * }, * custom: "{{http_request_1}}", * }, * position: { * x: 0, * y: 3, * }, * }, * { * name: "run_javascript_1", * description: "Build a custom task running js Code", * action: "dynatrace.automations:run-javascript", * active: false, * input: JSON.stringify({ * script: `// optional import of sdk modules * import { execution } from '@dynatrace-sdk/automation-utils'; * * export default async function ({ execution_id }) { * // your code goes here * // e.g. get the current execution * const ex = await execution(execution_id); * console.log('Automated script execution on behalf of', ex.trigger); * * return { triggeredBy: ex.trigger }; * }`, * }), * position: { * x: -2, * y: 1, * }, * }, * ], * }, * trigger: { * event: { * active: false, * config: { * davisEvent: { * entityTagsMatch: "all", * entityTags: { * asdf: "", * }, * onProblemClose: false, * types: ["CUSTOM_ANNOTATION"], * }, * }, * }, * }, * }); * ``` */ class AutomationWorkflow extends pulumi.CustomResource { /** * Get an existing AutomationWorkflow 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 AutomationWorkflow(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of AutomationWorkflow. 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'] === AutomationWorkflow.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["actor"] = state ? state.actor : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["owner"] = state ? state.owner : undefined; resourceInputs["private"] = state ? state.private : undefined; resourceInputs["tasks"] = state ? state.tasks : undefined; resourceInputs["title"] = state ? state.title : undefined; resourceInputs["trigger"] = state ? state.trigger : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.tasks === undefined) && !opts.urn) { throw new Error("Missing required property 'tasks'"); } if ((!args || args.title === undefined) && !opts.urn) { throw new Error("Missing required property 'title'"); } resourceInputs["actor"] = args ? args.actor : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["owner"] = args ? args.owner : undefined; resourceInputs["private"] = args ? args.private : undefined; resourceInputs["tasks"] = args ? args.tasks : undefined; resourceInputs["title"] = args ? args.title : undefined; resourceInputs["trigger"] = args ? args.trigger : undefined; resourceInputs["type"] = args ? args.type : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AutomationWorkflow.__pulumiType, name, resourceInputs, opts); } } exports.AutomationWorkflow = AutomationWorkflow; /** @internal */ AutomationWorkflow.__pulumiType = 'dynatrace:index/automationWorkflow:AutomationWorkflow'; //# sourceMappingURL=automationWorkflow.js.map