UNPKG

@csermet/multiprovider

Version:

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

83 lines (82 loc) 3.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const sdk_1 = require("@cloudgraph/sdk"); const format_1 = require("../../utils/format"); const generateArns_1 = require("../../utils/generateArns"); /** * Client Vpn Endpoint */ exports.default = ({ service: rawData, account, region, }) => { const { Tags: tags = {}, ClientVpnEndpointId: id, Description: description, Status: { Code: status = '' } = {}, CreationTime: creationTime, DeletionTime: deletionTime, DnsName: dnsName, ClientCidrBlock: clientCidrBlock, DnsServers: dnsServers, SplitTunnel: splitTunnel, VpnProtocol: vpnProtocol, TransportProtocol: transportProtocol, VpnPort: vpnPort, AssociatedTargetNetworks: associatedTargetNetworkSet, ServerCertificateArn: serverCertificateArn, AuthenticationOptions: clientVpnAuthenticationList, ConnectionLogOptions: connectionLogOptions, SecurityGroupIds: securityGroupIds = [], ClientConnectOptions: clientConnectOptions, } = rawData; const arn = generateArns_1.clientVpnEndpointArn({ region, account, id }); // Client Vpn Endpoint Tags const clientVpnEndpointTags = format_1.formatTagsFromMap(tags); // Associated Target Networks const associatedTargetNetworks = associatedTargetNetworkSet?.map(({ NetworkId: networkId, NetworkType: networkType }) => { return { id: sdk_1.generateUniqueId({ arn, networkId, networkType, }), networkId, networkType, }; }) || []; // Authentication Options const authenticationOptions = clientVpnAuthenticationList?.map(({ Type: type, ActiveDirectory: activeDirectory, MutualAuthentication: mutualAuthentication, FederatedAuthentication: federatedAuthentication, }) => { return { id: sdk_1.generateUniqueId({ arn, type, activeDirectory, mutualAuthentication, federatedAuthentication, }), type: type?.toString(), activeDirectory: { directoryId: activeDirectory?.DirectoryId, }, mutualAuthentication: { clientRootCertificateChain: mutualAuthentication?.ClientRootCertificateChain, }, federatedAuthentication: { samlProviderArn: federatedAuthentication?.SamlProviderArn, selfServiceSamlProviderArn: federatedAuthentication?.SelfServiceSamlProviderArn, }, }; }) || []; const clientVpnEndpoint = { id, accountId: account, arn, region, status, creationTime, description, deletionTime, dnsName, clientCidrBlock, dnsServers, splitTunnel, vpnProtocol, transportProtocol, vpnPort, associatedTargetNetworks, serverCertificateArn, authenticationOptions, connectionLogOptions: { enabled: connectionLogOptions?.Enabled, cloudwatchLogGroup: connectionLogOptions?.CloudwatchLogGroup, cloudwatchLogStream: connectionLogOptions?.CloudwatchLogStream, }, securityGroupIds, tags: clientVpnEndpointTags, clientConnectOptions: { enabled: clientConnectOptions?.Enabled, cloudwatchLogGroup: clientConnectOptions?.LambdaFunctionArn, status: clientConnectOptions?.Status?.Code, }, }; return clientVpnEndpoint; };