aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.03 kB
JavaScript
var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.OriginAccessIdentity=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cloudfront_generated_1=()=>{var tmp=require("./cloudfront.generated");return cloudfront_generated_1=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp};class OriginAccessIdentityBase extends cdk().Resource{arn(){return cdk().Stack.of(this).formatArn({service:"iam",region:"",account:"cloudfront",resource:"user",resourceName:`CloudFront Origin Access Identity ${this.originAccessIdentityId}`})}}class OriginAccessIdentity extends OriginAccessIdentityBase{static fromOriginAccessIdentityName(scope,id,originAccessIdentityName){try{jsiiDeprecationWarnings().print("aws-cdk-lib.aws_cloudfront.OriginAccessIdentity#fromOriginAccessIdentityName","use `fromOriginAccessIdentityId`")}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromOriginAccessIdentityName),error}return OriginAccessIdentity.fromOriginAccessIdentityId(scope,id,originAccessIdentityName)}static fromOriginAccessIdentityId(scope,id,originAccessIdentityId){class Import extends OriginAccessIdentityBase{constructor(s,i){super(s,i,{physicalName:originAccessIdentityId}),this.originAccessIdentityId=originAccessIdentityId,this.originAccessIdentityName=originAccessIdentityId,this.grantPrincipal=new(iam()).ArnPrincipal(this.arn())}}return new Import(scope,id)}get originAccessIdentityName(){try{jsiiDeprecationWarnings().print("aws-cdk-lib.aws_cloudfront.OriginAccessIdentity#originAccessIdentityName","use originAccessIdentityId instead")}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,jsiiDeprecationWarnings().getPropertyDescriptor(this,"originAccessIdentityName").get),error}return this.originAccessIdentityId}constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_cloudfront_OriginAccessIdentityProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,OriginAccessIdentity),error}const comment=(props?.comment??"Allows CloudFront to reach the bucket").slice(0,128);this.resource=new(cloudfront_generated_1()).CfnCloudFrontOriginAccessIdentity(this,"Resource",{cloudFrontOriginAccessIdentityConfig:{comment}}),this.originAccessIdentityId=this.getResourceNameAttribute(this.resource.ref),this.cloudFrontOriginAccessIdentityS3CanonicalUserId=this.resource.attrS3CanonicalUserId,this.grantPrincipal=new(iam()).CanonicalUserPrincipal(this.cloudFrontOriginAccessIdentityS3CanonicalUserId)}}exports.OriginAccessIdentity=OriginAccessIdentity,_a=JSII_RTTI_SYMBOL_1,OriginAccessIdentity[_a]={fqn:"aws-cdk-lib.aws_cloudfront.OriginAccessIdentity",version:"2.160.0"};
;