UNPKG

@csermet/multiprovider

Version:

cloud-graph provider plugin for AWS used to fetch AWS cloud data.

37 lines (36 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getElasticBeanstalkEnvId = exports.getEksClusterName = void 0; const lodash_1 = require("lodash"); const clusterTag = 'kubernetes.io/cluster/'; const environmentIdTag = 'elasticbeanstalk:environment-id'; const getEksClusterName = (tags) => { if (lodash_1.isEmpty(tags)) { return ''; } let eksClusterName = ''; Object.keys(tags)?.some(key => { const isMatch = key.includes(clusterTag); if (isMatch) { eksClusterName = lodash_1.last(key.split('/')); } return isMatch; }); return eksClusterName; }; exports.getEksClusterName = getEksClusterName; const getElasticBeanstalkEnvId = (tags) => { if (lodash_1.isEmpty(tags)) { return ''; } let elasticBeanstalkId = ''; Object.keys(tags)?.some(key => { const isMatch = key.includes(environmentIdTag); if (isMatch) { elasticBeanstalkId = tags[key]; } return isMatch; }); return elasticBeanstalkId; }; exports.getElasticBeanstalkEnvId = getElasticBeanstalkEnvId;