@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
304 lines • 12.1 kB
JavaScript
"use strict";
// *** 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.Job = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Glue Job resource.
*
* > Glue functionality, such as monitoring and logging of jobs, is typically managed with the `defaultArguments` argument. See the [Special Parameters Used by AWS Glue](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html) topic in the Glue developer guide for additional information.
*
* ## Example Usage
*
* ### Python Glue Job
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // IAM role for Glue jobs
* const glueJobRole = new aws.iam.Role("glue_job_role", {
* name: "glue-job-role",
* assumeRolePolicy: JSON.stringify({
* Version: "2012-10-17",
* Statement: [{
* Action: "sts:AssumeRole",
* Effect: "Allow",
* Principal: {
* Service: "glue.amazonaws.com",
* },
* }],
* }),
* });
* const etlJob = new aws.glue.Job("etl_job", {
* name: "example-etl-job",
* description: "An example Glue ETL job",
* roleArn: glueJobRole.arn,
* glueVersion: "5.0",
* maxRetries: 0,
* timeout: 2880,
* numberOfWorkers: 2,
* workerType: "G.1X",
* connections: [example.name],
* executionClass: "STANDARD",
* command: {
* scriptLocation: `s3://${glueScripts.bucket}/jobs/etl_job.py`,
* name: "glueetl",
* pythonVersion: "3",
* },
* notificationProperty: {
* notifyDelayAfter: 3,
* },
* defaultArguments: {
* "--job-language": "python",
* "--continuous-log-logGroup": "/aws-glue/jobs",
* "--enable-continuous-cloudwatch-log": "true",
* "--enable-continuous-log-filter": "true",
* "--enable-metrics": "",
* "--enable-auto-scaling": "true",
* },
* executionProperty: {
* maxConcurrentRuns: 1,
* },
* tags: {
* ManagedBy: "AWS",
* },
* });
* const glueEtlScript = new aws.s3.BucketObjectv2("glue_etl_script", {
* bucket: glueScripts.id,
* key: "jobs/etl_job.py",
* source: new pulumi.asset.FileAsset("jobs/etl_job.py"),
* });
* ```
*
* ### Pythonshell Job
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // IAM role for Glue jobs
* const glueJobRole = new aws.iam.Role("glue_job_role", {
* name: "glue-job-role",
* assumeRolePolicy: JSON.stringify({
* Version: "2012-10-17",
* Statement: [{
* Action: "sts:AssumeRole",
* Effect: "Allow",
* Principal: {
* Service: "glue.amazonaws.com",
* },
* }],
* }),
* });
* const pythonShellJob = new aws.glue.Job("python_shell_job", {
* name: "example-python-shell-job",
* description: "An example Python shell job",
* roleArn: glueJobRole.arn,
* maxCapacity: 0.0625,
* maxRetries: 0,
* timeout: 2880,
* connections: [example.name],
* command: {
* scriptLocation: `s3://${glueScripts.bucket}/jobs/shell_job.py`,
* name: "pythonshell",
* pythonVersion: "3.9",
* },
* defaultArguments: {
* "--job-language": "python",
* "--continuous-log-logGroup": "/aws-glue/jobs",
* "--enable-continuous-cloudwatch-log": "true",
* "library-set": "analytics",
* },
* executionProperty: {
* maxConcurrentRuns: 1,
* },
* tags: {
* ManagedBy: "AWS",
* },
* });
* const pythonShellScript = new aws.s3.BucketObjectv2("python_shell_script", {
* bucket: glueScripts.id,
* key: "jobs/shell_job.py",
* source: new pulumi.asset.FileAsset("jobs/shell_job.py"),
* });
* ```
*
* ### Ray Job
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.glue.Job("example", {
* name: "example",
* roleArn: exampleAwsIamRole.arn,
* glueVersion: "4.0",
* workerType: "Z.2X",
* command: {
* name: "glueray",
* pythonVersion: "3.9",
* runtime: "Ray2.4",
* scriptLocation: `s3://${exampleAwsS3Bucket.bucket}/example.py`,
* },
* });
* ```
*
* ### Scala Job
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.glue.Job("example", {
* name: "example",
* roleArn: exampleAwsIamRole.arn,
* command: {
* scriptLocation: `s3://${exampleAwsS3Bucket.bucket}/example.scala`,
* },
* defaultArguments: {
* "--job-language": "scala",
* },
* });
* ```
*
* ### Streaming Job
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.glue.Job("example", {
* name: "example streaming job",
* roleArn: exampleAwsIamRole.arn,
* command: {
* name: "gluestreaming",
* scriptLocation: `s3://${exampleAwsS3Bucket.bucket}/example.script`,
* },
* });
* ```
*
* ### Enabling CloudWatch Logs and Metrics
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudwatch.LogGroup("example", {
* name: "example",
* retentionInDays: 14,
* });
* const exampleJob = new aws.glue.Job("example", {defaultArguments: {
* "--continuous-log-logGroup": example.name,
* "--enable-continuous-cloudwatch-log": "true",
* "--enable-continuous-log-filter": "true",
* "--enable-metrics": "",
* }});
* ```
*
* ## Import
*
* Using `pulumi import`, import Glue Jobs using `name`. For example:
*
* ```sh
* $ pulumi import aws:glue/job:Job MyJob MyJob
* ```
*/
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["arn"] = state ? state.arn : undefined;
resourceInputs["command"] = state ? state.command : undefined;
resourceInputs["connections"] = state ? state.connections : undefined;
resourceInputs["defaultArguments"] = state ? state.defaultArguments : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["executionClass"] = state ? state.executionClass : undefined;
resourceInputs["executionProperty"] = state ? state.executionProperty : undefined;
resourceInputs["glueVersion"] = state ? state.glueVersion : undefined;
resourceInputs["jobMode"] = state ? state.jobMode : undefined;
resourceInputs["jobRunQueuingEnabled"] = state ? state.jobRunQueuingEnabled : undefined;
resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined;
resourceInputs["maxCapacity"] = state ? state.maxCapacity : undefined;
resourceInputs["maxRetries"] = state ? state.maxRetries : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["nonOverridableArguments"] = state ? state.nonOverridableArguments : undefined;
resourceInputs["notificationProperty"] = state ? state.notificationProperty : undefined;
resourceInputs["numberOfWorkers"] = state ? state.numberOfWorkers : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["roleArn"] = state ? state.roleArn : undefined;
resourceInputs["securityConfiguration"] = state ? state.securityConfiguration : undefined;
resourceInputs["sourceControlDetails"] = state ? state.sourceControlDetails : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["timeout"] = state ? state.timeout : undefined;
resourceInputs["workerType"] = state ? state.workerType : undefined;
}
else {
const args = argsOrState;
if ((!args || args.command === undefined) && !opts.urn) {
throw new Error("Missing required property 'command'");
}
if ((!args || args.roleArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleArn'");
}
resourceInputs["command"] = args ? args.command : undefined;
resourceInputs["connections"] = args ? args.connections : undefined;
resourceInputs["defaultArguments"] = args ? args.defaultArguments : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["executionClass"] = args ? args.executionClass : undefined;
resourceInputs["executionProperty"] = args ? args.executionProperty : undefined;
resourceInputs["glueVersion"] = args ? args.glueVersion : undefined;
resourceInputs["jobMode"] = args ? args.jobMode : undefined;
resourceInputs["jobRunQueuingEnabled"] = args ? args.jobRunQueuingEnabled : undefined;
resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined;
resourceInputs["maxCapacity"] = args ? args.maxCapacity : undefined;
resourceInputs["maxRetries"] = args ? args.maxRetries : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["nonOverridableArguments"] = args ? args.nonOverridableArguments : undefined;
resourceInputs["notificationProperty"] = args ? args.notificationProperty : undefined;
resourceInputs["numberOfWorkers"] = args ? args.numberOfWorkers : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["roleArn"] = args ? args.roleArn : undefined;
resourceInputs["securityConfiguration"] = args ? args.securityConfiguration : undefined;
resourceInputs["sourceControlDetails"] = args ? args.sourceControlDetails : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["timeout"] = args ? args.timeout : undefined;
resourceInputs["workerType"] = args ? args.workerType : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Job.__pulumiType, name, resourceInputs, opts);
}
}
exports.Job = Job;
/** @internal */
Job.__pulumiType = 'aws:glue/job:Job';
//# sourceMappingURL=job.js.map