UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 2.61 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClusterResourceProvider=void 0;var path=()=>{var tmp=require("path");return path=()=>tmp,tmp},lambda=()=>{var tmp=require("../../aws-lambda");return lambda=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},cr=()=>{var tmp=require("../../custom-resources");return cr=()=>tmp,tmp},lambda_layer_node_proxy_agent_1=()=>{var tmp=require("../../lambda-layer-node-proxy-agent");return lambda_layer_node_proxy_agent_1=()=>tmp,tmp};const HANDLER_DIR=path().join(__dirname,"..","..","custom-resource-handlers","dist","aws-eks","cluster-resource-handler");class ClusterResourceProvider extends core_1().NestedStack{static getOrCreate(scope,props){const stack=core_1().Stack.of(scope),uid="@aws-cdk/aws-eks.ClusterResourceProvider";return stack.node.tryFindChild(uid)??new ClusterResourceProvider(stack,uid,props)}constructor(scope,id,props){super(scope,id);const nodeProxyAgentLayer=new(lambda_layer_node_proxy_agent_1()).NodeProxyAgentLayer(this,"NodeProxyAgentLayer"),onEvent=new(lambda()).Function(this,"OnEventHandler",{code:lambda().Code.fromAsset(HANDLER_DIR),description:"onEvent handler for EKS cluster resource provider",runtime:lambda().Runtime.NODEJS_18_X,environment:{AWS_STS_REGIONAL_ENDPOINTS:"regional",...props.environment},handler:"index.onEvent",timeout:core_1().Duration.minutes(1),vpc:props.subnets?props.vpc:void 0,vpcSubnets:props.subnets?{subnets:props.subnets}:void 0,securityGroups:props.securityGroup?[props.securityGroup]:void 0,layers:props.onEventLayer?[props.onEventLayer]:[nodeProxyAgentLayer]}),isComplete=new(lambda()).Function(this,"IsCompleteHandler",{code:lambda().Code.fromAsset(HANDLER_DIR),description:"isComplete handler for EKS cluster resource provider",runtime:lambda().Runtime.NODEJS_18_X,environment:{AWS_STS_REGIONAL_ENDPOINTS:"regional",...props.environment},handler:"index.isComplete",timeout:core_1().Duration.minutes(1),vpc:props.subnets?props.vpc:void 0,vpcSubnets:props.subnets?{subnets:props.subnets}:void 0,securityGroups:props.securityGroup?[props.securityGroup]:void 0,layers:[nodeProxyAgentLayer]});this.provider=new(cr()).Provider(this,"Provider",{onEventHandler:onEvent,isCompleteHandler:isComplete,totalTimeout:core_1().Duration.hours(1),queryInterval:core_1().Duration.minutes(1),vpc:props.subnets?props.vpc:void 0,vpcSubnets:props.subnets?{subnets:props.subnets}:void 0,securityGroups:props.securityGroup?[props.securityGroup]:void 0})}get serviceToken(){return this.provider.serviceToken}}exports.ClusterResourceProvider=ClusterResourceProvider;