in source/services/webclient-setup/lambda_function.py [0:0]
def delete_resource(event, _):
resource_properties = event["ResourceProperties"]
list_objects = s3_client.list_objects(Bucket=resource_properties['SampleWebClientBucket'])
if "Contents" in list_objects and len(list_objects["Contents"]) > 0:
for file in list_objects["Contents"]:
try:
s3_client.delete_object(Bucket=resource_properties['SampleWebClientBucket'], Key=file['Key'])
except Exception as e:
logger.info(e)