Skip to content

put_lifecycle_event_hook_execution_status

put_lifecycle_event_hook_execution_status(
    *,
    config_overrides: Optional[CodeDeployClientConfig] = None,
    deployment_id: Optional[DeploymentId] = None,
    lifecycle_event_hook_execution_id: Optional[LifecycleEventHookExecutionId] = None,
    status: Optional[LifecycleEventStatus] = None,
) -> PutLifecycleEventHookExecutionStatusOutput

Sets the result of a Lambda validation function. The function validates lifecycle hooks during a deployment that uses the Lambda or Amazon ECS compute platform. For 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 Lambda Deployment and AppSpec 'hooks' Section for an Amazon ECS Deployment.

Parameters:

  • deployment_id (Optional[DeploymentId], default: None ) –

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

  • lifecycle_event_hook_execution_id (Optional[LifecycleEventHookExecutionId], default: None ) –

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

  • status (Optional[LifecycleEventStatus], default: None ) –

    The result of a Lambda function that validates a deployment lifecycle event. The values listed in Valid Values are valid for lifecycle statuses in general; however, only Succeeded and Failed can be passed successfully in your API call.

Raises:

Source code in docs_src/capo_codedeploy/_services/code_deploy.py
def put_lifecycle_event_hook_execution_status(
    self,
    *,
    config_overrides: Optional[CodeDeployClientConfig] = None,
    deployment_id: Optional[
        "capo_codedeploy.types.deployment_id.DeploymentId"
    ] = None,
    lifecycle_event_hook_execution_id: Optional[
        "capo_codedeploy.types.lifecycle_event_hook_execution_id.LifecycleEventHookExecutionId"
    ] = None,
    status: Optional[
        "capo_codedeploy.types.lifecycle_event_status.LifecycleEventStatus"
    ] = None,
) -> "capo_codedeploy.types.put_lifecycle_event_hook_execution_status_output.PutLifecycleEventHookExecutionStatusOutput":
    """<p> Sets the result of a Lambda validation function. The function validates lifecycle hooks during a deployment that uses the Lambda or Amazon ECS compute platform. For Lambda deployments, the available lifecycle hooks are <code>BeforeAllowTraffic</code> and <code>AfterAllowTraffic</code>. For Amazon ECS deployments, the available lifecycle hooks are <code>BeforeInstall</code>, <code>AfterInstall</code>, <code>AfterAllowTestTraffic</code>, <code>BeforeAllowTraffic</code>, and <code>AfterAllowTraffic</code>. Lambda validation functions return <code>Succeeded</code> or <code>Failed</code>. For more information, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-lambda">AppSpec 'hooks' Section for an Lambda Deployment </a> and <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs">AppSpec 'hooks' Section for an Amazon ECS Deployment</a>.</p>

    Args:
        deployment_id: <p> The unique ID of a deployment. Pass this ID to a Lambda function that validates a deployment lifecycle event. </p>
        lifecycle_event_hook_execution_id: <p> The execution ID of a deployment's lifecycle hook. A deployment lifecycle hook is specified in the <code>hooks</code> section of the AppSpec file. </p>
        status: <p>The result of a Lambda function that validates a deployment lifecycle event. The values listed in <b>Valid Values</b> are valid for lifecycle statuses in general; however, only <code>Succeeded</code> and <code>Failed</code> can be passed successfully in your API call.</p>

    Raises:
        capo_codedeploy.errors.deployment_does_not_exist_exception.DeploymentDoesNotExistException: <p>The deployment with the user or Amazon Web Services account does not exist.</p>
        capo_codedeploy.errors.deployment_id_required_exception.DeploymentIdRequiredException: <p>At least one deployment ID must be specified.</p>
        capo_codedeploy.errors.invalid_deployment_id_exception.InvalidDeploymentIdException: <p>At least one of the deployment IDs was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_lifecycle_event_hook_execution_id_exception.InvalidLifecycleEventHookExecutionIdException: <p>A lifecycle event hook is invalid. Review the <code>hooks</code> section in your AppSpec file to ensure the lifecycle events and <code>hooks</code> functions are valid.</p>
        capo_codedeploy.errors.invalid_lifecycle_event_hook_execution_status_exception.InvalidLifecycleEventHookExecutionStatusException: <p>The result of a Lambda validation function that verifies a lifecycle event is invalid. It should return <code>Succeeded</code> or <code>Failed</code>.</p>
        capo_codedeploy.errors.lifecycle_event_already_completed_exception.LifecycleEventAlreadyCompletedException: <p>An attempt to return the status of an already completed lifecycle event occurred.</p>
        capo_codedeploy.errors.unsupported_action_for_deployment_type_exception.UnsupportedActionForDeploymentTypeException: <p>A call was submitted that is not supported for the specified deployment type.</p>
        capo_codedeploy.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codedeploy.types.put_lifecycle_event_hook_execution_status_input.PutLifecycleEventHookExecutionStatusInput]",
    ) -> OperationResponse[
        "capo_codedeploy.types.put_lifecycle_event_hook_execution_status_output.PutLifecycleEventHookExecutionStatusOutput"
    ]:
        import capo_codedeploy._operations.code_deploy_20141006.put_lifecycle_event_hook_execution_status

        output, http_response = (
            capo_codedeploy._operations.code_deploy_20141006.put_lifecycle_event_hook_execution_status.put_lifecycle_event_hook_execution_status(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutLifecycleEventHookExecutionStatus")
    )
    input_: capo_codedeploy.types.put_lifecycle_event_hook_execution_status_input.PutLifecycleEventHookExecutionStatusInput = {}
    if deployment_id is not None:
        input_["deployment_id"] = deployment_id
    if lifecycle_event_hook_execution_id is not None:
        input_["lifecycle_event_hook_execution_id"] = (
            lifecycle_event_hook_execution_id
        )
    if status is not None:
        input_["status"] = status

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output