UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

239 lines • 9.83 kB
"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.Workflow = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Workflow program to be executed by Workflows. * * To get more information about Workflow, see: * * * [API documentation](https://cloud.google.com/workflows/docs/reference/rest/v1/projects.locations.workflows) * * How-to Guides * * [Managing Workflows](https://cloud.google.com/workflows/docs/creating-updating-workflow) * * ## Example Usage * * ### Workflow Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const testAccount = new gcp.serviceaccount.Account("test_account", { * accountId: "my-account", * displayName: "Test Service Account", * }); * const example = new gcp.workflows.Workflow("example", { * name: "workflow", * region: "us-central1", * description: "Magic", * serviceAccount: testAccount.id, * callLogLevel: "LOG_ERRORS_ONLY", * labels: { * env: "test", * }, * userEnvVars: { * url: "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam", * }, * deletionProtection: false, * sourceContents: `# This is a sample workflow. You can replace it with your source code. * # * # This workflow does the following: * # - reads current time and date information from an external API and stores * # the response in currentTime variable * # - retrieves a list of Wikipedia articles related to the day of the week * # from currentTime * # - returns the list of articles as an output of the workflow * # * # Note: In Terraform you need to escape the or it will cause errors. * * - getCurrentTime: * call: http.get * args: * url: \${sys.get_env(\\"url\\")} * result: currentTime * - readWikipedia: * call: http.get * args: * url: https://en.wikipedia.org/w/api.php * query: * action: opensearch * search: \${currentTime.body.dayOfWeek} * result: wikiResult * - returnOutput: * return: \${wikiResult.body[1]} * `, * }); * ``` * ### Workflow Tags * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const tagKey = new gcp.tags.TagKey("tag_key", { * parent: project.then(project => `projects/${project.number}`), * shortName: "tag_key", * }); * const tagValue = new gcp.tags.TagValue("tag_value", { * parent: pulumi.interpolate`tagKeys/${tagKey.name}`, * shortName: "tag_value", * }); * const testAccount = new gcp.serviceaccount.Account("test_account", { * accountId: "my-account", * displayName: "Test Service Account", * }); * const example = new gcp.workflows.Workflow("example", { * name: "workflow", * region: "us-central1", * description: "Magic", * serviceAccount: testAccount.id, * deletionProtection: false, * tags: pulumi.all([project, tagKey.shortName, tagValue.shortName]).apply(([project, tagKeyShortName, tagValueShortName]) => { * [`${project.projectId}/${tagKeyShortName}`]: tagValueShortName, * }), * sourceContents: `# This is a sample workflow. You can replace it with your source code. * # * # This workflow does the following: * # - reads current time and date information from an external API and stores * # the response in currentTime variable * # - retrieves a list of Wikipedia articles related to the day of the week * # from currentTime * # - returns the list of articles as an output of the workflow * # * # Note: In Terraform you need to escape the or it will cause errors. * * - getCurrentTime: * call: http.get * args: * url: \${sys.get_env(\\"url\\")} * result: currentTime * - readWikipedia: * call: http.get * args: * url: https://en.wikipedia.org/w/api.php * query: * action: opensearch * search: \${currentTime.body.dayOfWeek} * result: wikiResult * - returnOutput: * return: \${wikiResult.body[1]} * `, * }); * ``` * * ## Import * * This resource does not support import. */ class Workflow extends pulumi.CustomResource { /** * Get an existing Workflow 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 Workflow(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:workflows/workflow:Workflow'; /** * Returns true if the given object is an instance of Workflow. 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'] === Workflow.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["callLogLevel"] = state?.callLogLevel; resourceInputs["createTime"] = state?.createTime; resourceInputs["cryptoKeyName"] = state?.cryptoKeyName; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["deletionProtection"] = state?.deletionProtection; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["executionHistoryLevel"] = state?.executionHistoryLevel; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["region"] = state?.region; resourceInputs["revisionId"] = state?.revisionId; resourceInputs["serviceAccount"] = state?.serviceAccount; resourceInputs["sourceContents"] = state?.sourceContents; resourceInputs["state"] = state?.state; resourceInputs["tags"] = state?.tags; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["userEnvVars"] = state?.userEnvVars; } else { const args = argsOrState; resourceInputs["callLogLevel"] = args?.callLogLevel; resourceInputs["cryptoKeyName"] = args?.cryptoKeyName; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["deletionProtection"] = args?.deletionProtection; resourceInputs["description"] = args?.description; resourceInputs["executionHistoryLevel"] = args?.executionHistoryLevel; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["serviceAccount"] = args?.serviceAccount; resourceInputs["sourceContents"] = args?.sourceContents; resourceInputs["tags"] = args?.tags; resourceInputs["userEnvVars"] = args?.userEnvVars; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["revisionId"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Workflow.__pulumiType, name, resourceInputs, opts); } } exports.Workflow = Workflow; //# sourceMappingURL=workflow.js.map