Skip to content

start_pentest_job

start_pentest_job(
    agent_space_id: str,
    pentest_id: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    job_type: Optional[JobType] = None,
    selected_finding_ids: Optional[StringList] = None,
    scope_changes: Optional[ScopeChangeList] = None,
) -> StartPentestJobOutput

Starts a new pentest job for a pentest configuration. The job executes the security tests defined in the pentest.

Parameters:

  • agent_space_id (str) –

    The unique identifier of the agent space.

  • pentest_id (str) –

    The unique identifier of the pentest to start a job for.

  • job_type (Optional[JobType], default: None ) –

    The type of pentest job to start. Valid values are FULL, REVALIDATION, and CICD. When set to REVALIDATION, the selectedFindingIds parameter is required. When set to CICD, the scopeChanges parameter defines the code changes to test.

  • selected_finding_ids (Optional[StringList], default: None ) –

    The list of finding identifiers to revalidate. Required when jobType is REVALIDATION. Each finding must belong to the same agent space and pentest.

  • scope_changes (Optional[ScopeChangeList], default: None ) –

    The code changes that define the scope of a CI/CD pentest job. Provide this when starting a job with jobType CICD to test only the changes in the current pipeline run.

Raises:

Source code in docs_src/capo_securityagent/_services/security_agent.py
def start_pentest_job(
    self,
    agent_space_id: str,
    pentest_id: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    job_type: Optional["capo_securityagent.types.job_type.JobType"] = None,
    selected_finding_ids: Optional[
        "capo_securityagent.types.string_list.StringList"
    ] = None,
    scope_changes: Optional[
        "capo_securityagent.types.scope_change_list.ScopeChangeList"
    ] = None,
) -> "capo_securityagent.types.start_pentest_job_output.StartPentestJobOutput":
    """<p>Starts a new pentest job for a pentest configuration. The job executes the security tests defined in the pentest.</p>

    Args:
        agent_space_id: <p>The unique identifier of the agent space.</p>
        pentest_id: <p>The unique identifier of the pentest to start a job for.</p>
        job_type: <p>The type of pentest job to start. Valid values are FULL, REVALIDATION, and CICD. When set to REVALIDATION, the selectedFindingIds parameter is required. When set to CICD, the scopeChanges parameter defines the code changes to test.</p>
        selected_finding_ids: <p>The list of finding identifiers to revalidate. Required when jobType is REVALIDATION. Each finding must belong to the same agent space and pentest.</p>
        scope_changes: <p>The code changes that define the scope of a CI/CD pentest job. Provide this when starting a job with jobType CICD to test only the changes in the current pipeline run.</p>

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

    def _handler(
        req: "OperationRequest[capo_securityagent.types.start_pentest_job_input.StartPentestJobInput]",
    ) -> OperationResponse[
        "capo_securityagent.types.start_pentest_job_output.StartPentestJobOutput"
    ]:
        import capo_securityagent._operations.security_agent.start_pentest_job

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartPentestJob")
    )
    input_: capo_securityagent.types.start_pentest_job_input.StartPentestJobInput = {
        "agent_space_id": agent_space_id,
        "pentest_id": pentest_id,
    }
    if job_type is not None:
        input_["job_type"] = job_type
    if selected_finding_ids is not None:
        input_["selected_finding_ids"] = selected_finding_ids
    if scope_changes is not None:
        input_["scope_changes"] = scope_changes

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