@csermet/multiprovider
Version:
cloud-graph provider plugin for AWS used to fetch AWS cloud data.
66 lines (65 loc) • 2.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const sdk_1 = require("@cloudgraph/sdk");
const generateArns_1 = require("../../utils/generateArns");
/**
* GlueJob
*/
exports.default = ({ account, service: rawData, region, }) => {
const { Name: name, Description: description, LogUri: logUri, Role: role, CreatedOn: createdOn, LastModifiedOn: lastModifiedOn, ExecutionProperty: { MaxConcurrentRuns: maxConcurrentRuns } = {}, Command: { PythonVersion: pythonVersion, Name: commandName, ScriptLocation: scriptLocation, } = {}, DefaultArguments: defaultArguments, NonOverridableArguments: nonOverrideableArguments, Connections: { Connections: connections } = {}, MaxRetries: maxRetries, AllocatedCapacity: allocatedCapacity, Timeout: timeout, MaxCapacity: maxCapacity, WorkerType: workerType, NumberOfWorkers: numberOfWorkers, SecurityConfiguration: securityConfiguration, NotificationProperty: { NotifyDelayAfter: notifyDelayAfter } = {}, GlueVersion: glueVersion, } = rawData;
const arn = generateArns_1.glueJobArn({ region, account, name });
const mappedDefaultArguments = Object.keys(defaultArguments ?? {}).map(key => ({
id: sdk_1.generateUniqueId({
arn,
key,
value: defaultArguments[key],
}),
key,
value: defaultArguments[key],
}));
const mappedNonOverrideableArguments = Object.keys(nonOverrideableArguments ?? {}).map(key => ({
id: sdk_1.generateUniqueId({
arn,
key,
value: nonOverrideableArguments[key],
}),
key,
value: nonOverrideableArguments[key],
}));
return {
id: arn,
arn,
region,
accountId: account,
name,
description,
logUri,
role,
createdOn: createdOn?.toISOString(),
lastModifiedOn: lastModifiedOn?.toISOString(),
executionProperty: {
maxConcurrentRuns,
},
command: {
name: commandName,
pythonVersion,
scriptLocation,
},
defaultArguments: mappedDefaultArguments,
nonOverrideableArguments: mappedNonOverrideableArguments,
connections: {
connections,
},
maxRetries,
allocatedCapacity,
timeout,
maxCapacity,
workerType,
numberOfWorkers,
securityConfiguration,
notificationProperty: {
notifyDelayAfter,
},
glueVersion,
};
};