UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 2.8 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileSystem=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var ec2=()=>{var tmp=require("../../aws-ec2");return ec2=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},access_point_reflection_1=()=>{var tmp=require("../../aws-s3files/lib/private/access-point-reflection");return access_point_reflection_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class FileSystem{config;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_lambda.FileSystem",version:"2.251.0"};static fromEfsAccessPoint(ap,mountPath){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_efs_IAccessPoint(ap)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromEfsAccessPoint),error}return new FileSystem({localMountPath:mountPath,arn:ap.accessPointArn,dependency:[ap.fileSystem.mountTargetsAvailable],connections:ap.fileSystem.connections,policies:[new(iam()).PolicyStatement({actions:["elasticfilesystem:ClientMount"],resources:["*"],conditions:{StringEquals:{"elasticfilesystem:AccessPointArn":ap.accessPointArn}}}),new(iam()).PolicyStatement({actions:["elasticfilesystem:ClientWrite"],resources:[core_1().Stack.of(ap).formatArn({service:"elasticfilesystem",resource:"file-system",resourceName:ap.fileSystem.fileSystemId})]})]})}static fromS3FilesAccessPoint(ap,mountPath){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_s3files_IAccessPointRef(ap)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromS3FilesAccessPoint),error}const reflection=access_point_reflection_1().AccessPointReflection.of(ap);return new FileSystem({localMountPath:mountPath,arn:ap.accessPointRef.accessPointArn,dependency:reflection.mountTargets,connections:new(ec2()).Connections({securityGroups:reflection.mountTargetSecurityGroups.map((cfnSg,i)=>ec2().SecurityGroup.fromSecurityGroupId(ap,`MountTargetSG${i}`,cfnSg.attrGroupId)),defaultPort:ec2().Port.tcp(FileSystem.NFS_PORT)}),policies:[new(iam()).PolicyStatement({actions:["s3files:ClientMount"],resources:[ap.accessPointRef.accessPointArn]}),new(iam()).PolicyStatement({actions:["s3files:ClientMount","s3files:ClientWrite"],resources:[reflection.fileSystem.fileSystemRef.fileSystemArn]})]})}static NFS_PORT=2049;constructor(config){this.config=config;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_FileSystemConfig(config)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,FileSystem),error}}}exports.FileSystem=FileSystem;