"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReportGroup=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),iam=require("../../aws-iam"),cdk=require("../../core"),codebuild_generated_1=require("./codebuild.generated"),report_group_utils_1=require("./report-group-utils");class ReportGroupBase extends cdk.Resource{grantWrite(identity){const ret=iam.Grant.addToPrincipal({grantee:identity,actions:["codebuild:CreateReport","codebuild:UpdateReport","codebuild:BatchPutTestCases"],resourceArns:[this.reportGroupArn]});return this.exportBucket&&this.exportBucket.grantWrite(identity),ret}}class ReportGroup extends ReportGroupBase{constructor(scope,id,props={}){var _b;super(scope,id,{physicalName:props.reportGroupName});jsiiDeprecationWarnings.aws_cdk_lib_aws_codebuild_ReportGroupProps(props);const resource=new codebuild_generated_1.CfnReportGroup(this,"Resource",{type:"TEST",exportConfig:{exportConfigType:props.exportBucket?"S3":"NO_EXPORT",s3Destination:props.exportBucket?{bucket:props.exportBucket.bucketName,encryptionDisabled:props.exportBucket.encryptionKey?!1:void 0,encryptionKey:(_b=props.exportBucket.encryptionKey)===null||_b===void 0?void 0:_b.keyArn,packaging:props.zipExport?"ZIP":void 0}:void 0},name:props.reportGroupName});resource.applyRemovalPolicy(props.removalPolicy,{default:cdk.RemovalPolicy.RETAIN}),this.reportGroupArn=this.getResourceArnAttribute(resource.attrArn,report_group_utils_1.reportGroupArnComponents(this.physicalName)),this.reportGroupName=this.getResourceNameAttribute(cdk.Fn.select(1,cdk.Fn.split("/",resource.ref))),this.exportBucket=props.exportBucket}static fromReportGroupName(scope,id,reportGroupName){class Import extends ReportGroupBase{constructor(){super(...arguments);this.reportGroupName=reportGroupName,this.reportGroupArn=report_group_utils_1.renderReportGroupArn(scope,reportGroupName),this.exportBucket=void 0}}return new Import(scope,id)}}exports.ReportGroup=ReportGroup,_a=JSII_RTTI_SYMBOL_1,ReportGroup[_a]={fqn:"aws-cdk-lib.aws_codebuild.ReportGroup",version:"2.13.0"};
//# sourceMappingURL=report-group.js.map
