UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.61 kB
"use strict";var __decorate=exports&&exports.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.AccessPoint=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var efs_generated_1=()=>{var tmp=require("./efs.generated");return efs_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};class AccessPointBase extends core_1().Resource{}let AccessPoint=class AccessPoint2 extends AccessPointBase{static fromAccessPointAttributes(scope,id,attrs){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_efs_AccessPointAttributes(attrs)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAccessPointAttributes),error}return new ImportedAccessPoint(scope,id,attrs)}static fromAccessPointId(scope,id,accessPointId){return new ImportedAccessPoint(scope,id,{accessPointId})}constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_efs_AccessPointProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,AccessPoint2),error}(0,metadata_resource_1().addConstructMetadata)(this,props);const clientToken=props.clientToken;if((clientToken?.length===0||clientToken&&clientToken.length>64)&&!core_1().Token.isUnresolved(clientToken))throw new(core_1()).ValidationError(`The length of 'clientToken' must range from 1 to 64 characters, got: ${clientToken.length} characters`,this);const resource=new(efs_generated_1()).CfnAccessPoint(this,"Resource",{fileSystemId:props.fileSystem.fileSystemId,rootDirectory:{creationInfo:props.createAcl?{ownerGid:props.createAcl.ownerGid,ownerUid:props.createAcl.ownerUid,permissions:props.createAcl.permissions}:void 0,path:props.path},posixUser:props.posixUser?{uid:props.posixUser.uid,gid:props.posixUser.gid,secondaryGids:props.posixUser.secondaryGids}:void 0,clientToken});core_1().Tags.of(this).add("Name",this.node.path),this.accessPointId=resource.ref,this.accessPointArn=core_1().Stack.of(scope).formatArn({service:"elasticfilesystem",resource:"access-point",resourceName:this.accessPointId}),this.fileSystem=props.fileSystem}};exports.AccessPoint=AccessPoint,_a=JSII_RTTI_SYMBOL_1,AccessPoint[_a]={fqn:"aws-cdk-lib.aws_efs.AccessPoint",version:"2.202.0"},AccessPoint.PROPERTY_INJECTION_ID="aws-cdk-lib.aws-efs.AccessPoint",exports.AccessPoint=AccessPoint=__decorate([prop_injectable_1().propertyInjectable],AccessPoint);let ImportedAccessPoint=class extends AccessPointBase{constructor(scope,id,attrs){if(super(scope,id),(0,metadata_resource_1().addConstructMetadata)(this,attrs),attrs.accessPointId){if(attrs.accessPointArn)throw new(core_1()).ValidationError("Only one of accessPointId or AccessPointArn can be provided!",this);this.accessPointId=attrs.accessPointId,this.accessPointArn=core_1().Stack.of(scope).formatArn({service:"elasticfilesystem",resource:"access-point",resourceName:attrs.accessPointId})}else{if(!attrs.accessPointArn)throw new(core_1()).ValidationError("One of accessPointId or AccessPointArn is required!",this);this.accessPointArn=attrs.accessPointArn;let maybeApId=core_1().Stack.of(scope).splitArn(attrs.accessPointArn,core_1().ArnFormat.SLASH_RESOURCE_NAME).resourceName;if(!maybeApId)throw new(core_1()).ValidationError("ARN for AccessPoint must provide the resource name.",this);this.accessPointId=maybeApId}this._fileSystem=attrs.fileSystem}get fileSystem(){if(!this._fileSystem)throw new(core_1()).ValidationError("fileSystem is only available if 'fromAccessPointAttributes()' is used and a fileSystem is passed in as an attribute.",this);return this._fileSystem}};ImportedAccessPoint.PROPERTY_INJECTION_ID="aws-cdk-lib.aws-efs.ImportedAccessPoint",ImportedAccessPoint=__decorate([prop_injectable_1().propertyInjectable],ImportedAccessPoint);