Skip to content

update_threat

update_threat(
    threat_id: str,
    agent_space_id: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    title: Optional[str] = None,
    status: Optional[ThreatStatus] = None,
    comments: Optional[str] = None,
    statement: Optional[str] = None,
    severity: Optional[ThreatSeverity] = None,
    threat_source: Optional[str] = None,
    prerequisites: Optional[str] = None,
    threat_action: Optional[str] = None,
    threat_impact: Optional[str] = None,
    impacted_goal: Optional[StringList] = None,
    impacted_assets: Optional[StringList] = None,
    anchor: Optional[ThreatAnchorShape] = None,
    evidence: Optional[ThreatEvidenceList] = None,
    recommendation: Optional[str] = None,
) -> UpdateThreatOutput

Updates a threat.

Parameters:

  • threat_id (str) –

    The unique identifier of the threat to update.

  • agent_space_id (str) –

    The unique identifier of the agent space.

  • title (Optional[str], default: None ) –

    A short title summarizing the threat.

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

    The updated status of the threat.

  • comments (Optional[str], default: None ) –

    Optional customer comment.

  • statement (Optional[str], default: None ) –

    The updated natural-language threat statement.

  • severity (Optional[ThreatSeverity], default: None ) –

    The updated severity level of the threat.

  • threat_source (Optional[str], default: None ) –

    The updated actor or origin of the threat.

  • prerequisites (Optional[str], default: None ) –

    The updated conditions required for the threat to be exploitable.

  • threat_action (Optional[str], default: None ) –

    The updated description of what the threat source can do.

  • threat_impact (Optional[str], default: None ) –

    The updated direct consequence of the threat action.

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

    The updated security goals affected by the threat.

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

    The updated list of specific assets affected by the threat.

  • anchor (Optional[ThreatAnchorShape], default: None ) –

    The updated DFD element this threat is anchored to.

  • evidence (Optional[ThreatEvidenceList], default: None ) –

    The updated source code files supporting the threat.

  • recommendation (Optional[str], default: None ) –

    The updated recommended mitigation guidance for this threat.

Raises:

Source code in docs_src/capo_securityagent/_services/security_agent.py
def update_threat(
    self,
    threat_id: str,
    agent_space_id: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    title: Optional[str] = None,
    status: Optional["capo_securityagent.types.threat_status.ThreatStatus"] = None,
    comments: Optional[str] = None,
    statement: Optional[str] = None,
    severity: Optional[
        "capo_securityagent.types.threat_severity.ThreatSeverity"
    ] = None,
    threat_source: Optional[str] = None,
    prerequisites: Optional[str] = None,
    threat_action: Optional[str] = None,
    threat_impact: Optional[str] = None,
    impacted_goal: Optional[
        "capo_securityagent.types.string_list.StringList"
    ] = None,
    impacted_assets: Optional[
        "capo_securityagent.types.string_list.StringList"
    ] = None,
    anchor: Optional[
        "capo_securityagent.types.threat_anchor_shape.ThreatAnchorShape"
    ] = None,
    evidence: Optional[
        "capo_securityagent.types.threat_evidence_list.ThreatEvidenceList"
    ] = None,
    recommendation: Optional[str] = None,
) -> "capo_securityagent.types.update_threat_output.UpdateThreatOutput":
    """<p>Updates a threat.</p>

    Args:
        threat_id: <p>The unique identifier of the threat to update.</p>
        agent_space_id: <p>The unique identifier of the agent space.</p>
        title: <p>A short title summarizing the threat.</p>
        status: <p>The updated status of the threat.</p>
        comments: <p>Optional customer comment.</p>
        statement: <p>The updated natural-language threat statement.</p>
        severity: <p>The updated severity level of the threat.</p>
        threat_source: <p>The updated actor or origin of the threat.</p>
        prerequisites: <p>The updated conditions required for the threat to be exploitable.</p>
        threat_action: <p>The updated description of what the threat source can do.</p>
        threat_impact: <p>The updated direct consequence of the threat action.</p>
        impacted_goal: <p>The updated security goals affected by the threat.</p>
        impacted_assets: <p>The updated list of specific assets affected by the threat.</p>
        anchor: <p>The updated DFD element this threat is anchored to.</p>
        evidence: <p>The updated source code files supporting the threat.</p>
        recommendation: <p>The updated recommended mitigation guidance for this threat.</p>

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

    def _handler(
        req: "OperationRequest[capo_securityagent.types.update_threat_input.UpdateThreatInput]",
    ) -> OperationResponse[
        "capo_securityagent.types.update_threat_output.UpdateThreatOutput"
    ]:
        import capo_securityagent._operations.security_agent.update_threat

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateThreat")
    )
    input_: capo_securityagent.types.update_threat_input.UpdateThreatInput = {
        "threat_id": threat_id,
        "agent_space_id": agent_space_id,
    }
    if title is not None:
        input_["title"] = title
    if status is not None:
        input_["status"] = status
    if comments is not None:
        input_["comments"] = comments
    if statement is not None:
        input_["statement"] = statement
    if severity is not None:
        input_["severity"] = severity
    if threat_source is not None:
        input_["threat_source"] = threat_source
    if prerequisites is not None:
        input_["prerequisites"] = prerequisites
    if threat_action is not None:
        input_["threat_action"] = threat_action
    if threat_impact is not None:
        input_["threat_impact"] = threat_impact
    if impacted_goal is not None:
        input_["impacted_goal"] = impacted_goal
    if impacted_assets is not None:
        input_["impacted_assets"] = impacted_assets
    if anchor is not None:
        input_["anchor"] = anchor
    if evidence is not None:
        input_["evidence"] = evidence
    if recommendation is not None:
        input_["recommendation"] = recommendation

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