in functions/source/kendra_custom_resource/kendra_custom_resource.py [0:0]
def create_kendra_faq(kendra_index_id, resource_properties):
"""
Creates FAQ.
:param kendra_index_id: Kendra Index Id
:param resource_properties: Dictionary of resources properties.
FAQName, KendraS3Bucket, FAQFileKey and FAQRoleArn are mandatory.
:return: FAQ Id
"""
faq_kwargs = {
'Name': resource_properties['FAQName'],
'IndexId': kendra_index_id,
'S3Path': {
'Bucket': resource_properties['KendraS3Bucket'],
'Key': resource_properties['FAQFileKey']
},
'RoleArn': resource_properties['FAQRoleArn']
}
if 'FAQDescription' in resource_properties:
faq_kwargs['Description'] = resource_properties['FAQDescription']
else:
faq_kwargs['Description'] = "FAQs for COVID-19"
response_faq = kendra_client.create_faq(**faq_kwargs)
logger.info('FAQId: %s', str(response_faq['Id']))
return response_faq['Id']