putLifecycleEventHookExecutionStatus method

Future<PutLifecycleEventHookExecutionStatusOutput> putLifecycleEventHookExecutionStatus({
  1. String? deploymentId,
  2. String? lifecycleEventHookExecutionId,
  3. LifecycleEventStatus? status,
})

Sets the result of a Lambda validation function. The function validates lifecycle hooks during a deployment that uses the AWS Lambda or Amazon ECS compute platform. For AWS Lambda deployments, the available lifecycle hooks are BeforeAllowTraffic and AfterAllowTraffic. For Amazon ECS deployments, the available lifecycle hooks are BeforeInstall, AfterInstall, AfterAllowTestTraffic, BeforeAllowTraffic, and AfterAllowTraffic. Lambda validation functions return Succeeded or Failed. For more information, see AppSpec 'hooks' Section for an AWS Lambda Deployment and AppSpec 'hooks' Section for an Amazon ECS Deployment.

May throw InvalidLifecycleEventHookExecutionStatusException. May throw InvalidLifecycleEventHookExecutionIdException. May throw LifecycleEventAlreadyCompletedException. May throw DeploymentIdRequiredException. May throw DeploymentDoesNotExistException. May throw InvalidDeploymentIdException. May throw UnsupportedActionForDeploymentTypeException.

Parameter deploymentId : The unique ID of a deployment. Pass this ID to a Lambda function that validates a deployment lifecycle event.

Parameter lifecycleEventHookExecutionId : The execution ID of a deployment's lifecycle hook. A deployment lifecycle hook is specified in the hooks section of the AppSpec file.

Parameter status : The result of a Lambda function that validates a deployment lifecycle event (Succeeded or Failed).

Implementation

Future<PutLifecycleEventHookExecutionStatusOutput>
    putLifecycleEventHookExecutionStatus({
  String? deploymentId,
  String? lifecycleEventHookExecutionId,
  LifecycleEventStatus? status,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeDeploy_20141006.PutLifecycleEventHookExecutionStatus'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (deploymentId != null) 'deploymentId': deploymentId,
      if (lifecycleEventHookExecutionId != null)
        'lifecycleEventHookExecutionId': lifecycleEventHookExecutionId,
      if (status != null) 'status': status.toValue(),
    },
  );

  return PutLifecycleEventHookExecutionStatusOutput.fromJson(
      jsonResponse.body);
}