UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.07 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;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReportGroup=exports.ReportGroupType=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var codebuild_generated_1=()=>{var tmp=require("./codebuild.generated");return codebuild_generated_1=()=>tmp,tmp},report_group_utils_1=()=>{var tmp=require("./report-group-utils");return report_group_utils_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 ReportGroupBase extends cdk().Resource{grantWrite(identity){const typeAction=this.type===ReportGroupType.CODE_COVERAGE?"codebuild:BatchPutCodeCoverages":"codebuild:BatchPutTestCases",ret=iam().Grant.addToPrincipal({grantee:identity,actions:["codebuild:CreateReport","codebuild:UpdateReport",typeAction],resourceArns:[this.reportGroupArn]});return this.exportBucket&&this.exportBucket.grantWrite(identity),ret}}var ReportGroupType;(function(ReportGroupType2){ReportGroupType2.TEST="TEST",ReportGroupType2.CODE_COVERAGE="CODE_COVERAGE"})(ReportGroupType||(exports.ReportGroupType=ReportGroupType={}));let ReportGroup=class ReportGroup2 extends ReportGroupBase{static fromReportGroupName(scope,id,reportGroupName){class Import extends ReportGroupBase{constructor(){super(...arguments),this.reportGroupName=reportGroupName,this.reportGroupArn=(0,report_group_utils_1().renderReportGroupArn)(scope,reportGroupName),this.exportBucket=void 0,this.type=void 0}}return new Import(scope,id)}constructor(scope,id,props={}){super(scope,id,{physicalName:props.reportGroupName});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codebuild_ReportGroupProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ReportGroup2),error}(0,metadata_resource_1().addConstructMetadata)(this,props),this.type=props.type?props.type:ReportGroupType.TEST;const resource=new(codebuild_generated_1()).CfnReportGroup(this,"Resource",{type:this.type,exportConfig:{exportConfigType:props.exportBucket?"S3":"NO_EXPORT",s3Destination:props.exportBucket?{bucket:props.exportBucket.bucketName,encryptionDisabled:props.exportBucket.encryptionKey?!1:void 0,encryptionKey:props.exportBucket.encryptionKey?.keyArn,packaging:props.zipExport?"ZIP":void 0}:void 0},name:props.reportGroupName,deleteReports:props.deleteReports});if(resource.applyRemovalPolicy(props.removalPolicy,{default:cdk().RemovalPolicy.RETAIN}),this.reportGroupArn=this.getResourceArnAttribute(resource.attrArn,(0,report_group_utils_1().reportGroupArnComponents)(this.physicalName)),this.reportGroupName=this.getResourceNameAttribute(cdk().Fn.select(1,cdk().Fn.split("/",resource.ref))),this.exportBucket=props.exportBucket,props.deleteReports&&props.removalPolicy!==cdk().RemovalPolicy.DESTROY)throw new(cdk()).ValidationError("Cannot use 'deleteReports' property on a report group without setting removal policy to 'DESTROY'.",this)}};exports.ReportGroup=ReportGroup,_a=JSII_RTTI_SYMBOL_1,ReportGroup[_a]={fqn:"aws-cdk-lib.aws_codebuild.ReportGroup",version:"2.202.0"},ReportGroup.PROPERTY_INJECTION_ID="aws-cdk-lib.aws-codebuild.ReportGroup",exports.ReportGroup=ReportGroup=__decorate([prop_injectable_1().propertyInjectable],ReportGroup);