Skip to content

start_attachment_upload async

start_attachment_upload(
    content_type: ContentType,
    attachment_size_in_bytes: AttachmentSizeInBytes,
    attachment_name: AttachmentName,
    client_token: NonEmptyClientToken,
    connection_token: ParticipantToken,
    *,
    config_overrides: Optional[AsyncConnectParticipantClientConfig] = None,
) -> StartAttachmentUploadResponse

Provides a pre-signed Amazon S3 URL in response for uploading the file directly to S3.

For security recommendations, see Connect Customer Chat security best practices.

ConnectionToken is used for invoking this API instead of ParticipantToken.

The Amazon Connect Participant Service APIs do not use Signature Version 4 authentication.

Parameters:

  • content_type (ContentType) –

    Describes the MIME file type of the attachment. For a list of supported file types, see Feature specifications in the Amazon Connect Administrator Guide.

  • attachment_size_in_bytes (AttachmentSizeInBytes) –

    The size of the attachment in bytes.

  • attachment_name (AttachmentName) –

    A case-sensitive name of the attachment being uploaded.

  • client_token (NonEmptyClientToken) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

  • connection_token (ParticipantToken) –

    The authentication token associated with the participant's connection.

Raises:

Source code in docs_src/capo_connectparticipant/_services/async_connect_participant.py
async def start_attachment_upload(
    self,
    content_type: "capo_connectparticipant.types.content_type.ContentType",
    attachment_size_in_bytes: "capo_connectparticipant.types.attachment_size_in_bytes.AttachmentSizeInBytes",
    attachment_name: "capo_connectparticipant.types.attachment_name.AttachmentName",
    client_token: "capo_connectparticipant.types.non_empty_client_token.NonEmptyClientToken",
    connection_token: "capo_connectparticipant.types.participant_token.ParticipantToken",
    *,
    config_overrides: Optional[AsyncConnectParticipantClientConfig] = None,
) -> "capo_connectparticipant.types.start_attachment_upload_response.StartAttachmentUploadResponse":
    """<p>Provides a pre-signed Amazon S3 URL in response for uploading the file directly to S3.</p> <p>For security recommendations, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/security-best-practices.html#bp-security-chat">Connect Customer Chat security best practices</a>. </p> <note> <p> <code>ConnectionToken</code> is used for invoking this API instead of <code>ParticipantToken</code>.</p> </note> <p>The Amazon Connect Participant Service APIs do not use <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Signature Version 4 authentication</a>.</p>

    Args:
        content_type: <p>Describes the MIME file type of the attachment. For a list of supported file types, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/feature-limits.html">Feature specifications</a> in the <i>Amazon Connect Administrator Guide</i>.</p>
        attachment_size_in_bytes: <p>The size of the attachment in bytes.</p>
        attachment_name: <p>A case-sensitive name of the attachment being uploaded.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
        connection_token: <p>The authentication token associated with the participant's connection.</p>

    Raises:
        capo_connectparticipant.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_connectparticipant.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Amazon Connect service.</p>
        capo_connectparticipant.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of attachments per contact exceeds the quota.</p>
        capo_connectparticipant.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_connectparticipant.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by Amazon Connect.</p>
        capo_connectparticipant.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connectparticipant.types.start_attachment_upload_request.StartAttachmentUploadRequest]",
    ) -> AsyncOperationResponse[
        "capo_connectparticipant.types.start_attachment_upload_response.StartAttachmentUploadResponse"
    ]:
        import capo_connectparticipant._operations.amazon_connect_participant_service_lambda.start_attachment_upload

        (
            output,
            http_response,
        ) = await capo_connectparticipant._operations.amazon_connect_participant_service_lambda.start_attachment_upload.async_start_attachment_upload(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartAttachmentUpload")
    )
    input_: capo_connectparticipant.types.start_attachment_upload_request.StartAttachmentUploadRequest = {
        "content_type": content_type,
        "attachment_size_in_bytes": attachment_size_in_bytes,
        "attachment_name": attachment_name,
        "client_token": client_token,
        "connection_token": connection_token,
    }

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