"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Endpoint=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class Endpoint{static fromKinesisStream(stream,role){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_kinesis_IStream(stream),jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IRole(role)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromKinesisStream),error}return new class extends Endpoint{_renderEndpoint(scope){const cloudfrontRole=role??this.singletonKinesisRole(scope);return stream.grant(cloudfrontRole,"kinesis:DescribeStreamSummary","kinesis:DescribeStream","kinesis:PutRecord","kinesis:PutRecords"),stream.encryptionKey&&stream.encryptionKey.grant(cloudfrontRole,"kms:GenerateDataKey"),{kinesisStreamConfig:{roleArn:cloudfrontRole.roleArn,streamArn:stream.streamArn},streamType:"Kinesis"}}}}constructor(){}singletonKinesisRole(scope){const id="RealtimeLogKinesisRole",existing=scope.node.tryFindChild(id);return existing||new(iam()).Role(scope,id,{roleName:core_1().PhysicalName.GENERATE_IF_NEEDED,assumedBy:new(iam()).ServicePrincipal("cloudfront.amazonaws.com")})}}exports.Endpoint=Endpoint,_a=JSII_RTTI_SYMBOL_1,Endpoint[_a]={fqn:"aws-cdk-lib.aws_cloudfront.Endpoint",version:"2.159.0"};
