create_presigned_url
async
¶
create_presigned_url(
instance_id: InstanceId,
card_id: UUID,
app_id: UUID,
file_contents_sha256: str,
file_name: Filename,
scope: DocumentScope,
*,
config_overrides: Optional[AsyncQAppsClientConfig] = None,
session_id: Optional[UUID] = None,
) -> CreatePresignedUrlOutput
Creates a presigned URL for an S3 POST operation to upload a file. You can use this URL to set a default file for a FileUploadCard in a Q App definition or to provide a file for a single Q App run. The scope parameter determines how the file will be used, either at the app definition level or the app session level.
The IAM permissions are derived from the qapps:ImportDocument action. For more information on the IAM policy for Amazon Q Apps, see IAM permissions for using Amazon Q Apps.
Parameters:
-
instance_id(InstanceId) –The unique identifier of the Amazon Q Business application environment instance.
-
card_id(UUID) –The unique identifier of the card the file is associated with.
-
app_id(UUID) –The unique identifier of the Q App the file is associated with.
-
file_contents_sha256(str) –The Base64-encoded SHA-256 digest of the contents of the file to be uploaded.
-
file_name(Filename) –The name of the file to be uploaded.
-
scope(DocumentScope) –Whether the file is associated with a Q App definition or a specific Q App session.
-
session_id(Optional[UUID], default:None) –The unique identifier of the Q App session the file is associated with, if applicable.
Raises:
-
AccessDeniedException–The client is not authorized to perform the requested operation.
-
InternalServerException–An internal service error occurred while processing the request.
-
ThrottlingException–The requested operation could not be completed because too many requests were sent at once. Wait a bit and try again later.
-
UnauthorizedException–The client is not authenticated or authorized to perform the requested operation.
-
ValidationException–The input failed to satisfy the constraints specified by the service.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Upload a file to a specific session
>>> await client.create_presigned_url(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', file_contents_sha256='wXY7GD8m4fmHhdtuQyBdXzNQpdCseVwBcOBIlzfm+kg=', file_name='myFile.txt', card_id='82f69028-22a9-4bea-8727-0eabf58e9fed', app_id='4263767c-d889-4cb2-a8f6-8b649bc66af0', scope='SESSION', session_id='4f0e5b87-9d38-41cd-9eb4-ebce2f2917cc')
Upload a file into a application
>>> await client.create_presigned_url(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', file_contents_sha256='wXY7GD8m4fmHhdtuQyBdXzNQpdCseVwBcOBIlzfm+kg=', file_name='anApplicationFile.txt', app_id='4263767c-d889-4cb2-a8f6-8b649bc66af0', card_id='7a11f34b-42d4-4bc8-b668-ae4a788dae1e', scope='APPLICATION')
Source code in docs_src/capo_qapps/_services/async_q_apps.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | |