@csermet/multiprovider
Version:
cloud-graph provider plugin for AWS used to fetch AWS cloud data.
112 lines (111 loc) • 3.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const sdk_1 = require("@cloudgraph/sdk");
const format_1 = require("../../utils/format");
exports.default = ({ service, account: accountId, region, }) => {
const { arn, name, description, source, secondarySources = [], sourceVersion, secondarySourceVersions = [], artifacts, secondaryArtifacts = [], cache, environment, serviceRole, timeoutInMinutes, queuedTimeoutInMinutes, encryptionKey, created, lastModified, Tags = {}, webhook = {}, fileSystemLocations = [], vpcConfig, badge, logsConfig = {}, buildBatchConfig = {}, concurrentBuildLimit, projectVisibility, publicProjectAlias, resourceAccessRole, } = service;
const formattedEnv = {
...(environment ?? {}),
environmentVariables: environment?.environmentVariables.map(val => ({
id: sdk_1.generateUniqueId({
arn,
...val,
}),
...val,
})),
};
const mappedSecondaryArtifacts = secondaryArtifacts.map(val => ({
id: sdk_1.generateUniqueId({
arn,
...val,
}),
...val,
}));
const mappedSecondarySources = secondarySources.map(val => ({
id: sdk_1.generateUniqueId({
arn,
...val,
}),
...val,
}));
const mappedFileSystemLocations = fileSystemLocations.map(val => ({
id: sdk_1.generateUniqueId({
arn,
...val,
}),
...val,
}));
const mappedSecondarySourceVersions = secondarySourceVersions.map(val => ({
id: sdk_1.generateUniqueId({
arn,
...val,
}),
...val,
}));
const formattedWebhook = {
...(webhook ?? {}),
filterGroups: webhook?.filterGroups?.map(val => ({
id: sdk_1.generateUniqueId({
arn,
...val,
}),
data: val.map(nestedVal => ({
id: sdk_1.generateUniqueId({
arn,
...nestedVal,
}),
...nestedVal,
})),
})),
lastModifiedSecret: webhook?.lastModifiedSecret?.toISOString(),
};
return {
id: arn,
name,
accountId,
arn,
region,
description,
sourceVersion,
serviceRole,
timeoutInMinutes,
queuedTimeoutInMinutes,
encryptionKey,
source: source
? {
id: sdk_1.generateUniqueId({
arn,
...source,
}),
...source,
}
: null,
badge,
fileSystemLocations: mappedFileSystemLocations,
secondarySources: mappedSecondarySources,
artifacts: artifacts
? {
id: sdk_1.generateUniqueId({
arn,
artifacts,
}),
...(artifacts ?? {}),
}
: null,
vpcConfig,
logsConfig,
buildBatchConfig,
secondaryArtifacts: mappedSecondaryArtifacts,
secondarySourceVersions: mappedSecondarySourceVersions,
cache,
tags: format_1.formatTagsFromMap(Tags ?? {}),
webhook: formattedWebhook,
environment: formattedEnv,
created: created?.toISOString(),
lastModified: lastModified?.toISOString(),
concurrentBuildLimit,
projectVisibility,
publicProjectAlias,
resourceAccessRole,
};
};