"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SchemaConfiguration=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},cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp};class SchemaConfiguration{databaseName;tableName;catalogId;databaseRegion;versionId;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_kinesisfirehose.SchemaConfiguration",version:"2.256.1"};static fromCfnTable(table,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_glue_CfnTable(table),jsiiDeprecationWarnings().aws_cdk_lib_aws_kinesisfirehose_SchemaConfigurationFromCfnTableProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromCfnTable),error}const stack=cdk().Stack.of(table);return new SchemaConfiguration(table.databaseName,table.ref,table.catalogId,props?.region??stack.region,props?.versionId??"LATEST")}constructor(databaseName,tableName,catalogId,databaseRegion,versionId){this.databaseName=databaseName,this.tableName=tableName,this.catalogId=catalogId,this.databaseRegion=databaseRegion,this.versionId=versionId}bind(scope,options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_kinesisfirehose_SchemaConfigurationBindOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}const stack=cdk().Stack.of(scope),catalogArn=stack.formatArn({service:"glue",resource:"catalog",region:this.databaseRegion,account:this.catalogId}),databaseArn=stack.formatArn({service:"glue",resource:"database",resourceName:this.databaseName,region:this.databaseRegion,account:this.catalogId}),tableArn=stack.formatArn({service:"glue",resource:"table",resourceName:`${this.databaseName}/${this.tableName}`,region:this.databaseRegion,account:this.catalogId});return iam().Grant.addToPrincipal({actions:["glue:GetTable","glue:GetTableVersion","glue:GetTableVersions"],grantee:options.role,resourceArns:[catalogArn,databaseArn,tableArn]}),iam().Grant.addToPrincipal({actions:["glue:GetSchemaVersion"],grantee:options.role,resourceArns:["*"]}),{roleArn:options.role.roleArn,region:this.databaseRegion,tableName:this.tableName,databaseName:this.databaseName,versionId:this.versionId,catalogId:this.catalogId}}}exports.SchemaConfiguration=SchemaConfiguration;
