in functions/source/kendra_custom_resource/kendra_custom_resource.py [0:0]
def create(event, _):
"""
Helper function for resource creation.
Populates Data with Kendra Index Id so poll_create helper can refer to it.
Raises Exception if required resource properties are missing.
Any exception raised is displayed in CloudFormation console.
:param event: Event body
:param _: Context (unused)
:return: None
"""
logger.info("Got Create")
if 'ResourceProperties' not in event:
raise ValueError("Please provide resource properties")
required_properties = ['IndexName',
'Edition',
'IndexRoleArn',
'DataSourceName',
'KendraS3Bucket',
'DataSourceRoleArn',
'FAQName',
'FAQRoleArn',
'FAQFileKey']
for resource_property in required_properties:
check_required_properties(event['ResourceProperties'], resource_property)
kendra_index_id = create_kendra_index(event['ResourceProperties'])
# To add response data update the helper.Data dict
# If poll is enabled data is placed into poll event as event['CrHelperData']
helper.Data['KendraIndexId'] = kendra_index_id