"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProfilingGroup=exports.ComputePlatform=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),aws_iam_1=require("../../aws-iam"),core_1=require("../../core"),codeguruprofiler_generated_1=require("./codeguruprofiler.generated");var ComputePlatform;(function(ComputePlatform2){ComputePlatform2.AWS_LAMBDA="AWSLambda",ComputePlatform2.DEFAULT="Default"})(ComputePlatform=exports.ComputePlatform||(exports.ComputePlatform={}));class ProfilingGroupBase extends core_1.Resource{grantPublish(grantee){return aws_iam_1.Grant.addToPrincipal({grantee,actions:["codeguru-profiler:ConfigureAgent","codeguru-profiler:PostAgentProfile"],resourceArns:[this.profilingGroupArn]})}grantRead(grantee){return aws_iam_1.Grant.addToPrincipal({grantee,actions:["codeguru-profiler:GetProfile","codeguru-profiler:DescribeProfilingGroup"],resourceArns:[this.profilingGroupArn]})}}class ProfilingGroup extends ProfilingGroupBase{constructor(scope,id,props={}){var _b;super(scope,id,{physicalName:(_b=props.profilingGroupName)!==null&&_b!==void 0?_b:core_1.Lazy.string({produce:()=>this.generateUniqueId()})});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_codeguruprofiler_ProfilingGroupProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.constructor),error}const profilingGroup=new codeguruprofiler_generated_1.CfnProfilingGroup(this,"ProfilingGroup",{profilingGroupName:this.physicalName,computePlatform:props.computePlatform});this.profilingGroupName=this.getResourceNameAttribute(profilingGroup.ref),this.profilingGroupArn=this.getResourceArnAttribute(profilingGroup.attrArn,{service:"codeguru-profiler",resource:"profilingGroup",resourceName:this.physicalName})}static fromProfilingGroupName(scope,id,profilingGroupName){const stack=core_1.Stack.of(scope);return this.fromProfilingGroupArn(scope,id,stack.formatArn({service:"codeguru-profiler",resource:"profilingGroup",resourceName:profilingGroupName}))}static fromProfilingGroupArn(scope,id,profilingGroupArn){class Import extends ProfilingGroupBase{constructor(){super(...arguments),this.profilingGroupName=core_1.Stack.of(scope).splitArn(profilingGroupArn,core_1.ArnFormat.SLASH_RESOURCE_NAME).resource,this.profilingGroupArn=profilingGroupArn}}return new Import(scope,id)}generateUniqueId(){const name=core_1.Names.uniqueId(this);return name.length>240?name.substring(0,120)+name.substring(name.length-120):name}}exports.ProfilingGroup=ProfilingGroup,_a=JSII_RTTI_SYMBOL_1,ProfilingGroup[_a]={fqn:"aws-cdk-lib.aws_codeguruprofiler.ProfilingGroup",version:"2.24.1"};
//# sourceMappingURL=profiling-group.js.map
