Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Geofence Lambda to incorporate CF update condition for geofenc… #198

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

wadhawh
Copy link
Collaborator

@wadhawh wadhawh commented Jun 16, 2024

…es update

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@wadhawh wadhawh requested a review from its-aazizi June 16, 2024 14:36
Comment on lines 929 to 931
elif event['RequestType'] == "Delete":
for route in routes:
id = route['id']
collectionName = ('location.aws.com.demo.geofences.' + route['geofenceCollection'])
try:
geofence_collection = client.delete_geofence_collection(
CollectionName=collectionName
)
except client.exceptions.ResourceNotFoundException:
pass # If the collection does not exist, continue
responseValue = 120
responseData = {'Data': responseValue}
cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData, 'AmazonLocationDemoGeofenceCreator')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested on other CR as well, but this could be moved above the Create/Update if as if event['RequestType'] in ["Delete", "Update"]: to avoid duplicating the delete logic. The cfnresponse.send() would need to be pulled out of the if blocks though to prevent the Update case from reporting success too early.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

@wadhawh wadhawh force-pushed the fix/geofence_lambda branch from 8ac1913 to 84aa79f Compare July 1, 2024 19:30
@mbalfour-amzn mbalfour-amzn merged commit 88bbafe into main Jul 2, 2024
3 checks passed
@wadhawh wadhawh deleted the fix/geofence_lambda branch July 8, 2024 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants