"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LifecycleTransition=exports.DefaultResult=exports.LifecycleHook=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),autoscaling_generated_1=require("./autoscaling.generated"),core_1=require("../../core");class LifecycleHook extends core_1.Resource{get role(){if(!this._role)throw new Error("'role' is undefined. Please specify a 'role' or specify a 'notificationTarget' to have a role provided for you.");return this._role}constructor(scope,id,props){super(scope,id,{physicalName:props.lifecycleHookName});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_autoscaling_LifecycleHookProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,LifecycleHook),error}const targetProps=props.notificationTarget?props.notificationTarget.bind(this,{lifecycleHook:this,role:props.role}):void 0;if(props.role){if(this._role=props.role,!props.notificationTarget)throw new Error("'notificationTarget' parameter required when 'role' parameter is specified")}else this._role=targetProps?targetProps.createdRole:void 0;const l1NotificationTargetArn=targetProps?targetProps.notificationTargetArn:void 0,l1RoleArn=this._role?this.role.roleArn:void 0,resource=new autoscaling_generated_1.CfnLifecycleHook(this,"Resource",{autoScalingGroupName:props.autoScalingGroup.autoScalingGroupName,defaultResult:props.defaultResult,heartbeatTimeout:props.heartbeatTimeout&&props.heartbeatTimeout.toSeconds(),lifecycleHookName:this.physicalName,lifecycleTransition:props.lifecycleTransition,notificationMetadata:props.notificationMetadata,notificationTargetArn:l1NotificationTargetArn,roleArn:l1RoleArn});this._role&&resource.node.addDependency(this.role),this.lifecycleHookName=resource.ref}}exports.LifecycleHook=LifecycleHook,_a=JSII_RTTI_SYMBOL_1,LifecycleHook[_a]={fqn:"aws-cdk-lib.aws_autoscaling.LifecycleHook",version:"2.96.1"};var DefaultResult;(function(DefaultResult2){DefaultResult2.CONTINUE="CONTINUE",DefaultResult2.ABANDON="ABANDON"})(DefaultResult||(exports.DefaultResult=DefaultResult={}));var LifecycleTransition;(function(LifecycleTransition2){LifecycleTransition2.INSTANCE_LAUNCHING="autoscaling:EC2_INSTANCE_LAUNCHING",LifecycleTransition2.INSTANCE_TERMINATING="autoscaling:EC2_INSTANCE_TERMINATING"})(LifecycleTransition||(exports.LifecycleTransition=LifecycleTransition={}));
