Skip to content

Updated initial hook boilerplate code to target a real resource type #188

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/rpdk/python/templates/hook_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ def pre_update_handler(

# Example:
try:
# A Hook that does not allow a resource's encryption algorithm to be modified
# A Hook that does not allow a S3 bucket's encryption to be modified

# Reading the Resource Hook's target current properties and previous properties
resource_properties = target_model.get("resourceProperties")
previous_properties = target_model.get("previousResourceProperties")

if resource_properties.get("encryptionAlgorithm") != previous_properties.get("encryptionAlgorithm"):
if resource_properties.get("BucketEncryption") != previous_properties.get("BucketEncryption"):
progress.status = OperationStatus.FAILED
progress.message = "Encryption algorithm can not be changed"
progress.message = "Encryption configuration can not be changed"
else:
progress.status = OperationStatus.SUCCESS
except TypeError as e:
Expand Down