createPresignedUrl

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.

Samples

import aws.sdk.kotlin.services.qapps.model.DocumentScope

fun main() { 
   //sampleStart 
   // Upload a file to a specific session
val resp = qAppsClient.createPresignedUrl {
    instanceId = "0b95c9c4-89cc-4aa8-9aae-aa91cbec699f"
    fileContentsSha256 = "wXY7GD8m4fmHhdtuQyBdXzNQpdCseVwBcOBIlzfm+kg="
    fileName = "myFile.txt"
    cardId = "82f69028-22a9-4bea-8727-0eabf58e9fed"
    appId = "4263767c-d889-4cb2-a8f6-8b649bc66af0"
    scope = DocumentScope.fromValue("SESSION")
    sessionId = "4f0e5b87-9d38-41cd-9eb4-ebce2f2917cc"
} 
   //sampleEnd
}
import aws.sdk.kotlin.services.qapps.model.DocumentScope

fun main() { 
   //sampleStart 
   // Upload a file into a application
val resp = qAppsClient.createPresignedUrl {
    instanceId = "0b95c9c4-89cc-4aa8-9aae-aa91cbec699f"
    fileContentsSha256 = "wXY7GD8m4fmHhdtuQyBdXzNQpdCseVwBcOBIlzfm+kg="
    fileName = "anApplicationFile.txt"
    appId = "4263767c-d889-4cb2-a8f6-8b649bc66af0"
    cardId = "7a11f34b-42d4-4bc8-b668-ae4a788dae1e"
    scope = DocumentScope.fromValue("APPLICATION")
} 
   //sampleEnd
}