"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.S3ApiSchema=exports.InlineApiSchema=exports.AssetApiSchema=exports.ApiSchema=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var base_schema_1=()=>{var tmp=require("./base-schema");return base_schema_1=()=>tmp,tmp},aws_iam_1=()=>{var tmp=require("../../../../../aws-iam");return aws_iam_1=()=>tmp,tmp},s3_assets=()=>{var tmp=require("../../../../../aws-s3-assets");return s3_assets=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../../../core");return core_1=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../../../../core/lib/errors");return errors_1=()=>tmp,tmp},helpers_internal_1=()=>{var tmp=require("../../../../../core/lib/helpers-internal");return helpers_internal_1=()=>tmp,tmp};class ApiSchema extends base_schema_1().TargetSchema{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_bedrockagentcore.ApiSchema",version:"2.256.1"};static fromLocalAsset(path){return new AssetApiSchema(path)}static fromInline(schema){return new InlineApiSchema(schema)}static fromS3File(bucket,objectKey,bucketOwnerAccountId){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_IBucket(bucket)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromS3File),error}return new S3ApiSchema({bucketName:bucket.bucketName,objectKey},bucketOwnerAccountId)}s3File;inlineSchema;bucketOwnerAccountId;constructor(s3File,bucketOwnerAccountId,inlineSchema){super();try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_Location(s3File)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ApiSchema),error}this.s3File=s3File,this.inlineSchema=inlineSchema,this.bucketOwnerAccountId=bucketOwnerAccountId}}exports.ApiSchema=ApiSchema;class AssetApiSchema extends ApiSchema{path;options;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_bedrockagentcore.AssetApiSchema",version:"2.256.1"};asset;constructor(path,options={}){super(),this.path=path,this.options=options;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_assets_AssetOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,AssetApiSchema),error}}_getFilePath(){return this.path}bind(scope){this.asset||(this.asset=new(s3_assets()).Asset(scope,`Schema${(0,helpers_internal_1().md5hash)(this.path)}`,{path:this.path,...this.options}))}_render(){if(!this.asset)throw new(errors_1()).UnscopedValidationError((0,helpers_internal_1().lit)`ApiSchemaNotBound`,"ApiSchema must be bound to a scope before rendering. Call bind() first.");return{s3:{uri:`s3://${this.asset.s3BucketName}/${this.asset.s3ObjectKey}`}}}grantPermissionsToRole(role){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IRole(role)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantPermissionsToRole),error}this.asset&&this.asset.grantRead(role)}}exports.AssetApiSchema=AssetApiSchema;class InlineApiSchema extends ApiSchema{schema;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_bedrockagentcore.InlineApiSchema",version:"2.256.1"};constructor(schema){super(void 0,void 0,schema),this.schema=schema}_render(){return{inlinePayload:this.schema}}grantPermissionsToRole(_role){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IRole(_role)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantPermissionsToRole),error}}bind(scope){}}exports.InlineApiSchema=InlineApiSchema;class S3ApiSchema extends ApiSchema{location;bucketOwnerAccountId;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_bedrockagentcore.S3ApiSchema",version:"2.256.1"};constructor(location,bucketOwnerAccountId){super(location,bucketOwnerAccountId,void 0),this.location=location,this.bucketOwnerAccountId=bucketOwnerAccountId;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_Location(location)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,S3ApiSchema),error}}_render(){return{s3:{uri:`s3://${this.location.bucketName}/${this.location.objectKey}`,...this.bucketOwnerAccountId&&{bucketOwnerAccountId:this.bucketOwnerAccountId}}}}bind(scope){}grantPermissionsToRole(role){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IRole(role)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantPermissionsToRole),error}aws_iam_1().Grant.addToPrincipal({grantee:role,actions:["s3:GetObject"],resourceArns:[`arn:${core_1().Aws.PARTITION}:s3:::${this.location.bucketName}/${this.location.objectKey}`]})}}exports.S3ApiSchema=S3ApiSchema;
