import_document
¶
import_document(
instance_id: InstanceId,
card_id: UUID,
app_id: UUID,
file_contents_base64: str,
file_name: Filename,
scope: DocumentScope,
*,
config_overrides: Optional[QAppsClientConfig] = None,
session_id: Optional[UUID] = None,
) -> ImportDocumentOutput
Uploads a file that can then be used either as a default in a FileUploadCard from Q App definition or as a file that is used inside a single Q App run. The purpose of the document is determined by a scope parameter that indicates whether it is at the app definition level or at the app session level.
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_base64(str) –The base64-encoded contents of the file to upload.
-
file_name(Filename) –The name of the file being 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.
-
ContentTooLargeException–The requested operation could not be completed because the content exceeds the maximum allowed size.
-
InternalServerException–An internal service error occurred while processing the request.
-
ResourceNotFoundException–The requested resource could not be found.
-
ServiceQuotaExceededException–The requested operation could not be completed because it would exceed the service's quota or limit.
-
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
>>> client.import_document(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', file_contents_base64='data:text/plain;base64,SomeFileEncodedInBase64', 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
>>> client.import_document(instance_id='0b95c9c4-89cc-4aa8-9aae-aa91cbec699f', file_contents_base64='data:text/plain;base64,SomeFileEncodedInBase64', 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/q_apps.py
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 | |