@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
214 lines • 9.31 kB
JavaScript
;
// *** 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.Workflow = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.callLogLevel : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["cryptoKeyName"] = state ? state.cryptoKeyName : undefined;
resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["executionHistoryLevel"] = state ? state.executionHistoryLevel : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["namePrefix"] = state ? state.namePrefix : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["revisionId"] = state ? state.revisionId : undefined;
resourceInputs["serviceAccount"] = state ? state.serviceAccount : undefined;
resourceInputs["sourceContents"] = state ? state.sourceContents : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
resourceInputs["userEnvVars"] = state ? state.userEnvVars : undefined;
}
else {
const args = argsOrState;
resourceInputs["callLogLevel"] = args ? args.callLogLevel : undefined;
resourceInputs["cryptoKeyName"] = args ? args.cryptoKeyName : undefined;
resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["executionHistoryLevel"] = args ? args.executionHistoryLevel : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["namePrefix"] = args ? args.namePrefix : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["serviceAccount"] = args ? args.serviceAccount : undefined;
resourceInputs["sourceContents"] = args ? args.sourceContents : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["userEnvVars"] = args ? args.userEnvVars : undefined;
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;
/** @internal */
Workflow.__pulumiType = 'gcp:workflows/workflow:Workflow';
//# sourceMappingURL=workflow.js.map