"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.GlueStartJobRun=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),iam=require("../../../aws-iam"),sfn=require("../../../aws-stepfunctions"),core_1=require("../../../core"),task_utils_1=require("../private/task-utils");class GlueStartJobRun extends sfn.TaskStateBase{constructor(scope,id,props){super(scope,id,props),this.props=props;try{jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_tasks_GlueStartJobRunProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,GlueStartJobRun),error}this.integrationPattern=props.integrationPattern??sfn.IntegrationPattern.REQUEST_RESPONSE,(0,task_utils_1.validatePatternSupported)(this.integrationPattern,GlueStartJobRun.SUPPORTED_INTEGRATION_PATTERNS),this.taskPolicies=this.getPolicies(),this.taskMetrics={metricPrefixSingular:"GlueJob",metricPrefixPlural:"GlueJobs",metricDimensions:{GlueJobName:this.props.glueJobName}}}_renderTask(){const notificationProperty=this.props.notifyDelayAfter?{NotifyDelayAfter:this.props.notifyDelayAfter.toMinutes()}:null;let timeout;return this.props.timeout?timeout=this.props.timeout.toMinutes():this.props.taskTimeout?.seconds?timeout=core_1.Duration.seconds(this.props.taskTimeout.seconds).toMinutes():this.props.taskTimeout?.path&&(timeout=sfn.JsonPath.numberAt(this.props.taskTimeout.path)),{Resource:(0,task_utils_1.integrationResourceArn)("glue","startJobRun",this.integrationPattern),Parameters:sfn.FieldUtils.renderObject({JobName:this.props.glueJobName,Arguments:this.props.arguments?.value,Timeout:timeout,SecurityConfiguration:this.props.securityConfiguration,NotificationProperty:notificationProperty}),TimeoutSeconds:void 0,TimeoutSecondsPath:void 0}}getPolicies(){let iamActions;return this.integrationPattern===sfn.IntegrationPattern.REQUEST_RESPONSE?iamActions=["glue:StartJobRun"]:this.integrationPattern===sfn.IntegrationPattern.RUN_JOB&&(iamActions=["glue:StartJobRun","glue:GetJobRun","glue:GetJobRuns","glue:BatchStopJobRun"]),[new iam.PolicyStatement({resources:[core_1.Stack.of(this).formatArn({service:"glue",resource:"job",resourceName:this.props.glueJobName})],actions:iamActions})]}}exports.GlueStartJobRun=GlueStartJobRun,_a=JSII_RTTI_SYMBOL_1,GlueStartJobRun[_a]={fqn:"aws-cdk-lib.aws_stepfunctions_tasks.GlueStartJobRun",version:"2.96.1"},GlueStartJobRun.SUPPORTED_INTEGRATION_PATTERNS=[sfn.IntegrationPattern.REQUEST_RESPONSE,sfn.IntegrationPattern.RUN_JOB];
