Skip to content

put_evidence

put_evidence(
    environment_arn: EnvironmentArn,
    project: ProjectName,
    *,
    config_overrides: Optional[AssuranceClientConfig] = None,
    content: Optional[EvidenceContent] = None,
    title: Optional[EvidenceTitle] = None,
    description: Optional[EvidenceDescription] = None,
    evidence_id: Optional[str] = None,
    content_mime_type: Optional[str] = None,
    reference: Optional[EvidenceReference] = None,
    connection_id: Optional[ConnectionId] = None,
    control_references: Optional[ControlReferenceList] = None,
    link_mode: Optional[LinkMode] = None,
    purpose: Optional[EvidencePurpose] = None,
) -> PutEvidenceOutput

Adds evidence to support a compliance assessment. To add a new version of existing evidence, specify evidenceId.

Provide either the file content in content or a link to the document in reference, but not both.

Parameters:

  • environment_arn (EnvironmentArn) –

    The Amazon Resource Name (ARN) of this governance environment.

  • content (Optional[EvidenceContent], default: None ) –

    The file content. Required for a direct upload. You can't specify both content and reference.

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

    The title of the evidence. When you create new evidence, AWS Assurance derives the evidence ID from the title, in the form assurance://{sanitized-title}.

    Required when you specify content. Optional when you specify reference. If you omit it, AWS Assurance uses the name of the referenced document.

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

    The optional description of the evidence.

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

    The ID of existing evidence. Specify it to add a new version of that evidence. Omit it to create new evidence.

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

    The declared Multipurpose Internet Mail Extensions (MIME) type of the file, for example application/pdf. AWS Assurance checks the declared type against the actual file content. For the list of registered types, see Media Types on the IANA website.

  • project (ProjectName) –

    Project scope for the evidence.

  • reference (Optional[EvidenceReference], default: None ) –

    A link to the document. You can't specify both reference and content. Supported formats:

    • For a file in GitHub, a link in the form https://github.com/{owner}/{repo}/blob/{ref}/{path}.

    • For a document in SharePoint, any link to the document in the form https://{tenant}.sharepoint.com/{path}, including a sharing link.

    • For an object in Amazon S3, a URI in the form s3://{bucket}/{key}. The bucket must be the evidence bucket configured for the environment.

  • connection_id (Optional[ConnectionId], default: None ) –

    The ID of the connection to read reference through, as returned by ListEnvironmentConnections. Each new version of the document uses this connection too.

    Use this parameter only with reference.

    If you omit this parameter, the operation uses the single connection that can read the document. If the environment has more than one connection to the same provider, specify this parameter.

  • control_references (Optional[ControlReferenceList], default: None ) –

    The controls to link the evidence to when you add it. You can specify control links only when purpose is CONTROL_EVIDENCE.

  • link_mode (Optional[LinkMode], default: None ) –

    Specifies whether AWS Assurance analyzes the evidence and links it to relevant controls. A link shows that the evidence is relevant to a control, not that you meet the control. An assessment determines whether you meet the control. Specify one of the following values:

    • AUTO – AWS Assurance analyzes the evidence and adds control links.

    • MANUAL – AWS Assurance doesn't analyze the evidence. You add control links yourself.

    Automatic linking is available only to some accounts during the preview. If you omit this parameter, the default is AUTO for those accounts and MANUAL for all other accounts. Evidence whose purpose isn't CONTROL_EVIDENCE always has the mode DISABLED, which means that it can't be linked to controls. You can't specify AUTO for that evidence.

  • purpose (Optional[EvidencePurpose], default: None ) –

    What the evidence is for. Specify one of the following values:

    • CONTROL_EVIDENCE – Evidence that supports controls.

    • FRAMEWORK_SOURCE – The document that you create a custom framework from. AWS Assurance never links this evidence to controls.

    You can't specify SCAN_EVIDENCE. If you omit this parameter, a new version keeps the purpose of the existing evidence, and new evidence uses CONTROL_EVIDENCE. You can't change the purpose in a new version.

Raises:

Examples:

Add evidence for an assessment Adds a user access review as evidence for the payments-prod PCI-DSS assessment.

