UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 1.22 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyGroup=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../core"),cloudfront_generated_1=require("./cloudfront.generated");class KeyGroup extends core_1.Resource{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudfront_KeyGroupProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,KeyGroup),error}const resource=new cloudfront_generated_1.CfnKeyGroup(this,"Resource",{keyGroupConfig:{name:props.keyGroupName??this.generateName(),comment:props.comment,items:props.items.map(key=>key.publicKeyId)}});this.keyGroupId=resource.ref}static fromKeyGroupId(scope,id,keyGroupId){return new class extends core_1.Resource{constructor(){super(...arguments),this.keyGroupId=keyGroupId}}(scope,id)}generateName(){const name=core_1.Names.uniqueId(this);return name.length>80?name.substring(0,40)+name.substring(name.length-40):name}}exports.KeyGroup=KeyGroup,_a=JSII_RTTI_SYMBOL_1,KeyGroup[_a]={fqn:"aws-cdk-lib.aws_cloudfront.KeyGroup",version:"2.70.0"};