UNPKG

@pulumi/gcp

Version:

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

184 lines • 10.2 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.FlexTemplateJob = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## 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, Object.assign(Object.assign({}, 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 ? state.additionalExperiments : undefined; resourceInputs["autoscalingAlgorithm"] = state ? state.autoscalingAlgorithm : undefined; resourceInputs["containerSpecGcsPath"] = state ? state.containerSpecGcsPath : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["enableStreamingEngine"] = state ? state.enableStreamingEngine : undefined; resourceInputs["ipConfiguration"] = state ? state.ipConfiguration : undefined; resourceInputs["jobId"] = state ? state.jobId : undefined; resourceInputs["kmsKeyName"] = state ? state.kmsKeyName : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["launcherMachineType"] = state ? state.launcherMachineType : undefined; resourceInputs["machineType"] = state ? state.machineType : undefined; resourceInputs["maxWorkers"] = state ? state.maxWorkers : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["network"] = state ? state.network : undefined; resourceInputs["numWorkers"] = state ? state.numWorkers : undefined; resourceInputs["onDelete"] = state ? state.onDelete : undefined; resourceInputs["parameters"] = state ? state.parameters : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["sdkContainerImage"] = state ? state.sdkContainerImage : undefined; resourceInputs["serviceAccountEmail"] = state ? state.serviceAccountEmail : undefined; resourceInputs["skipWaitOnJobTermination"] = state ? state.skipWaitOnJobTermination : undefined; resourceInputs["stagingLocation"] = state ? state.stagingLocation : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["subnetwork"] = state ? state.subnetwork : undefined; resourceInputs["tempLocation"] = state ? state.tempLocation : undefined; resourceInputs["transformNameMapping"] = state ? state.transformNameMapping : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.containerSpecGcsPath === undefined) && !opts.urn) { throw new Error("Missing required property 'containerSpecGcsPath'"); } resourceInputs["additionalExperiments"] = args ? args.additionalExperiments : undefined; resourceInputs["autoscalingAlgorithm"] = args ? args.autoscalingAlgorithm : undefined; resourceInputs["containerSpecGcsPath"] = args ? args.containerSpecGcsPath : undefined; resourceInputs["enableStreamingEngine"] = args ? args.enableStreamingEngine : undefined; resourceInputs["ipConfiguration"] = args ? args.ipConfiguration : undefined; resourceInputs["kmsKeyName"] = args ? args.kmsKeyName : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["launcherMachineType"] = args ? args.launcherMachineType : undefined; resourceInputs["machineType"] = args ? args.machineType : undefined; resourceInputs["maxWorkers"] = args ? args.maxWorkers : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["network"] = args ? args.network : undefined; resourceInputs["numWorkers"] = args ? args.numWorkers : undefined; resourceInputs["onDelete"] = args ? args.onDelete : undefined; resourceInputs["parameters"] = args ? args.parameters : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["sdkContainerImage"] = args ? args.sdkContainerImage : undefined; resourceInputs["serviceAccountEmail"] = args ? args.serviceAccountEmail : undefined; resourceInputs["skipWaitOnJobTermination"] = args ? args.skipWaitOnJobTermination : undefined; resourceInputs["stagingLocation"] = args ? args.stagingLocation : undefined; resourceInputs["subnetwork"] = args ? args.subnetwork : undefined; resourceInputs["tempLocation"] = args ? args.tempLocation : undefined; resourceInputs["transformNameMapping"] = args ? args.transformNameMapping : undefined; 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