@aws-cdk/aws-glue-alpha 2.176.0-alpha.0 → 2.178.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.jsii +6187 -3907
  2. package/.jsii.tabl.json.gz +0 -0
  3. package/.warnings.jsii.js +525 -235
  4. package/README.md +422 -159
  5. package/awslint.json +5 -5
  6. package/lib/code.js +4 -5
  7. package/lib/connection.js +15 -3
  8. package/lib/constants.d.ts +261 -0
  9. package/lib/constants.js +281 -0
  10. package/lib/data-format.js +5 -5
  11. package/lib/data-quality-ruleset.js +6 -3
  12. package/lib/database.js +5 -2
  13. package/lib/external-table.js +20 -2
  14. package/lib/index.d.ts +13 -2
  15. package/lib/index.js +14 -3
  16. package/lib/jobs/job.d.ts +393 -0
  17. package/lib/jobs/job.js +298 -0
  18. package/lib/jobs/pyspark-etl-job.d.ts +81 -0
  19. package/lib/jobs/pyspark-etl-job.js +130 -0
  20. package/lib/jobs/pyspark-flex-etl-job.d.ts +83 -0
  21. package/lib/jobs/pyspark-flex-etl-job.js +137 -0
  22. package/lib/jobs/pyspark-streaming-job.d.ts +81 -0
  23. package/lib/jobs/pyspark-streaming-job.js +130 -0
  24. package/lib/jobs/python-shell-job.d.ts +55 -0
  25. package/lib/jobs/python-shell-job.js +99 -0
  26. package/lib/jobs/ray-job.d.ts +44 -0
  27. package/lib/jobs/ray-job.js +89 -0
  28. package/lib/jobs/scala-spark-etl-job.d.ts +78 -0
  29. package/lib/jobs/scala-spark-etl-job.js +134 -0
  30. package/lib/jobs/scala-spark-flex-etl-job.d.ts +109 -0
  31. package/lib/jobs/scala-spark-flex-etl-job.js +143 -0
  32. package/lib/jobs/scala-spark-streaming-job.d.ts +77 -0
  33. package/lib/jobs/scala-spark-streaming-job.js +131 -0
  34. package/lib/jobs/spark-ui-utils.d.ts +53 -0
  35. package/lib/jobs/spark-ui-utils.js +26 -0
  36. package/lib/s3-table.d.ts +4 -4
  37. package/lib/s3-table.js +20 -2
  38. package/lib/schema.d.ts +1 -1
  39. package/lib/schema.js +2 -2
  40. package/lib/security-configuration.js +5 -2
  41. package/lib/storage-parameter.js +1 -1
  42. package/lib/table-base.d.ts +1 -1
  43. package/lib/table-base.js +2 -2
  44. package/lib/table-deprecated.js +1 -1
  45. package/lib/triggers/trigger-options.d.ts +205 -0
  46. package/lib/triggers/trigger-options.js +39 -0
  47. package/lib/triggers/workflow.d.ts +203 -0
  48. package/lib/triggers/workflow.js +371 -0
  49. package/package.json +8 -8
  50. package/rosetta/default.ts-fixture +1 -1
  51. package/lib/job-executable.d.ts +0 -384
  52. package/lib/job-executable.js +0 -348
  53. package/lib/job.d.ts +0 -574
  54. package/lib/job.js +0 -531
