Skip to content

update_threat_model async

update_threat_model(
    threat_model_id: str,
    agent_space_id: str,
    *,
    config_overrides: Optional[AsyncSecurityAgentClientConfig] = None,
    title: Optional[str] = None,
    description: Optional[str] = None,
    assets: Optional[Assets] = None,
    scope_docs: Optional[DocumentList] = None,
    service_role: Optional[ServiceRole] = None,
    log_config: Optional[CloudWatchLog] = None,
    report_destination: Optional[ReportDestination] = None,
) -> UpdateThreatModelOutput

Updates an existing threat model configuration.

Parameters:

  • threat_model_id (str) –

    The unique identifier of the threat model to update.

  • agent_space_id (str) –

    The unique identifier of the agent space that contains the threat model.

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

    The updated title of the threat model.

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

    The updated description of the application or system being threat modeled.

  • assets (Optional[Assets], default: None ) –

    The updated assets for the threat model.

  • scope_docs (Optional[DocumentList], default: None ) –

    The updated scoped documents for the agent to focus on during threat modeling.

  • service_role (Optional[ServiceRole], default: None ) –

    The updated IAM service role for the threat model.

  • log_config (Optional[CloudWatchLog], default: None ) –

    The updated CloudWatch Logs configuration for the threat model.

  • report_destination (Optional[ReportDestination], default: None ) –

    The destination for publishing scan reports to an integrated document provider.

Raises:

Source code in docs_src/capo_securityagent/_services/async_security_agent.py
async def update_threat_model(
    self,
    threat_model_id: str,
    agent_space_id: str,
    *,
    config_overrides: Optional[AsyncSecurityAgentClientConfig] = None,
    title: Optional[str] = None,
    description: Optional[str] = None,
    assets: Optional["capo_securityagent.types.assets.Assets"] = None,
    scope_docs: Optional[
        "capo_securityagent.types.document_list.DocumentList"
    ] = None,
    service_role: Optional[
        "capo_securityagent.types.service_role.ServiceRole"
    ] = None,
    log_config: Optional[
        "capo_securityagent.types.cloud_watch_log.CloudWatchLog"
    ] = None,
    report_destination: Optional[
        "capo_securityagent.types.report_destination.ReportDestination"
    ] = None,
) -> "capo_securityagent.types.update_threat_model_output.UpdateThreatModelOutput":
    """<p>Updates an existing threat model configuration.</p>

    Args:
        threat_model_id: <p>The unique identifier of the threat model to update.</p>
        agent_space_id: <p>The unique identifier of the agent space that contains the threat model.</p>
        title: <p>The updated title of the threat model.</p>
        description: <p>The updated description of the application or system being threat modeled.</p>
        assets: <p>The updated assets for the threat model.</p>
        scope_docs: <p>The updated scoped documents for the agent to focus on during threat modeling.</p>
        service_role: <p>The updated IAM service role for the threat model.</p>
        log_config: <p>The updated CloudWatch Logs configuration for the threat model.</p>
        report_destination: <p>The destination for publishing scan reports to an integrated document provider.</p>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_securityagent.types.update_threat_model_input.UpdateThreatModelInput]",
    ) -> AsyncOperationResponse[
        "capo_securityagent.types.update_threat_model_output.UpdateThreatModelOutput"
    ]:
        import capo_securityagent._operations.security_agent.update_threat_model

        (
            output,
            http_response,
        ) = await capo_securityagent._operations.security_agent.update_threat_model.async_update_threat_model(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_securityagent.types.update_threat_model_input.UpdateThreatModelInput",
    ) -> dict[str, Any]:
        import capo_securityagent.types.update_threat_model_input

        return capo_securityagent.types.update_threat_model_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_securityagent.types.update_threat_model_output.UpdateThreatModelOutput",
    ) -> dict[str, Any]:
        import capo_securityagent.types.update_threat_model_output

        return capo_securityagent.types.update_threat_model_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateThreatModel",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_securityagent.types.update_threat_model_input.UpdateThreatModelInput = {
        "threat_model_id": threat_model_id,
        "agent_space_id": agent_space_id,
    }
    if title is not None:
        input_["title"] = title
    if description is not None:
        input_["description"] = description
    if assets is not None:
        input_["assets"] = assets
    if scope_docs is not None:
        input_["scope_docs"] = scope_docs
    if service_role is not None:
        input_["service_role"] = service_role
    if log_config is not None:
        input_["log_config"] = log_config
    if report_destination is not None:
        input_["report_destination"] = report_destination

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output