Skip to content

stop_pentest_job

stop_pentest_job(
    agent_space_id: str,
    pentest_job_id: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    pause: Optional[bool] = None,
) -> StopPentestJobOutput

Stops a running pentest job. The job transitions to a stopping state and then to stopped after cleanup completes.

Parameters:

  • agent_space_id (str) –

    The unique identifier of the agent space.

  • pentest_job_id (str) –

    The unique identifier of the pentest job to stop.

  • pause (Optional[bool], default: None ) –

    Specifies whether to pause the job instead of stopping it. A paused job moves to PAUSING and then to PAUSED, and you can resume it later with ResumePentestJob. You can pause only a job that is IN_PROGRESS. The default is false.

Raises:

Source code in docs_src/capo_securityagent/_services/security_agent.py
def stop_pentest_job(
    self,
    agent_space_id: str,
    pentest_job_id: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    pause: Optional[bool] = None,
) -> "capo_securityagent.types.stop_pentest_job_output.StopPentestJobOutput":
    """<p>Stops a running pentest job. The job transitions to a stopping state and then to stopped after cleanup completes.</p>

    Args:
        agent_space_id: <p>The unique identifier of the agent space.</p>
        pentest_job_id: <p>The unique identifier of the pentest job to stop.</p>
        pause: <p>Specifies whether to pause the job instead of stopping it. A paused job moves to <code>PAUSING</code> and then to <code>PAUSED</code>, and you can resume it later with <code>ResumePentestJob</code>. You can pause only a job that is <code>IN_PROGRESS</code>. The default is false.</p>

    Raises:
        capo_securityagent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_securityagent.types.stop_pentest_job_input.StopPentestJobInput]",
    ) -> OperationResponse[
        "capo_securityagent.types.stop_pentest_job_output.StopPentestJobOutput"
    ]:
        import capo_securityagent._operations.security_agent.stop_pentest_job

        output, http_response = (
            capo_securityagent._operations.security_agent.stop_pentest_job.stop_pentest_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StopPentestJob")
    )
    input_: capo_securityagent.types.stop_pentest_job_input.StopPentestJobInput = {
        "agent_space_id": agent_space_id,
        "pentest_job_id": pentest_job_id,
    }
    if pause is not None:
        input_["pause"] = pause

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