@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
191 lines • 9.68 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlexTemplateJob = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates a [Flex Template](https://cloud.google.com/dataflow/docs/guides/templates/using-flex-templates)
* job on Dataflow, which is an implementation of Apache Beam running on Google
* Compute Engine. For more information see the official documentation for [Beam](https://beam.apache.org)
* and [Dataflow](https://cloud.google.com/dataflow/).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bigDataJob = new gcp.dataflow.FlexTemplateJob("big_data_job", {
* name: "dataflow-flextemplates-job",
* containerSpecGcsPath: "gs://my-bucket/templates/template.json",
* parameters: {
* inputSubscription: "messages",
* },
* });
* ```
*
* ## Note on "destroy" / "apply"
*
* There are many types of Dataflow jobs. Some Dataflow jobs run constantly,
* getting new data from (e.g.) a GCS bucket, and outputting data continuously.
* Some jobs process a set amount of data then terminate. All jobs can fail while
* running due to programming errors or other issues. In this way, Dataflow jobs
* are different from most other provider / Google resources.
*
* The Dataflow resource is considered 'existing' while it is in a nonterminal
* state. If it reaches a terminal state (e.g. 'FAILED', 'COMPLETE',
* 'CANCELLED'), it will be recreated on the next 'apply'. This is as expected for
* jobs which run continuously, but may surprise users who use this resource for
* other kinds of Dataflow jobs.
*
* A Dataflow job which is 'destroyed' may be "cancelled" or "drained". If
* "cancelled", the job terminates - any data written remains where it is, but no
* new data will be processed. If "drained", no new data will enter the pipeline,
* but any data currently in the pipeline will finish being processed. The default
* is "cancelled", but if a user sets `onDelete` to `"drain"` in the
* configuration, you may experience a long wait for your `pulumi destroy` to
* complete.
*
* You can potentially short-circuit the wait by setting `skipWaitOnJobTermination`
* to `true`, but beware that unless you take active steps to ensure that the job
* `name` parameter changes between instances, the name will conflict and the launch
* of the new job will fail. One way to do this is with a
* randomId
* resource, for example:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const config = new pulumi.Config();
* const bigDataJobSubscriptionId = config.get("bigDataJobSubscriptionId") || "projects/myproject/subscriptions/messages";
* const bigDataJobNameSuffix = new random.RandomId("big_data_job_name_suffix", {
* byteLength: 4,
* keepers: {
* region: region,
* subscription_id: bigDataJobSubscriptionId,
* },
* });
* const bigDataJob = new gcp.dataflow.FlexTemplateJob("big_data_job", {
* name: pulumi.interpolate`dataflow-flextemplates-job-${bigDataJobNameSuffix.dec}`,
* region: region,
* containerSpecGcsPath: "gs://my-bucket/templates/template.json",
* skipWaitOnJobTermination: true,
* parameters: {
* inputSubscription: bigDataJobSubscriptionId,
* },
* });
* ```
*
* ## Import
*
* This resource does not support import.
*/
class FlexTemplateJob extends pulumi.CustomResource {
/**
* Get an existing FlexTemplateJob 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 FlexTemplateJob(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of FlexTemplateJob. 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'] === FlexTemplateJob.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additionalExperiments"] = state?.additionalExperiments;
resourceInputs["additionalPipelineOptions"] = state?.additionalPipelineOptions;
resourceInputs["autoscalingAlgorithm"] = state?.autoscalingAlgorithm;
resourceInputs["containerSpecGcsPath"] = state?.containerSpecGcsPath;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["enableStreamingEngine"] = state?.enableStreamingEngine;
resourceInputs["ipConfiguration"] = state?.ipConfiguration;
resourceInputs["jobId"] = state?.jobId;
resourceInputs["kmsKeyName"] = state?.kmsKeyName;
resourceInputs["labels"] = state?.labels;
resourceInputs["launcherMachineType"] = state?.launcherMachineType;
resourceInputs["machineType"] = state?.machineType;
resourceInputs["maxWorkers"] = state?.maxWorkers;
resourceInputs["name"] = state?.name;
resourceInputs["network"] = state?.network;
resourceInputs["numWorkers"] = state?.numWorkers;
resourceInputs["onDelete"] = state?.onDelete;
resourceInputs["parameters"] = state?.parameters;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["region"] = state?.region;
resourceInputs["sdkContainerImage"] = state?.sdkContainerImage;
resourceInputs["serviceAccountEmail"] = state?.serviceAccountEmail;
resourceInputs["skipWaitOnJobTermination"] = state?.skipWaitOnJobTermination;
resourceInputs["stagingLocation"] = state?.stagingLocation;
resourceInputs["state"] = state?.state;
resourceInputs["subnetwork"] = state?.subnetwork;
resourceInputs["tempLocation"] = state?.tempLocation;
resourceInputs["transformNameMapping"] = state?.transformNameMapping;
resourceInputs["type"] = state?.type;
}
else {
const args = argsOrState;
if (args?.containerSpecGcsPath === undefined && !opts.urn) {
throw new Error("Missing required property 'containerSpecGcsPath'");
}
resourceInputs["additionalExperiments"] = args?.additionalExperiments;
resourceInputs["additionalPipelineOptions"] = args?.additionalPipelineOptions;
resourceInputs["autoscalingAlgorithm"] = args?.autoscalingAlgorithm;
resourceInputs["containerSpecGcsPath"] = args?.containerSpecGcsPath;
resourceInputs["enableStreamingEngine"] = args?.enableStreamingEngine;
resourceInputs["ipConfiguration"] = args?.ipConfiguration;
resourceInputs["kmsKeyName"] = args?.kmsKeyName;
resourceInputs["labels"] = args?.labels;
resourceInputs["launcherMachineType"] = args?.launcherMachineType;
resourceInputs["machineType"] = args?.machineType;
resourceInputs["maxWorkers"] = args?.maxWorkers;
resourceInputs["name"] = args?.name;
resourceInputs["network"] = args?.network;
resourceInputs["numWorkers"] = args?.numWorkers;
resourceInputs["onDelete"] = args?.onDelete;
resourceInputs["parameters"] = args?.parameters;
resourceInputs["project"] = args?.project;
resourceInputs["region"] = args?.region;
resourceInputs["sdkContainerImage"] = args?.sdkContainerImage;
resourceInputs["serviceAccountEmail"] = args?.serviceAccountEmail;
resourceInputs["skipWaitOnJobTermination"] = args?.skipWaitOnJobTermination;
resourceInputs["stagingLocation"] = args?.stagingLocation;
resourceInputs["subnetwork"] = args?.subnetwork;
resourceInputs["tempLocation"] = args?.tempLocation;
resourceInputs["transformNameMapping"] = args?.transformNameMapping;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["jobId"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(FlexTemplateJob.__pulumiType, name, resourceInputs, opts);
}
}
exports.FlexTemplateJob = FlexTemplateJob;
/** @internal */
FlexTemplateJob.__pulumiType = 'gcp:dataflow/flexTemplateJob:FlexTemplateJob';
//# sourceMappingURL=flexTemplateJob.js.map
;