@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
113 lines • 5.26 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.Job = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manage a job resource within HuaweiCloud MRS.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const clusterId = config.requireObject("clusterId");
* const jobName = config.requireObject("jobName");
* const programPath = config.requireObject("programPath");
* const accessKey = config.requireObject("accessKey");
* const secretKey = config.requireObject("secretKey");
* const test = new huaweicloud.mrs.Job("test", {
* clusterId: clusterId,
* type: "SparkSubmit",
* programPath: programPath,
* parameters: `${accessKey} ${secretKey} 1 obs://obs-demo-analysis/input obs://obs-demo-analysis/output`,
* programParameters: {
* "--class": "com.huawei.bigdata.spark.examples.DriverBehavior",
* },
* });
* ```
*
* ## Import
*
* MapReduce jobs can be imported using their `id` and the IDs of the MapReduce cluster to which the job belongs, separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Mrs/job:Job test <cluster_id>/<id>
* ```
*/
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["finishTime"] = state ? state.finishTime : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["parameters"] = state ? state.parameters : undefined;
resourceInputs["programParameters"] = state ? state.programParameters : undefined;
resourceInputs["programPath"] = state ? state.programPath : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["serviceParameters"] = state ? state.serviceParameters : undefined;
resourceInputs["sql"] = state ? state.sql : undefined;
resourceInputs["startTime"] = state ? state.startTime : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["submitTime"] = state ? state.submitTime : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.clusterId === undefined) && !opts.urn) {
throw new Error("Missing required property 'clusterId'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["clusterId"] = args ? args.clusterId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["parameters"] = args ? args.parameters : undefined;
resourceInputs["programParameters"] = args ? args.programParameters : undefined;
resourceInputs["programPath"] = args ? args.programPath : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["serviceParameters"] = args ? args.serviceParameters : undefined;
resourceInputs["sql"] = args ? args.sql : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["finishTime"] = undefined /*out*/;
resourceInputs["startTime"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["submitTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Job.__pulumiType, name, resourceInputs, opts);
}
}
exports.Job = Job;
/** @internal */
Job.__pulumiType = 'huaweicloud:Mrs/job:Job';
//# sourceMappingURL=job.js.map