Skip to content

create_threat_model

create_threat_model(
    title: str,
    agent_space_id: str,
    service_role: ServiceRole,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    description: Optional[str] = None,
    assets: Optional[Assets] = None,
    scope_docs: Optional[DocumentList] = None,
    log_config: Optional[CloudWatchLog] = None,
    report_destination: Optional[ReportDestination] = None,
) -> CreateThreatModelOutput

Creates a new threat model configuration in an agent space. A threat model defines the parameters for automated threat analysis.

Parameters:

  • title (str) –

    The title of the threat model.

  • agent_space_id (str) –

    The unique identifier of the agent space to create the threat model in.

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

    A description of the application or system being threat modeled.

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

    The assets to include in the threat model.

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

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

  • service_role (ServiceRole) –

    The IAM service role to use for the threat model.

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

    The 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/security_agent.py
def create_threat_model(
    self,
    title: str,
    agent_space_id: str,
    service_role: "capo_securityagent.types.service_role.ServiceRole",
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
    description: Optional[str] = None,
    assets: Optional["capo_securityagent.types.assets.Assets"] = None,
    scope_docs: Optional[
        "capo_securityagent.types.document_list.DocumentList"
    ] = 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.create_threat_model_output.CreateThreatModelOutput":
    """<p>Creates a new threat model configuration in an agent space. A threat model defines the parameters for automated threat analysis.</p>

    Args:
        title: <p>The title of the threat model.</p>
        agent_space_id: <p>The unique identifier of the agent space to create the threat model in.</p>
        description: <p>A description of the application or system being threat modeled.</p>
        assets: <p>The assets to include in the threat model.</p>
        scope_docs: <p>The scoped documents for the agent to focus on during threat modeling.</p>
        service_role: <p>The IAM service role to use for the threat model.</p>
        log_config: <p>The 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.
    """

    def _handler(
        req: "OperationRequest[capo_securityagent.types.create_threat_model_input.CreateThreatModelInput]",
    ) -> OperationResponse[
        "capo_securityagent.types.create_threat_model_output.CreateThreatModelOutput"
    ]:
        import capo_securityagent._operations.security_agent.create_threat_model

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

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

        return capo_securityagent.types.create_threat_model_input.redact_sensitive(
            input_
        )

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

        return capo_securityagent.types.create_threat_model_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateThreatModel",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_securityagent.types.create_threat_model_input.CreateThreatModelInput = {
        "title": title,
        "agent_space_id": agent_space_id,
        "service_role": service_role,
    }
    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 log_config is not None:
        input_["log_config"] = log_config
    if report_destination is not None:
        input_["report_destination"] = report_destination

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