UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

194 lines 8.53 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.Job = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages CDM job resource within HuaweiCloud. * * ## Example Usage * ### Create a cdm job * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const name = config.requireObject("name"); * const obsLinkName = config.requireObject("obsLinkName"); * const obsInputBucket = config.requireObject("obsInputBucket"); * const obsOutputBucket = config.requireObject("obsOutputBucket"); * const obsLinkNameInput = config.requireObject("obsLinkNameInput"); * const input = new huaweicloud.obs.Bucket("input", { * bucket: "job-input", * acl: "private", * forceDestroy: true, * }); * const output = new huaweicloud.obs.Bucket("output", { * bucket: "job-output", * acl: "private", * forceDestroy: true, * }); * const test = new huaweicloud.cdm.Job("test", { * jobType: "NORMAL_JOB", * clusterId: huaweicloud_cdm_cluster.test.id, * sourceConnector: "obs-connector", * sourceLinkName: obsLinkName, * sourceJobConfig: { * bucketName: obsInputBucket, * inputDirectory: "/", * listTextFile: "false", * inputFormat: "BINARY_FILE", * fromCompression: "NONE", * fromFileOpType: "DO_NOTHING", * useMarkerFile: "false", * useTimeFilter: "false", * fileSeparator: "|", * filterType: "NONE", * useWildCard: "false", * decryption: "NONE", * nonexistentPathDisregard: "false", * }, * destinationConnector: "obs-connector", * destinationLinkName: obsLinkName, * destinationJobConfig: { * bucketName: obsOutputBucket, * outputDirectory: "/", * outputFormat: "BINARY_FILE", * validateMD5: "true", * recordMD5Result: "false", * duplicateFileOpType: "REPLACE", * useCustomDirectory: "false", * encryption: "NONE", * copyContentType: "false", * shouldClearTable: "false", * }, * config: { * retryType: "NONE", * schedulerEnabled: false, * throttlingExtractorsNumber: 4, * throttlingRecordDirtyData: false, * throttlingMaxErrorRecords: 10, * throttlingLoaderNumber: 1, * }, * }); * ``` * * ## Import * * Jobs can be imported by `id`. It is composed of the ID of CDM cluster which this job run in and the name of job, * * separated by a slash. For example, bash * * ```sh * $ pulumi import huaweicloud:Cdm/job:Job test b11b407c-e604-4e8d-8bc4-92398320b847/jobName * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`source_job_config` and `destination_job_config`. * * It is generally recommended running `terraform plan` after importing a cluster. * * You can then decide if changes should be applied to the cluster, or the resource definition should be updated to align with the cluster. Also you can ignore changes as below. hcl resource "huaweicloud_cdm_cluster" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * source_job_config, destination_job_config, * * ] * * } } */ class Job extends pulumi.CustomResource { /** * Get an existing Job 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 Job(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Job. 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'] === Job.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["config"] = state ? state.config : undefined; resourceInputs["destinationConnector"] = state ? state.destinationConnector : undefined; resourceInputs["destinationJobConfig"] = state ? state.destinationJobConfig : undefined; resourceInputs["destinationLinkName"] = state ? state.destinationLinkName : undefined; resourceInputs["jobType"] = state ? state.jobType : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["sourceConnector"] = state ? state.sourceConnector : undefined; resourceInputs["sourceJobConfig"] = state ? state.sourceJobConfig : undefined; resourceInputs["sourceLinkName"] = state ? state.sourceLinkName : undefined; resourceInputs["status"] = state ? state.status : undefined; } else { const args = argsOrState; if ((!args || args.clusterId === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } if ((!args || args.destinationConnector === undefined) && !opts.urn) { throw new Error("Missing required property 'destinationConnector'"); } if ((!args || args.destinationJobConfig === undefined) && !opts.urn) { throw new Error("Missing required property 'destinationJobConfig'"); } if ((!args || args.destinationLinkName === undefined) && !opts.urn) { throw new Error("Missing required property 'destinationLinkName'"); } if ((!args || args.jobType === undefined) && !opts.urn) { throw new Error("Missing required property 'jobType'"); } if ((!args || args.sourceConnector === undefined) && !opts.urn) { throw new Error("Missing required property 'sourceConnector'"); } if ((!args || args.sourceJobConfig === undefined) && !opts.urn) { throw new Error("Missing required property 'sourceJobConfig'"); } if ((!args || args.sourceLinkName === undefined) && !opts.urn) { throw new Error("Missing required property 'sourceLinkName'"); } resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["config"] = args ? args.config : undefined; resourceInputs["destinationConnector"] = args ? args.destinationConnector : undefined; resourceInputs["destinationJobConfig"] = args ? args.destinationJobConfig : undefined; resourceInputs["destinationLinkName"] = args ? args.destinationLinkName : undefined; resourceInputs["jobType"] = args ? args.jobType : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["sourceConnector"] = args ? args.sourceConnector : undefined; resourceInputs["sourceJobConfig"] = args ? args.sourceJobConfig : undefined; resourceInputs["sourceLinkName"] = args ? args.sourceLinkName : undefined; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Job.__pulumiType, name, resourceInputs, opts); } } exports.Job = Job; /** @internal */ Job.__pulumiType = 'huaweicloud:Cdm/job:Job'; //# sourceMappingURL=job.js.map