"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScheduleGroupGrants=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},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class ScheduleGroupGrants{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_scheduler.ScheduleGroupGrants",version:"2.256.1"};static fromScheduleGroup(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_scheduler_IScheduleGroupRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromScheduleGroup),error}return new ScheduleGroupGrants({resource})}resource;constructor(props){this.resource=props.resource}readSchedules(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.readSchedules),error}const actions=["scheduler:GetSchedule","scheduler:ListSchedules"];return iam().Grant.addToPrincipal({actions,grantee,resourceArns:[this.arnForScheduleInGroup("*")]})}writeSchedules(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.writeSchedules),error}const actions=["scheduler:CreateSchedule","scheduler:UpdateSchedule"];return iam().Grant.addToPrincipal({actions,grantee,resourceArns:[this.arnForScheduleInGroup("*")]})}deleteSchedules(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.deleteSchedules),error}const actions=["scheduler:DeleteSchedule"];return iam().Grant.addToPrincipal({actions,grantee,resourceArns:[this.arnForScheduleInGroup("*")]})}arnForScheduleInGroup(scheduleName){return core_1().Arn.format({region:this.resource.env.region,account:this.resource.env.account,partition:core_1().Aws.PARTITION,service:"scheduler",resource:"schedule",resourceName:this.resource.scheduleGroupRef.scheduleGroupName+"/"+scheduleName})}}exports.ScheduleGroupGrants=ScheduleGroupGrants;
