@prismatic-io/components-aws-glue 0.0.0-stage → 0.0.1
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.
- package/README.md +64 -2
- package/dist/icon.png +0 -0
- package/dist/index.js +579 -0
- package/npm-dist/icon.png +0 -0
- package/npm-dist/index.cjs +810 -0
- package/npm-dist/index.d.cts +448 -0
- package/package.json +53 -4
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
let _prismatic_io_spectral = require("@prismatic-io/spectral");
|
|
2
|
+
let _aws_sdk_client_glue = require("@aws-sdk/client-glue");
|
|
3
|
+
let _aws_sdk_client_sts = require("@aws-sdk/client-sts");
|
|
4
|
+
//#region ../../packages/aws-utils/dist/connection/assumeRole.js
|
|
5
|
+
var __awaiter$3 = function(thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) {
|
|
7
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
8
|
+
resolve(value);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
12
|
+
function fulfilled(value) {
|
|
13
|
+
try {
|
|
14
|
+
step(generator.next(value));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
reject(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function rejected(value) {
|
|
20
|
+
try {
|
|
21
|
+
step(generator["throw"](value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function step(result) {
|
|
27
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
28
|
+
}
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const assumeRole = (region, accessKeyId, secretAccessKey, roleArn, externalId) => __awaiter$3(void 0, void 0, void 0, function* () {
|
|
33
|
+
const { Credentials: { AccessKeyId, SecretAccessKey, SessionToken } } = yield new _aws_sdk_client_sts.STSClient(Object.assign(Object.assign({}, region.length > 0 && { region }), { credentials: {
|
|
34
|
+
accessKeyId,
|
|
35
|
+
secretAccessKey
|
|
36
|
+
} })).send(new _aws_sdk_client_sts.AssumeRoleCommand({
|
|
37
|
+
RoleArn: _prismatic_io_spectral.util.types.toString(roleArn),
|
|
38
|
+
RoleSessionName: "integration-session",
|
|
39
|
+
ExternalId: externalId
|
|
40
|
+
}));
|
|
41
|
+
return {
|
|
42
|
+
accessKeyId: AccessKeyId,
|
|
43
|
+
secretAccessKey: SecretAccessKey,
|
|
44
|
+
sessionToken: SessionToken
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../packages/aws-utils/dist/connection/assumeRoleConnection.js
|
|
49
|
+
const assumeRoleConnection = {
|
|
50
|
+
key: "awsAssumeRole",
|
|
51
|
+
display: {
|
|
52
|
+
label: "AWS Role ARN",
|
|
53
|
+
description: "Connect to AWS using an assumed role"
|
|
54
|
+
},
|
|
55
|
+
inputs: {
|
|
56
|
+
roleARN: {
|
|
57
|
+
label: "Role ARN",
|
|
58
|
+
placeholder: "arn:aws:iam::OtherAccount-ID:role/assumed-role-name",
|
|
59
|
+
type: "string",
|
|
60
|
+
required: true,
|
|
61
|
+
shown: true,
|
|
62
|
+
comments: "An AWS IAM Role ARN",
|
|
63
|
+
example: "arn:aws:iam::OtherAccount-ID:role/assumed-role-name"
|
|
64
|
+
},
|
|
65
|
+
accessKeyId: {
|
|
66
|
+
label: "Access Key ID",
|
|
67
|
+
placeholder: "Access Key ID",
|
|
68
|
+
type: "string",
|
|
69
|
+
required: true,
|
|
70
|
+
shown: true,
|
|
71
|
+
comments: "An AWS IAM Access Key ID",
|
|
72
|
+
example: "AKIAIOSFODNN7EXAMPLE"
|
|
73
|
+
},
|
|
74
|
+
secretAccessKey: {
|
|
75
|
+
label: "Secret Access Key",
|
|
76
|
+
placeholder: "Secret Access Key",
|
|
77
|
+
type: "password",
|
|
78
|
+
required: true,
|
|
79
|
+
shown: true,
|
|
80
|
+
comments: "An AWS IAM Secret Access Key",
|
|
81
|
+
example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
|
82
|
+
},
|
|
83
|
+
externalId: {
|
|
84
|
+
label: "External ID",
|
|
85
|
+
placeholder: "shared-common-secret",
|
|
86
|
+
type: "string",
|
|
87
|
+
required: false,
|
|
88
|
+
shown: true,
|
|
89
|
+
comments: "Provides enhanced security measures to the connection. Optional, but recommended. Please check [AWS docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html#id_roles_third-party_external-id) for more information.",
|
|
90
|
+
example: "shared-common-secret"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../../packages/aws-utils/dist/helpers/misc.js
|
|
96
|
+
const toTrimmedString = (value) => _prismatic_io_spectral.util.types.toString(value).trim();
|
|
97
|
+
const toOptionalString$1 = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region ../../packages/aws-utils/dist/data/awsRegions.js
|
|
100
|
+
const awsRegions = [
|
|
101
|
+
"af-south-1",
|
|
102
|
+
"ap-east-1",
|
|
103
|
+
"ap-east-2",
|
|
104
|
+
"ap-northeast-1",
|
|
105
|
+
"ap-northeast-2",
|
|
106
|
+
"ap-northeast-3",
|
|
107
|
+
"ap-south-1",
|
|
108
|
+
"ap-south-2",
|
|
109
|
+
"ap-southeast-1",
|
|
110
|
+
"ap-southeast-2",
|
|
111
|
+
"ap-southeast-3",
|
|
112
|
+
"ap-southeast-4",
|
|
113
|
+
"ap-southeast-5",
|
|
114
|
+
"ap-southeast-6",
|
|
115
|
+
"ap-southeast-7",
|
|
116
|
+
"ca-central-1",
|
|
117
|
+
"ca-west-1",
|
|
118
|
+
"eu-central-1",
|
|
119
|
+
"eu-central-2",
|
|
120
|
+
"eu-north-1",
|
|
121
|
+
"eu-south-1",
|
|
122
|
+
"eu-south-2",
|
|
123
|
+
"eu-west-1",
|
|
124
|
+
"eu-west-2",
|
|
125
|
+
"eu-west-3",
|
|
126
|
+
"il-central-1",
|
|
127
|
+
"me-central-1",
|
|
128
|
+
"me-south-1",
|
|
129
|
+
"mx-central-1",
|
|
130
|
+
"sa-east-1",
|
|
131
|
+
"us-east-1",
|
|
132
|
+
"us-east-2",
|
|
133
|
+
"us-gov-east-1",
|
|
134
|
+
"us-gov-west-1",
|
|
135
|
+
"us-west-1",
|
|
136
|
+
"us-west-2"
|
|
137
|
+
];
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region ../../packages/aws-utils/dist/dataSources/selectRegion.js
|
|
140
|
+
var __awaiter$1 = function(thisArg, _arguments, P, generator) {
|
|
141
|
+
function adopt(value) {
|
|
142
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
143
|
+
resolve(value);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
147
|
+
function fulfilled(value) {
|
|
148
|
+
try {
|
|
149
|
+
step(generator.next(value));
|
|
150
|
+
} catch (e) {
|
|
151
|
+
reject(e);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function rejected(value) {
|
|
155
|
+
try {
|
|
156
|
+
step(generator["throw"](value));
|
|
157
|
+
} catch (e) {
|
|
158
|
+
reject(e);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function step(result) {
|
|
162
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
163
|
+
}
|
|
164
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
const selectRegion = (0, _prismatic_io_spectral.dataSource)({
|
|
168
|
+
display: {
|
|
169
|
+
label: "Select AWS Region",
|
|
170
|
+
description: "Select an AWS region"
|
|
171
|
+
},
|
|
172
|
+
dataSourceType: "picklist",
|
|
173
|
+
perform: () => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
174
|
+
return Promise.resolve({ result: awsRegions.map((region) => ({
|
|
175
|
+
label: region,
|
|
176
|
+
key: region
|
|
177
|
+
})) });
|
|
178
|
+
}),
|
|
179
|
+
inputs: {}
|
|
180
|
+
});
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region ../../packages/aws-utils/dist/inputs/awsRegion.js
|
|
183
|
+
const awsRegion = (0, _prismatic_io_spectral.input)({
|
|
184
|
+
label: "AWS Region",
|
|
185
|
+
placeholder: "AWS Region",
|
|
186
|
+
type: "string",
|
|
187
|
+
required: false,
|
|
188
|
+
comments: "AWS provides services in multiple regions, like us-west-2 or eu-west-1.",
|
|
189
|
+
example: "us-east-1",
|
|
190
|
+
dataSource: "selectRegion",
|
|
191
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
192
|
+
});
|
|
193
|
+
(0, _prismatic_io_spectral.input)({
|
|
194
|
+
label: "Connection",
|
|
195
|
+
type: "connection",
|
|
196
|
+
required: false
|
|
197
|
+
});
|
|
198
|
+
(0, _prismatic_io_spectral.input)({
|
|
199
|
+
label: "Dynamic Access Key ID",
|
|
200
|
+
type: "string",
|
|
201
|
+
required: false,
|
|
202
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
203
|
+
comments: "Use this input to authenticate with AWS if you are using a dynamically-generated access key. Otherwise, use the connection to enter a static access key ID."
|
|
204
|
+
});
|
|
205
|
+
(0, _prismatic_io_spectral.input)({
|
|
206
|
+
label: "Dynamic Secret Access Key",
|
|
207
|
+
type: "password",
|
|
208
|
+
required: false,
|
|
209
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
210
|
+
comments: "Use this input to authenticate with AWS if you are using a dynamically-generated secret access key. Otherwise, use the connection to enter a static secret access key."
|
|
211
|
+
});
|
|
212
|
+
(0, _prismatic_io_spectral.input)({
|
|
213
|
+
label: "Dynamic Session Token",
|
|
214
|
+
type: "password",
|
|
215
|
+
required: false,
|
|
216
|
+
clean: (value) => _prismatic_io_spectral.util.types.toString(value) || void 0,
|
|
217
|
+
comments: "Use this input to authenticate with AWS if you are using a OPTIONAL dynamically-generated session token."
|
|
218
|
+
});
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/connections/accessKeySecretPair.ts
|
|
221
|
+
const accessKeySecretPair = (0, _prismatic_io_spectral.connection)({
|
|
222
|
+
key: "apiKeySecret",
|
|
223
|
+
display: {
|
|
224
|
+
label: "Access Key and Secret",
|
|
225
|
+
description: "Authenticate requests to AWS Glue using an Access Key and Secret."
|
|
226
|
+
},
|
|
227
|
+
inputs: {
|
|
228
|
+
accessKeyId: {
|
|
229
|
+
label: "Access Key ID",
|
|
230
|
+
placeholder: "Access Key ID",
|
|
231
|
+
type: "string",
|
|
232
|
+
required: true,
|
|
233
|
+
shown: true,
|
|
234
|
+
comments: "The AWS IAM Access Key ID used to authenticate requests.",
|
|
235
|
+
example: "AKIAIOSFODNN7EXAMPLE"
|
|
236
|
+
},
|
|
237
|
+
secretAccessKey: {
|
|
238
|
+
label: "Secret Access Key",
|
|
239
|
+
placeholder: "Secret Access Key",
|
|
240
|
+
type: "password",
|
|
241
|
+
required: true,
|
|
242
|
+
shown: true,
|
|
243
|
+
comments: "The AWS IAM Secret Access Key used to authenticate requests.",
|
|
244
|
+
example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/connections/index.ts
|
|
250
|
+
var connections_default = [accessKeySecretPair, assumeRoleConnection];
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/client.ts
|
|
253
|
+
const validateConnection = (connection) => {
|
|
254
|
+
if (![accessKeySecretPair.key, assumeRoleConnection.key].includes(connection.key)) throw new _prismatic_io_spectral.ConnectionError(connection, `Unsupported connection method ${connection.key}.`);
|
|
255
|
+
};
|
|
256
|
+
const getCredentials = (connection) => {
|
|
257
|
+
validateConnection(connection);
|
|
258
|
+
return {
|
|
259
|
+
accessKeyId: toTrimmedString(connection.fields.accessKeyId),
|
|
260
|
+
secretAccessKey: toTrimmedString(connection.fields.secretAccessKey)
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
const createClient = async ({ awsRegion, awsConnection }) => {
|
|
264
|
+
const { accessKeyId, secretAccessKey } = getCredentials(awsConnection);
|
|
265
|
+
const credentials = awsConnection.key === assumeRoleConnection.key ? await assumeRole(awsRegion, accessKeyId, secretAccessKey, toTrimmedString(awsConnection.fields.roleARN), toOptionalString$1(awsConnection.fields?.externalId)) : {
|
|
266
|
+
accessKeyId,
|
|
267
|
+
secretAccessKey
|
|
268
|
+
};
|
|
269
|
+
const region = awsRegion.length > 0 ? awsRegion : void 0;
|
|
270
|
+
try {
|
|
271
|
+
return new _aws_sdk_client_glue.GlueClient({
|
|
272
|
+
region,
|
|
273
|
+
credentials
|
|
274
|
+
});
|
|
275
|
+
} catch (err) {
|
|
276
|
+
throw new _prismatic_io_spectral.ConnectionError(awsConnection, `Invalid AWS Credentials have been configured. This is sometimes caused by missing characters from a copy/paste. Original AWS error message: ${err.message}`);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/examplePayloads.ts
|
|
281
|
+
const getJobRunExamplePayload = { data: { JobRun: {
|
|
282
|
+
Id: "jr_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
|
|
283
|
+
Attempt: 0,
|
|
284
|
+
JobName: "my-etl-job",
|
|
285
|
+
StartedOn: /* @__PURE__ */ new Date("2026-03-15T10:30:00.000Z"),
|
|
286
|
+
LastModifiedOn: /* @__PURE__ */ new Date("2026-03-15T10:35:00.000Z"),
|
|
287
|
+
CompletedOn: /* @__PURE__ */ new Date("2026-03-15T10:35:00.000Z"),
|
|
288
|
+
JobRunState: "SUCCEEDED",
|
|
289
|
+
Arguments: { "--job-language": "python" },
|
|
290
|
+
PredecessorRuns: [],
|
|
291
|
+
ExecutionTime: 300,
|
|
292
|
+
Timeout: 2880,
|
|
293
|
+
WorkerType: "G.1X",
|
|
294
|
+
NumberOfWorkers: 10,
|
|
295
|
+
LogGroupName: "/aws-glue/jobs",
|
|
296
|
+
GlueVersion: "3.0",
|
|
297
|
+
ExecutionClass: "STANDARD"
|
|
298
|
+
} } };
|
|
299
|
+
const listCrawlersExamplePayload = { data: { CrawlerNames: ["s3-data-crawler", "rds-inventory-crawler"] } };
|
|
300
|
+
const listJobsExamplePayload = { data: { JobNames: ["my-etl-job", "daily-data-transform"] } };
|
|
301
|
+
const listTriggersExamplePayload = { data: { TriggerNames: ["scheduled-etl-trigger", "on-demand-transform-trigger"] } };
|
|
302
|
+
const startCrawlerExamplePayload = { data: {} };
|
|
303
|
+
const startJobRunExamplePayload = { data: { JobRunId: "jr_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6" } };
|
|
304
|
+
const startTriggerExamplePayload = { data: { Name: "scheduled-etl-trigger" } };
|
|
305
|
+
const stopCrawlerExamplePayload = { data: {} };
|
|
306
|
+
const stopJobRunExamplePayload = { data: {
|
|
307
|
+
SuccessfulSubmissions: [{
|
|
308
|
+
JobName: "my-etl-job",
|
|
309
|
+
JobRunId: "jr_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"
|
|
310
|
+
}],
|
|
311
|
+
Errors: []
|
|
312
|
+
} };
|
|
313
|
+
const stopTriggerExamplePayload = { data: { Name: "scheduled-etl-trigger" } };
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/util/cleanInput.ts
|
|
316
|
+
const toOptionalString = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
|
|
317
|
+
const toOptionalInt = (value) => value ? _prismatic_io_spectral.util.types.toInt(value) : void 0;
|
|
318
|
+
const toStringRecord = (value) => _prismatic_io_spectral.util.types.keyValPairListToObject(value);
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/inputs/common.ts
|
|
321
|
+
const connectionInput = (0, _prismatic_io_spectral.input)({
|
|
322
|
+
label: "Connection",
|
|
323
|
+
type: "connection",
|
|
324
|
+
required: true,
|
|
325
|
+
comments: "The AWS Glue connection to use."
|
|
326
|
+
});
|
|
327
|
+
const name = (0, _prismatic_io_spectral.input)({
|
|
328
|
+
label: "Name",
|
|
329
|
+
placeholder: "Enter the job, crawler, or trigger name",
|
|
330
|
+
type: "string",
|
|
331
|
+
required: true,
|
|
332
|
+
comments: "The name of the resource (job, crawler, or trigger) to act on. Provide the name, not the ARN.",
|
|
333
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
334
|
+
});
|
|
335
|
+
const maxItems = (0, _prismatic_io_spectral.input)({
|
|
336
|
+
label: "Max Items",
|
|
337
|
+
type: "string",
|
|
338
|
+
required: false,
|
|
339
|
+
comments: "The maximum number of results to return. Provide a value from 1 to 50.",
|
|
340
|
+
example: `20`,
|
|
341
|
+
clean: toOptionalInt
|
|
342
|
+
});
|
|
343
|
+
const marker = (0, _prismatic_io_spectral.input)({
|
|
344
|
+
label: "Marker",
|
|
345
|
+
type: "string",
|
|
346
|
+
required: false,
|
|
347
|
+
comments: "The pagination token returned by a previous request, used to retrieve the next page of results.",
|
|
348
|
+
example: `lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E`,
|
|
349
|
+
clean: toOptionalString
|
|
350
|
+
});
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/inputs/crawlers.ts
|
|
353
|
+
const crawlerName = {
|
|
354
|
+
...name,
|
|
355
|
+
dataSource: "selectCrawler"
|
|
356
|
+
};
|
|
357
|
+
const listCrawlersInputs = {
|
|
358
|
+
awsRegion,
|
|
359
|
+
maxItems,
|
|
360
|
+
marker,
|
|
361
|
+
awsConnection: connectionInput
|
|
362
|
+
};
|
|
363
|
+
const startCrawlerInputs = {
|
|
364
|
+
awsRegion,
|
|
365
|
+
name: crawlerName,
|
|
366
|
+
awsConnection: connectionInput
|
|
367
|
+
};
|
|
368
|
+
const stopCrawlerInputs = {
|
|
369
|
+
awsRegion,
|
|
370
|
+
name: crawlerName,
|
|
371
|
+
awsConnection: connectionInput
|
|
372
|
+
};
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/inputs/jobs.ts
|
|
375
|
+
const jobName = {
|
|
376
|
+
...name,
|
|
377
|
+
dataSource: "selectJob"
|
|
378
|
+
};
|
|
379
|
+
const args = (0, _prismatic_io_spectral.input)({
|
|
380
|
+
label: "Arguments",
|
|
381
|
+
placeholder: "Enter an argument name",
|
|
382
|
+
type: "string",
|
|
383
|
+
collection: "keyvaluelist",
|
|
384
|
+
required: false,
|
|
385
|
+
comments: "Optional key value parameters to pass into a job.",
|
|
386
|
+
clean: toStringRecord
|
|
387
|
+
});
|
|
388
|
+
const capacity = (0, _prismatic_io_spectral.input)({
|
|
389
|
+
label: "Allocated Capacity",
|
|
390
|
+
type: "string",
|
|
391
|
+
example: "10",
|
|
392
|
+
required: false,
|
|
393
|
+
comments: "The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. If this is omitted, Glue will use the default number of DPUs configured for the job.",
|
|
394
|
+
clean: _prismatic_io_spectral.util.types.toInt
|
|
395
|
+
});
|
|
396
|
+
const security = (0, _prismatic_io_spectral.input)({
|
|
397
|
+
label: "Security Configuration",
|
|
398
|
+
type: "string",
|
|
399
|
+
required: false,
|
|
400
|
+
comments: "The name of the SecurityConfiguration structure to be used with this job. This can be left blank if there is no security configuration.",
|
|
401
|
+
clean: toOptionalString
|
|
402
|
+
});
|
|
403
|
+
const jobRunIds = (0, _prismatic_io_spectral.input)({
|
|
404
|
+
label: "Job Run IDs",
|
|
405
|
+
type: "string",
|
|
406
|
+
collection: "valuelist",
|
|
407
|
+
required: true,
|
|
408
|
+
comments: "The job run identifiers to stop for the specified job."
|
|
409
|
+
});
|
|
410
|
+
const runId = (0, _prismatic_io_spectral.input)({
|
|
411
|
+
label: "Run ID",
|
|
412
|
+
type: "string",
|
|
413
|
+
required: true,
|
|
414
|
+
comments: "The unique identifier for the job run.",
|
|
415
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
416
|
+
});
|
|
417
|
+
const listJobsInputs = {
|
|
418
|
+
awsRegion,
|
|
419
|
+
marker,
|
|
420
|
+
maxItems,
|
|
421
|
+
awsConnection: connectionInput
|
|
422
|
+
};
|
|
423
|
+
const getJobRunInputs = {
|
|
424
|
+
awsRegion,
|
|
425
|
+
name: jobName,
|
|
426
|
+
runId,
|
|
427
|
+
awsConnection: connectionInput
|
|
428
|
+
};
|
|
429
|
+
const startJobRunInputs = {
|
|
430
|
+
awsRegion,
|
|
431
|
+
name: jobName,
|
|
432
|
+
capacity,
|
|
433
|
+
security,
|
|
434
|
+
args,
|
|
435
|
+
awsConnection: connectionInput
|
|
436
|
+
};
|
|
437
|
+
const stopJobRunInputs = {
|
|
438
|
+
awsRegion,
|
|
439
|
+
name: jobName,
|
|
440
|
+
jobRunIds,
|
|
441
|
+
awsConnection: connectionInput
|
|
442
|
+
};
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/inputs/triggers.ts
|
|
445
|
+
const triggerName = {
|
|
446
|
+
...name,
|
|
447
|
+
dataSource: "selectTrigger"
|
|
448
|
+
};
|
|
449
|
+
const listTriggersInputs = {
|
|
450
|
+
awsRegion,
|
|
451
|
+
maxItems,
|
|
452
|
+
marker,
|
|
453
|
+
awsConnection: connectionInput
|
|
454
|
+
};
|
|
455
|
+
const startTriggerInputs = {
|
|
456
|
+
awsRegion,
|
|
457
|
+
name: triggerName,
|
|
458
|
+
awsConnection: connectionInput
|
|
459
|
+
};
|
|
460
|
+
const stopTriggerInputs = {
|
|
461
|
+
awsRegion,
|
|
462
|
+
name: triggerName,
|
|
463
|
+
awsConnection: connectionInput
|
|
464
|
+
};
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/actions/crawlers/index.ts
|
|
467
|
+
var crawlers_default = {
|
|
468
|
+
listCrawlers: (0, _prismatic_io_spectral.action)({
|
|
469
|
+
display: {
|
|
470
|
+
label: "List Crawlers",
|
|
471
|
+
description: "Lists crawlers available in AWS Glue."
|
|
472
|
+
},
|
|
473
|
+
perform: async (_context, params) => {
|
|
474
|
+
const glue = await createClient({
|
|
475
|
+
awsRegion: params.awsRegion,
|
|
476
|
+
awsConnection: params.awsConnection
|
|
477
|
+
});
|
|
478
|
+
const command = new _aws_sdk_client_glue.ListCrawlersCommand({
|
|
479
|
+
MaxResults: params.maxItems,
|
|
480
|
+
NextToken: params.marker
|
|
481
|
+
});
|
|
482
|
+
return { data: await glue.send(command) };
|
|
483
|
+
},
|
|
484
|
+
inputs: listCrawlersInputs,
|
|
485
|
+
examplePayload: listCrawlersExamplePayload
|
|
486
|
+
}),
|
|
487
|
+
startCrawler: (0, _prismatic_io_spectral.action)({
|
|
488
|
+
display: {
|
|
489
|
+
label: "Start Crawler",
|
|
490
|
+
description: "Starts an existing crawler in AWS Glue."
|
|
491
|
+
},
|
|
492
|
+
perform: async (_context, { awsRegion, name, awsConnection }) => {
|
|
493
|
+
const glue = await createClient({
|
|
494
|
+
awsRegion,
|
|
495
|
+
awsConnection
|
|
496
|
+
});
|
|
497
|
+
const command = new _aws_sdk_client_glue.StartCrawlerCommand({ Name: name });
|
|
498
|
+
return { data: await glue.send(command) };
|
|
499
|
+
},
|
|
500
|
+
inputs: startCrawlerInputs,
|
|
501
|
+
examplePayload: startCrawlerExamplePayload
|
|
502
|
+
}),
|
|
503
|
+
stopCrawler: (0, _prismatic_io_spectral.action)({
|
|
504
|
+
display: {
|
|
505
|
+
label: "Stop Crawler",
|
|
506
|
+
description: "Stops the specified crawler if it is currently running."
|
|
507
|
+
},
|
|
508
|
+
perform: async (_context, { awsRegion, name, awsConnection }) => {
|
|
509
|
+
const glue = await createClient({
|
|
510
|
+
awsRegion,
|
|
511
|
+
awsConnection
|
|
512
|
+
});
|
|
513
|
+
const command = new _aws_sdk_client_glue.StopCrawlerCommand({ Name: name });
|
|
514
|
+
return { data: await glue.send(command) };
|
|
515
|
+
},
|
|
516
|
+
inputs: stopCrawlerInputs,
|
|
517
|
+
examplePayload: stopCrawlerExamplePayload
|
|
518
|
+
})
|
|
519
|
+
};
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/actions/jobs/index.ts
|
|
522
|
+
var jobs_default = {
|
|
523
|
+
getJobRun: (0, _prismatic_io_spectral.action)({
|
|
524
|
+
display: {
|
|
525
|
+
label: "Get Job Run",
|
|
526
|
+
description: "Retrieves the metadata for a given job run."
|
|
527
|
+
},
|
|
528
|
+
perform: async (_context, { awsRegion, name, runId, awsConnection }) => {
|
|
529
|
+
const glue = await createClient({
|
|
530
|
+
awsRegion,
|
|
531
|
+
awsConnection
|
|
532
|
+
});
|
|
533
|
+
const command = new _aws_sdk_client_glue.GetJobRunCommand({
|
|
534
|
+
JobName: name,
|
|
535
|
+
RunId: runId,
|
|
536
|
+
PredecessorsIncluded: false
|
|
537
|
+
});
|
|
538
|
+
return { data: await glue.send(command) };
|
|
539
|
+
},
|
|
540
|
+
inputs: getJobRunInputs,
|
|
541
|
+
examplePayload: getJobRunExamplePayload
|
|
542
|
+
}),
|
|
543
|
+
listJobs: (0, _prismatic_io_spectral.action)({
|
|
544
|
+
display: {
|
|
545
|
+
label: "List Jobs",
|
|
546
|
+
description: "Lists jobs available in AWS Glue."
|
|
547
|
+
},
|
|
548
|
+
perform: async (_context, params) => {
|
|
549
|
+
const glue = await createClient({
|
|
550
|
+
awsRegion: params.awsRegion,
|
|
551
|
+
awsConnection: params.awsConnection
|
|
552
|
+
});
|
|
553
|
+
const command = new _aws_sdk_client_glue.ListJobsCommand({
|
|
554
|
+
MaxResults: params.maxItems,
|
|
555
|
+
NextToken: params.marker
|
|
556
|
+
});
|
|
557
|
+
return { data: await glue.send(command) };
|
|
558
|
+
},
|
|
559
|
+
inputs: listJobsInputs,
|
|
560
|
+
examplePayload: listJobsExamplePayload
|
|
561
|
+
}),
|
|
562
|
+
startJobRun: (0, _prismatic_io_spectral.action)({
|
|
563
|
+
display: {
|
|
564
|
+
label: "Start Job Run",
|
|
565
|
+
description: "Starts a job run using an AWS Glue job definition."
|
|
566
|
+
},
|
|
567
|
+
perform: async (_context, { awsRegion, name, capacity, security, args, awsConnection }) => {
|
|
568
|
+
const glue = await createClient({
|
|
569
|
+
awsRegion,
|
|
570
|
+
awsConnection
|
|
571
|
+
});
|
|
572
|
+
const command = new _aws_sdk_client_glue.StartJobRunCommand({
|
|
573
|
+
JobName: name,
|
|
574
|
+
MaxCapacity: capacity,
|
|
575
|
+
Arguments: args,
|
|
576
|
+
SecurityConfiguration: security
|
|
577
|
+
});
|
|
578
|
+
return { data: await glue.send(command) };
|
|
579
|
+
},
|
|
580
|
+
inputs: startJobRunInputs,
|
|
581
|
+
examplePayload: startJobRunExamplePayload
|
|
582
|
+
}),
|
|
583
|
+
stopJobRun: (0, _prismatic_io_spectral.action)({
|
|
584
|
+
display: {
|
|
585
|
+
label: "Stop Job Run",
|
|
586
|
+
description: "Stops one or more job runs for a specified job definition."
|
|
587
|
+
},
|
|
588
|
+
perform: async (_context, { awsRegion, name, jobRunIds, awsConnection }) => {
|
|
589
|
+
const glue = await createClient({
|
|
590
|
+
awsRegion,
|
|
591
|
+
awsConnection
|
|
592
|
+
});
|
|
593
|
+
const command = new _aws_sdk_client_glue.BatchStopJobRunCommand({
|
|
594
|
+
JobName: name,
|
|
595
|
+
JobRunIds: jobRunIds.map((id) => _prismatic_io_spectral.util.types.toString(id))
|
|
596
|
+
});
|
|
597
|
+
return { data: await glue.send(command) };
|
|
598
|
+
},
|
|
599
|
+
inputs: stopJobRunInputs,
|
|
600
|
+
examplePayload: stopJobRunExamplePayload
|
|
601
|
+
})
|
|
602
|
+
};
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/actions/triggers/index.ts
|
|
605
|
+
var triggers_default = {
|
|
606
|
+
listTriggers: (0, _prismatic_io_spectral.action)({
|
|
607
|
+
display: {
|
|
608
|
+
label: "List Triggers",
|
|
609
|
+
description: "Lists the names of all triggers in the account."
|
|
610
|
+
},
|
|
611
|
+
perform: async (_context, params) => {
|
|
612
|
+
const glue = await createClient({
|
|
613
|
+
awsRegion: params.awsRegion,
|
|
614
|
+
awsConnection: params.awsConnection
|
|
615
|
+
});
|
|
616
|
+
const command = new _aws_sdk_client_glue.ListTriggersCommand({
|
|
617
|
+
MaxResults: params.maxItems,
|
|
618
|
+
NextToken: params.marker
|
|
619
|
+
});
|
|
620
|
+
return { data: await glue.send(command) };
|
|
621
|
+
},
|
|
622
|
+
inputs: listTriggersInputs,
|
|
623
|
+
examplePayload: listTriggersExamplePayload
|
|
624
|
+
}),
|
|
625
|
+
startTrigger: (0, _prismatic_io_spectral.action)({
|
|
626
|
+
display: {
|
|
627
|
+
label: "Start Trigger",
|
|
628
|
+
description: "Starts an existing trigger in AWS Glue."
|
|
629
|
+
},
|
|
630
|
+
perform: async (_context, { awsRegion, name, awsConnection }) => {
|
|
631
|
+
const glue = await createClient({
|
|
632
|
+
awsRegion,
|
|
633
|
+
awsConnection
|
|
634
|
+
});
|
|
635
|
+
const command = new _aws_sdk_client_glue.StartTriggerCommand({ Name: name });
|
|
636
|
+
return { data: await glue.send(command) };
|
|
637
|
+
},
|
|
638
|
+
inputs: startTriggerInputs,
|
|
639
|
+
examplePayload: startTriggerExamplePayload
|
|
640
|
+
}),
|
|
641
|
+
stopTrigger: (0, _prismatic_io_spectral.action)({
|
|
642
|
+
display: {
|
|
643
|
+
label: "Stop Trigger",
|
|
644
|
+
description: "Stops a specified trigger."
|
|
645
|
+
},
|
|
646
|
+
perform: async (_context, { awsRegion, name, awsConnection }) => {
|
|
647
|
+
const glue = await createClient({
|
|
648
|
+
awsRegion,
|
|
649
|
+
awsConnection
|
|
650
|
+
});
|
|
651
|
+
const command = new _aws_sdk_client_glue.StopTriggerCommand({ Name: name });
|
|
652
|
+
return { data: await glue.send(command) };
|
|
653
|
+
},
|
|
654
|
+
inputs: stopTriggerInputs,
|
|
655
|
+
examplePayload: stopTriggerExamplePayload
|
|
656
|
+
})
|
|
657
|
+
};
|
|
658
|
+
//#endregion
|
|
659
|
+
//#region src/actions/index.ts
|
|
660
|
+
var actions_default = {
|
|
661
|
+
...crawlers_default,
|
|
662
|
+
...jobs_default,
|
|
663
|
+
...triggers_default
|
|
664
|
+
};
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/dataSources/selectCrawler.ts
|
|
667
|
+
const selectCrawler = (0, _prismatic_io_spectral.dataSource)({
|
|
668
|
+
display: {
|
|
669
|
+
label: "Select Crawler",
|
|
670
|
+
description: "A picklist of crawlers available in the AWS Glue account."
|
|
671
|
+
},
|
|
672
|
+
inputs: {
|
|
673
|
+
awsRegion: {
|
|
674
|
+
...awsRegion,
|
|
675
|
+
dataSource: void 0
|
|
676
|
+
},
|
|
677
|
+
awsConnection: connectionInput
|
|
678
|
+
},
|
|
679
|
+
perform: async (_context, { awsRegion, awsConnection }) => {
|
|
680
|
+
const glue = await createClient({
|
|
681
|
+
awsRegion,
|
|
682
|
+
awsConnection
|
|
683
|
+
});
|
|
684
|
+
const allCrawlerNames = [];
|
|
685
|
+
let nextToken;
|
|
686
|
+
do {
|
|
687
|
+
const command = new _aws_sdk_client_glue.ListCrawlersCommand({
|
|
688
|
+
MaxResults: 50,
|
|
689
|
+
NextToken: nextToken
|
|
690
|
+
});
|
|
691
|
+
const response = await glue.send(command);
|
|
692
|
+
if (response.CrawlerNames) allCrawlerNames.push(...response.CrawlerNames);
|
|
693
|
+
nextToken = response.NextToken || void 0;
|
|
694
|
+
} while (nextToken);
|
|
695
|
+
return { result: allCrawlerNames.map((name) => ({
|
|
696
|
+
label: name,
|
|
697
|
+
key: name
|
|
698
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
699
|
+
},
|
|
700
|
+
dataSourceType: "picklist",
|
|
701
|
+
examplePayload: { result: [{
|
|
702
|
+
label: "Example Crawler",
|
|
703
|
+
key: "Example Crawler"
|
|
704
|
+
}] }
|
|
705
|
+
});
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/dataSources/index.ts
|
|
708
|
+
var dataSources_default = {
|
|
709
|
+
selectRegion,
|
|
710
|
+
selectJob: (0, _prismatic_io_spectral.dataSource)({
|
|
711
|
+
display: {
|
|
712
|
+
label: "Select Job",
|
|
713
|
+
description: "A picklist of jobs available in the AWS Glue account."
|
|
714
|
+
},
|
|
715
|
+
inputs: {
|
|
716
|
+
awsRegion: {
|
|
717
|
+
...awsRegion,
|
|
718
|
+
dataSource: void 0
|
|
719
|
+
},
|
|
720
|
+
awsConnection: connectionInput
|
|
721
|
+
},
|
|
722
|
+
perform: async (_context, { awsRegion, awsConnection }) => {
|
|
723
|
+
const glue = await createClient({
|
|
724
|
+
awsRegion,
|
|
725
|
+
awsConnection
|
|
726
|
+
});
|
|
727
|
+
const allJobNames = [];
|
|
728
|
+
let nextToken;
|
|
729
|
+
do {
|
|
730
|
+
const command = new _aws_sdk_client_glue.ListJobsCommand({
|
|
731
|
+
MaxResults: 50,
|
|
732
|
+
NextToken: nextToken
|
|
733
|
+
});
|
|
734
|
+
const response = await glue.send(command);
|
|
735
|
+
if (response.JobNames) allJobNames.push(...response.JobNames);
|
|
736
|
+
nextToken = response.NextToken || void 0;
|
|
737
|
+
} while (nextToken);
|
|
738
|
+
return { result: allJobNames.map((name) => ({
|
|
739
|
+
label: name,
|
|
740
|
+
key: name
|
|
741
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
742
|
+
},
|
|
743
|
+
dataSourceType: "picklist",
|
|
744
|
+
examplePayload: { result: [{
|
|
745
|
+
label: "Example Job",
|
|
746
|
+
key: "Example Job"
|
|
747
|
+
}] }
|
|
748
|
+
}),
|
|
749
|
+
selectCrawler,
|
|
750
|
+
selectTrigger: (0, _prismatic_io_spectral.dataSource)({
|
|
751
|
+
display: {
|
|
752
|
+
label: "Select Trigger",
|
|
753
|
+
description: "A picklist of triggers available in the AWS Glue account."
|
|
754
|
+
},
|
|
755
|
+
inputs: {
|
|
756
|
+
awsRegion: {
|
|
757
|
+
...awsRegion,
|
|
758
|
+
dataSource: void 0
|
|
759
|
+
},
|
|
760
|
+
awsConnection: connectionInput
|
|
761
|
+
},
|
|
762
|
+
perform: async (_context, { awsRegion, awsConnection }) => {
|
|
763
|
+
const glue = await createClient({
|
|
764
|
+
awsRegion,
|
|
765
|
+
awsConnection
|
|
766
|
+
});
|
|
767
|
+
const allTriggerNames = [];
|
|
768
|
+
let nextToken;
|
|
769
|
+
do {
|
|
770
|
+
const command = new _aws_sdk_client_glue.ListTriggersCommand({
|
|
771
|
+
MaxResults: 50,
|
|
772
|
+
NextToken: nextToken
|
|
773
|
+
});
|
|
774
|
+
const response = await glue.send(command);
|
|
775
|
+
if (response.TriggerNames) allTriggerNames.push(...response.TriggerNames);
|
|
776
|
+
nextToken = response.NextToken || void 0;
|
|
777
|
+
} while (nextToken);
|
|
778
|
+
return { result: allTriggerNames.map((name) => ({
|
|
779
|
+
label: name,
|
|
780
|
+
key: name
|
|
781
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
782
|
+
},
|
|
783
|
+
dataSourceType: "picklist",
|
|
784
|
+
examplePayload: { result: [{
|
|
785
|
+
label: "Example Trigger",
|
|
786
|
+
key: "Example Trigger"
|
|
787
|
+
}] }
|
|
788
|
+
})
|
|
789
|
+
};
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/index.ts
|
|
792
|
+
var src_default = (0, _prismatic_io_spectral.component)({
|
|
793
|
+
key: "aws-glue",
|
|
794
|
+
public: true,
|
|
795
|
+
documentationUrl: "https://prismatic.io/docs/components/aws-glue/",
|
|
796
|
+
display: {
|
|
797
|
+
label: "AWS Glue",
|
|
798
|
+
description: "Manage AWS Glue crawlers, jobs, and triggers.",
|
|
799
|
+
iconPath: "icon.png",
|
|
800
|
+
category: "Data Platforms"
|
|
801
|
+
},
|
|
802
|
+
actions: actions_default,
|
|
803
|
+
connections: connections_default,
|
|
804
|
+
dataSources: dataSources_default
|
|
805
|
+
});
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region npm-dist/.entry.ts
|
|
808
|
+
var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
|
|
809
|
+
//#endregion
|
|
810
|
+
module.exports = _entry_default;
|