UNPKG

@csermet/multiprovider

Version:

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

38 lines (37 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const format_1 = require("../../utils/format"); const generateArns_1 = require("../../utils/generateArns"); /** * Network Interface */ exports.default = ({ service: rawData, account, region, }) => { const { NetworkInterfaceId: id, MacAddress: macAddress, Description: description, PrivateDnsName: privateDnsName, SubnetId: subnetId, AvailabilityZone: availabilityZone, Status: status, VpcId: vpcId, InterfaceType: interfaceType = '', Attachment: attachment = {}, Groups: groups = [], PrivateIpAddresses: privateIpAddresses = [], Tags: tags = {}, } = rawData; const securityGroupsIds = groups.map(({ GroupId }) => GroupId); const privateIps = privateIpAddresses.map(({ PrivateIpAddress }) => PrivateIpAddress); // Format tags const networkInterfacesTags = format_1.formatTagsFromMap(tags); const networkInterface = { id, accountId: account, arn: generateArns_1.networkInterfaceArn({ region, account, id }), region, subnetId, macAddress, privateIps, description, availabilityZone, status, vpcId, interfaceType, securityGroupsIds, privateDnsName, attachment: { attachmentId: attachment?.AttachmentId || '', status: attachment?.Status || '', deleteOnTermination: attachment?.DeleteOnTermination || false, }, tags: networkInterfacesTags, }; return networkInterface; };