Skip to content

add_artifact

add_artifact(
    agent_space_id: AgentSpaceId,
    artifact_content: bytes,
    artifact_type: ArtifactType,
    file_name: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
) -> AddArtifactOutput

Uploads an artifact to an agent space. Artifacts provide additional context for security testing, such as architecture diagrams, API specifications, or configuration files.

Parameters:

  • agent_space_id (AgentSpaceId) –

    The unique identifier of the agent space to add the artifact to.

  • artifact_content (bytes) –

    The binary content of the artifact to upload.

  • artifact_type (ArtifactType) –

    The file type of the artifact. Valid values include TXT, PNG, JPEG, MD, PDF, DOCX, DOC, JSON, and YAML.

  • file_name (str) –

    The file name of the artifact.

Raises:

Source code in docs_src/capo_securityagent/_services/security_agent.py
def add_artifact(
    self,
    agent_space_id: "capo_securityagent.types.agent_space_id.AgentSpaceId",
    artifact_content: bytes,
    artifact_type: "capo_securityagent.types.artifact_type.ArtifactType",
    file_name: str,
    *,
    config_overrides: Optional[SecurityAgentClientConfig] = None,
) -> "capo_securityagent.types.add_artifact_output.AddArtifactOutput":
    """<p>Uploads an artifact to an agent space. Artifacts provide additional context for security testing, such as architecture diagrams, API specifications, or configuration files.</p>

    Args:
        agent_space_id: <p>The unique identifier of the agent space to add the artifact to.</p>
        artifact_content: <p>The binary content of the artifact to upload.</p>
        artifact_type: <p>The file type of the artifact. Valid values include TXT, PNG, JPEG, MD, PDF, DOCX, DOC, JSON, and YAML.</p>
        file_name: <p>The file name of the artifact.</p>

    Raises:
        capo_securityagent.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_securityagent.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of your request.</p>
        capo_securityagent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Verify that the resource identifier is correct and that the resource exists in the specified agent space or account.</p>
        capo_securityagent.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_securityagent.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_securityagent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_securityagent.types.add_artifact_input.AddArtifactInput]",
    ) -> OperationResponse[
        "capo_securityagent.types.add_artifact_output.AddArtifactOutput"
    ]:
        import capo_securityagent._operations.security_agent.add_artifact

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddArtifact")
    )
    input_: capo_securityagent.types.add_artifact_input.AddArtifactInput = {
        "agent_space_id": agent_space_id,
        "artifact_content": artifact_content,
        "artifact_type": artifact_type,
        "file_name": file_name,
    }

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