>>> client.put_evidence(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', content='JVBERi0xLjQK', title='PCI-DSS user access review.pdf', project='payments-prod')
Source code in docs_src/capo_assurance/_services/assurance.py
def put_evidence(
    self,
    environment_arn: "capo_assurance.types.environment_arn.EnvironmentArn",
    project: "capo_assurance.types.project_name.ProjectName",
    *,
    config_overrides: Optional[AssuranceClientConfig] = None,
    content: Optional[
        "capo_assurance.types.evidence_content.EvidenceContent"
    ] = None,
    title: Optional["capo_assurance.types.evidence_title.EvidenceTitle"] = None,
    description: Optional[
        "capo_assurance.types.evidence_description.EvidenceDescription"
    ] = None,
    evidence_id: Optional[str] = None,
    content_mime_type: Optional[str] = None,
    reference: Optional[
        "capo_assurance.types.evidence_reference.EvidenceReference"
    ] = None,
    connection_id: Optional[
        "capo_assurance.types.connection_id.ConnectionId"
    ] = None,
    control_references: Optional[
        "capo_assurance.types.control_reference_list.ControlReferenceList"
    ] = None,
    link_mode: Optional["capo_assurance.types.link_mode.LinkMode"] = None,
    purpose: Optional[
        "capo_assurance.types.evidence_purpose.EvidencePurpose"
    ] = None,
) -> "capo_assurance.types.put_evidence_output.PutEvidenceOutput":
    """<p>Adds evidence to support a compliance assessment. To add a new version of existing evidence, specify <code>evidenceId</code>.</p> <p>Provide either the file content in <code>content</code> or a link to the document in <code>reference</code>, but not both.</p>

    Args:
        environment_arn: <p>The Amazon Resource Name (ARN) of this governance environment.</p>
        content: <p>The file content. Required for a direct upload. You can't specify both <code>content</code> and <code>reference</code>.</p>
        title: <p>The title of the evidence. When you create new evidence, AWS Assurance derives the evidence ID from the title, in the form <code>assurance://{sanitized-title}</code>.</p> <p>Required when you specify <code>content</code>. Optional when you specify <code>reference</code>. If you omit it, AWS Assurance uses the name of the referenced document.</p>
        description: <p>The optional description of the evidence.</p>
        evidence_id: <p>The ID of existing evidence. Specify it to add a new version of that evidence. Omit it to create new evidence.</p>
        content_mime_type: <p>The declared Multipurpose Internet Mail Extensions (MIME) type of the file, for example <code>application/pdf</code>. AWS Assurance checks the declared type against the actual file content. For the list of registered types, see <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Types</a> on the IANA website.</p>
        project: <p>Project scope for the evidence.</p>
        reference: <p>A link to the document. You can't specify both <code>reference</code> and <code>content</code>. Supported formats:</p> <ul> <li> <p>For a file in GitHub, a link in the form https://github.com/{owner}/{repo}/blob/{ref}/{path}.</p> </li> <li> <p>For a document in SharePoint, any link to the document in the form https://{tenant}.sharepoint.com/{path}, including a sharing link.</p> </li> <li> <p>For an object in Amazon S3, a URI in the form s3://{bucket}/{key}. The bucket must be the evidence bucket configured for the environment.</p> </li> </ul>
        connection_id: <p>The ID of the connection to read <code>reference</code> through, as returned by <code>ListEnvironmentConnections</code>. Each new version of the document uses this connection too.</p> <p>Use this parameter only with <code>reference</code>.</p> <p>If you omit this parameter, the operation uses the single connection that can read the document. If the environment has more than one connection to the same provider, specify this parameter.</p>
        control_references: <p>The controls to link the evidence to when you add it. You can specify control links only when <code>purpose</code> is <code>CONTROL_EVIDENCE</code>.</p>
        link_mode: <p>Specifies whether AWS Assurance analyzes the evidence and links it to relevant controls. A link shows that the evidence is relevant to a control, not that you meet the control. An assessment determines whether you meet the control. Specify one of the following values:</p> <ul> <li> <p> <code>AUTO</code> – AWS Assurance analyzes the evidence and adds control links.</p> </li> <li> <p> <code>MANUAL</code> – AWS Assurance doesn't analyze the evidence. You add control links yourself.</p> </li> </ul> <p>Automatic linking is available only to some accounts during the preview. If you omit this parameter, the default is <code>AUTO</code> for those accounts and <code>MANUAL</code> for all other accounts. Evidence whose <code>purpose</code> isn't <code>CONTROL_EVIDENCE</code> always has the mode <code>DISABLED</code>, which means that it can't be linked to controls. You can't specify <code>AUTO</code> for that evidence.</p>
        purpose: <p>What the evidence is for. Specify one of the following values:</p> <ul> <li> <p> <code>CONTROL_EVIDENCE</code> – Evidence that supports controls.</p> </li> <li> <p> <code>FRAMEWORK_SOURCE</code> – The document that you create a custom framework from. AWS Assurance never links this evidence to controls.</p> </li> </ul> <p>You can't specify <code>SCAN_EVIDENCE</code>. If you omit this parameter, a new version keeps the purpose of the existing evidence, and new evidence uses <code>CONTROL_EVIDENCE</code>. You can't change the purpose in a new version.</p>

    Raises:
        capo_assurance.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.</p>
        capo_assurance.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred.</p>
        capo_assurance.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_assurance.errors.throttling_exception.ThrottlingException: <p>The request was throttled.</p>
        capo_assurance.errors.validation_exception.ValidationException: <p>The request failed validation.</p>
        capo_assurance.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Add evidence for an assessment
        Adds a user access review as evidence for the payments-prod PCI-DSS assessment.

        >>> client.put_evidence(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', content='JVBERi0xLjQK', title='PCI-DSS user access review.pdf', project='payments-prod')
    """

    def _handler(
        req: "OperationRequest[capo_assurance.types.put_evidence_input.PutEvidenceInput]",
    ) -> OperationResponse[
        "capo_assurance.types.put_evidence_output.PutEvidenceOutput"
    ]:
        import capo_assurance._operations.assurance.put_evidence

        output, http_response = (
            capo_assurance._operations.assurance.put_evidence.put_evidence(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_assurance.types.put_evidence_input.PutEvidenceInput",
    ) -> dict[str, Any]:
        import capo_assurance.types.put_evidence_input

        return capo_assurance.types.put_evidence_input.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("PutEvidence", redact_input=_redact_input),
    )
    input_: capo_assurance.types.put_evidence_input.PutEvidenceInput = {
        "environment_arn": environment_arn,
        "project": project,
    }
    if content is not None:
        input_["content"] = content
    if title is not None:
        input_["title"] = title
    if description is not None:
        input_["description"] = description
    if evidence_id is not None:
        input_["evidence_id"] = evidence_id
    if content_mime_type is not None:
        input_["content_mime_type"] = content_mime_type
    if reference is not None:
        input_["reference"] = reference
    if connection_id is not None:
        input_["connection_id"] = connection_id
    if control_references is not None:
        input_["control_references"] = control_references
    if link_mode is not None:
        input_["link_mode"] = link_mode
    if purpose is not None:
        input_["purpose"] = purpose

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