UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.1 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,OriginAccessIdentity_1;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},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 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}`})}}let OriginAccessIdentity=OriginAccessIdentity_1=class OriginAccessIdentity2 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_1.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,OriginAccessIdentity2),error}(0,metadata_resource_1().addConstructMetadata)(this,props);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.211.0"},OriginAccessIdentity.PROPERTY_INJECTION_ID="aws-cdk-lib.aws-cloudfront.OriginAccessIdentity",exports.OriginAccessIdentity=OriginAccessIdentity=OriginAccessIdentity_1=__decorate([prop_injectable_1().propertyInjectable],OriginAccessIdentity);