@@ -0,0 +1,393 @@
1
+ import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
2
+ import * as events from 'aws-cdk-lib/aws-events';
3
+ import * as iam from 'aws-cdk-lib/aws-iam';
4
+ import * as logs from 'aws-cdk-lib/aws-logs';
5
+ import * as cdk from 'aws-cdk-lib/core';
6
+ import * as constructs from 'constructs';
7
+ import { Code } from '..';
8
+ import { MetricType, JobState, WorkerType, GlueVersion } from '../constants';
9
+ import { IConnection } from '../connection';
10
+ import { ISecurityConfiguration } from '../security-configuration';
11
+ /**
12
+ * Interface representing a new or an imported Glue Job
13
+ */
14
+ export interface IJob extends cdk.IResource, iam.IGrantable {
15
+ /**
16
+ * The name of the job.
17
+ * @attribute
18
+ */
19
+ readonly jobName: string;
20
+ /**
21
+ * The ARN of the job.
22
+ * @attribute
23
+ */
24
+ readonly jobArn: string;
25
+ /**
26
+ * Defines a CloudWatch event rule triggered when something happens with this job.
27
+ *
28
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#glue-event-types
29
+ */
30
+ onEvent(id: string, options?: events.OnEventOptions): events.Rule;
31
+ /**
32
+ * Defines a CloudWatch event rule triggered when this job moves to the SUCCEEDED state.
33
+ *
34
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#glue-event-types
35
+ */
36
+ onSuccess(id: string, options?: events.OnEventOptions): events.Rule;
37
+ /**
38
+ * Defines a CloudWatch event rule triggered when this job moves to the FAILED state.
39
+ *
40
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#glue-event-types
41
+ */
42
+ onFailure(id: string, options?: events.OnEventOptions): events.Rule;
43
+ /**
44
+ * Defines a CloudWatch event rule triggered when this job moves to the TIMEOUT state.
45
+ *
46
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#glue-event-types
47
+ */
48
+ onTimeout(id: string, options?: events.OnEventOptions): events.Rule;
49
+ /**
50
+ * Create a CloudWatch metric.
51
+ *
52
+ * @param metricName name of the metric typically prefixed with `glue.driver.`, `glue.<executorId>.` or `glue.ALL.`.
53
+ * @param type the metric type.
54
+ * @param props metric options.
55
+ *
56
+ * @see https://docs.aws.amazon.com/glue/latest/dg/monitoring-awsglue-with-cloudwatch-metrics.html
57
+ */
58
+ metric(metricName: string, type: MetricType, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
59
+ /**
60
+ * Create a CloudWatch Metric indicating job success.
61
+ */
62
+ metricSuccess(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
63
+ /**
64
+ * Create a CloudWatch Metric indicating job failure.
65
+ */
66
+ metricFailure(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
67
+ /**
68
+ * Create a CloudWatch Metric indicating job timeout.
69
+ */
70
+ metricTimeout(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
71
+ }
72
+ /**
73
+ * Properties for enabling Continuous Logging for Glue Jobs.
74
+ *
75
+ * @see https://docs.aws.amazon.com/glue/latest/dg/monitor-continuous-logging-enable.html
76
+ * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html
77
+ */
78
+ export interface ContinuousLoggingProps {
79
+ /**
80
+ * Enable continouous logging.
81
+ */
82
+ readonly enabled: boolean;
83
+ /**
84
+ * Specify a custom CloudWatch log group name.
85
+ *
86
+ * @default - a log group is created with name `/aws-glue/jobs/logs-v2/`.
87
+ */
88
+ readonly logGroup?: logs.ILogGroup;
89
+ /**
90
+ * Specify a custom CloudWatch log stream prefix.
91
+ *
92
+ * @default - the job run ID.
93
+ */
94
+ readonly logStreamPrefix?: string;
95
+ /**
96
+ * Filter out non-useful Apache Spark driver/executor and Apache Hadoop YARN heartbeat log messages.
97
+ *
98
+ * @default true
99
+ */
100
+ readonly quiet?: boolean;
101
+ /**
102
+ * Apply the provided conversion pattern.
103
+ *
104
+ * This is a Log4j Conversion Pattern to customize driver and executor logs.
105
+ *
106
+ * @default `%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n`
107
+ */
108
+ readonly conversionPattern?: string;
109
+ }
110
+ /**
111
+ * A base class is needed to be able to import existing Jobs into a CDK app to
112
+ * reference as part of a larger stack or construct. JobBase has the subset
113
+ * of attribtues required to idenitfy and reference an existing Glue Job,
114
+ * as well as some CloudWatch metric conveneince functions to configure an
115
+ * event-driven flow using the job.
116
+ */
117
+ export declare abstract class JobBase extends cdk.Resource implements IJob {
118
+ abstract readonly jobArn: string;
119
+ abstract readonly jobName: string;
120
+ abstract readonly grantPrincipal: iam.IPrincipal;
121
+ /**
122
+ * Create a CloudWatch Event Rule for this Glue Job when it's in a given state
123
+ *
124
+ * @param id construct id
125
+ * @param options event options. Note that some values are overridden if provided, these are
126
+ * - eventPattern.source = ['aws.glue']
127
+ * - eventPattern.detailType = ['Glue Job State Change', 'Glue Job Run Status']
128
+ * - eventPattern.detail.jobName = [this.jobName]
129
+ *
130
+ * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#glue-event-types
131
+ */
132
+ onEvent(id: string, options?: events.OnEventOptions): events.Rule;
133
+ /**
134
+ * Create a CloudWatch Event Rule for the transition into the input jobState.
135
+ *
136
+ * @param id construct id.
137
+ * @param jobState the job state.
138
+ * @param options optional event options.
139
+ */
140
+ protected onStateChange(id: string, jobState: JobState, options?: events.OnEventOptions): events.Rule;
141
+ /**
142
+ * Create a CloudWatch Event Rule matching JobState.SUCCEEDED.
143
+ *
144
+ * @param id construct id.
145
+ * @param options optional event options. default is {}.
146
+ */
147
+ onSuccess(id: string, options?: events.OnEventOptions): events.Rule;
148
+ /**
149
+ * Return a CloudWatch Event Rule matching FAILED state.
150
+ *
151
+ * @param id construct id.
152
+ * @param options optional event options. default is {}.
153
+ */
154
+ onFailure(id: string, options?: events.OnEventOptions): events.Rule;
155
+ /**
156
+ * Return a CloudWatch Event Rule matching TIMEOUT state.
157
+ *
158
+ * @param id construct id.
159
+ * @param options optional event options. default is {}.
160
+ */
161
+ onTimeout(id: string, options?: events.OnEventOptions): events.Rule;
162
+ /**
163
+ * Create a CloudWatch metric.
164
+ *
165
+ * @param metricName name of the metric typically prefixed with `glue.driver.`, `glue.<executorId>.` or `glue.ALL.`.
166
+ * @param type the metric type.
167
+ * @param props metric options.
168
+ *
169
+ * @see https://docs.aws.amazon.com/glue/latest/dg/monitoring-awsglue-with-cloudwatch-metrics.html
170
+ */
171
+ metric(metricName: string, type: MetricType, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
172
+ /**
173
+ * Return a CloudWatch Metric indicating job success.
174
+ *
175
+ * This metric is based on the Rule returned by no-args onSuccess() call.
176
+ */
177
+ metricSuccess(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
178
+ /**
179
+ * Return a CloudWatch Metric indicating job failure.
180
+ *
181
+ * This metric is based on the Rule returned by no-args onFailure() call.
182
+ */
183
+ metricFailure(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
184
+ /**
185
+ * Return a CloudWatch Metric indicating job timeout.
186
+ *
187
+ * This metric is based on the Rule returned by no-args onTimeout() call.
188
+ */
189
+ metricTimeout(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
190
+ /**
191
+ * Creates or retrieves a singleton event rule for the input job state for use with the metric JobState methods.
192
+ *
193
+ * @param id construct id.
194
+ * @param jobState the job state.
195
+ */
196
+ private metricJobStateRule;
197
+ /**
198
+ * Returns the job arn
199
+ */
200
+ protected buildJobArn(scope: constructs.Construct, jobName: string): string;
201
+ }
202
+ /**
203
+ * A subset of Job attributes are required for importing an existing job
204
+ * into a CDK project. This is ionly used when using fromJobAttributes
205
+ * to identify and reference the existing job.
206
+ */
207
+ export interface JobImportAttributes {
208
+ /**
209
+ * The name of the job.
210
+ */
211
+ readonly jobName: string;
212
+ /**
213
+ * The IAM role assumed by Glue to run this job.
214
+ *
215
+ * @default - undefined
216
+ */
217
+ readonly role?: iam.IRole;
218
+ }
219
+ /**
220
+ * JobProperties will be used to create new Glue Jobs using this L2 Construct.
221
+ */
222
+ export interface JobProperties {
223
+ /**
224
+ * Script Code Location (required)
225
+ * Script to run when the Glue job executes. Can be uploaded
226
+ * from the local directory structure using fromAsset
227
+ * or referenced via S3 location using fromBucket
228
+ */
229
+ readonly script: Code;
230
+ /**
231
+ * IAM Role (required)
232
+ * IAM Role to use for Glue job execution
233
+ * Must be specified by the developer because the L2 doesn't have visibility
234
+ * into the actions the script(s) takes during the job execution
235
+ * The role must trust the Glue service principal (glue.amazonaws.com)
236
+ * and be granted sufficient permissions.
237
+ *
238
+ * @see https://docs.aws.amazon.com/glue/latest/dg/getting-started-access.html
239
+ */
240
+ readonly role: iam.IRole;
241
+ /**
242
+ * Name of the Glue job (optional)
243
+ * Developer-specified name of the Glue job
244
+ *
245
+ * @default - a name is automatically generated
246
+ */
247
+ readonly jobName?: string;
248
+ /**
249
+ * Description (optional)
250
+ * Developer-specified description of the Glue job
251
+ *
252
+ * @default - no value
253
+ */
254
+ readonly description?: string;
255
+ /**
256
+ * Number of Workers (optional)
257
+ * Number of workers for Glue to use during job execution
258
+ *
259
+ * @default 10
260
+ */
261
+ readonly numberOfWorkers?: number;
262
+ /**
263
+ * Worker Type (optional)
264
+ * Type of Worker for Glue to use during job execution
265
+ * Enum options: Standard, G_1X, G_2X, G_025X. G_4X, G_8X, Z_2X
266
+ *
267
+ * @default WorkerType.G_1X
268
+ */
269
+ readonly workerType?: WorkerType;
270
+ /**
271
+ * Max Concurrent Runs (optional)
272
+ * The maximum number of runs this Glue job can concurrently run
273
+ *
274
+ * An error is returned when this threshold is reached. The maximum value
275
+ * you can specify is controlled by a service limit.
276
+ *
277
+ * @default 1
278
+ */
279
+ readonly maxConcurrentRuns?: number;
280
+ /**
281
+ * Default Arguments (optional)
282
+ * The default arguments for every run of this Glue job,
283
+ * specified as name-value pairs.
284
+ *
285
+ * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html
286
+ * for a list of reserved parameters
287
+ * @default - no arguments
288
+ */
289
+ readonly defaultArguments?: {
290
+ [key: string]: string;
291
+ };
292
+ /**
293
+ * Connections (optional)
294
+ * List of connections to use for this Glue job
295
+ * Connections are used to connect to other AWS Service or resources within a VPC.
296
+ *
297
+ * @default [] - no connections are added to the job
298
+ */
299
+ readonly connections?: IConnection[];
300
+ /**
301
+ * Max Retries (optional)
302
+ * Maximum number of retry attempts Glue performs if the job fails
303
+ *
304
+ * @default 0
305
+ */
306
+ readonly maxRetries?: number;
307
+ /**
308
+ * Timeout (optional)
309
+ * The maximum time that a job run can consume resources before it is
310
+ * terminated and enters TIMEOUT status. Specified in minutes.
311
+ *
312
+ * @default 2880 (2 days for non-streaming)
313
+ *
314
+ */
315
+ readonly timeout?: cdk.Duration;
316
+ /**
317
+ * Security Configuration (optional)
318
+ * Defines the encryption options for the Glue job
319
+ *
320
+ * @default - no security configuration.
321
+ */
322
+ readonly securityConfiguration?: ISecurityConfiguration;
323
+ /**
324
+ * Tags (optional)
325
+ * A list of key:value pairs of tags to apply to this Glue job resources
326
+ *
327
+ * @default {} - no tags
328
+ */
329
+ readonly tags?: {
330
+ [key: string]: string;
331
+ };
332
+ /**
333
+ * Glue Version
334
+ * The version of Glue to use to execute this job
335
+ *
336
+ * @default 3.0 for ETL
337
+ */
338
+ readonly glueVersion?: GlueVersion;
339
+ /**
340
+ * Enables the collection of metrics for job profiling.
341
+ *
342
+ * @default - no profiling metrics emitted.
343
+ *
344
+ * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html
345
+ */
346
+ readonly enableProfilingMetrics?: boolean;
347
+ /**
348
+ * Enables continuous logging with the specified props.
349
+ *
350
+ * @default - continuous logging is enabled.
351
+ *
352
+ * @see https://docs.aws.amazon.com/glue/latest/dg/monitor-continuous-logging-enable.html
353
+ * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html
354
+ **/
355
+ readonly continuousLogging?: ContinuousLoggingProps;
356
+ }
357
+ /**
358
+ * A Glue Job.
359
+ * @resource AWS::Glue::Job
360
+ */
361
+ export declare abstract class Job extends JobBase {
362
+ /**
363
+ * Identifies an existing Glue Job from a subset of attributes that can
364
+ * be referenced from within another Stack or Construct.
365
+ *
366
+ * @param scope The scope creating construct (usually `this`)
367
+ * @param id The construct's id.
368
+ * @param attrs Attributes for the Glue Job we want to import
369
+ */
370
+ static fromJobAttributes(scope: constructs.Construct, id: string, attrs: JobImportAttributes): IJob;
371
+ /**
372
+ * The IAM role Glue assumes to run this job.
373
+ */
374
+ abstract readonly role: iam.IRole;
375
+ /**
376
+ * Check no usage of reserved arguments.
377
+ *
378
+ * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html
379
+ */
380
+ protected checkNoReservedArgs(defaultArguments?: {
381
+ [key: string]: string;
382
+ }): {
383
+ [key: string]: string;
384
+ } | undefined;
385
+ /**
386
+ * Setup Continuous Loggiung Properties
387
+ * @param role The IAM role to use for continuous logging
388
+ * @param props The properties for continuous logging configuration
389
+ * @returns String containing the args for the continuous logging command
390
+ */
391
+ setupContinuousLogging(role: iam.IRole, props: ContinuousLoggingProps | undefined): any;
392
+ protected codeS3ObjectUrl(code: Code): string;
393
+ }