Skip to content

Call read handler on create/update and return empty model on delete - #129

Merged
ammokhov merged 1 commit into
aws-cloudformation:masterfrom
nmuesch:nick/call_read_handler
Oct 30, 2020
Merged

ammokhov merged 1 commit into
aws-cloudformation:masterfrom
nmuesch:nick/call_read_handler

Conversation

@nmuesch

@nmuesch nmuesch commented Oct 23, 2020 •

Copy link
Copy Markdown
Contributor

Description of changes:
Updates the handlers.py template file to be more in line with the contract definitions - https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-test-contract.html

  • This PR adds the call to read_handler at the end of create and update, instead of returning a success progress event.
    My understanding is that this is required for stabilization and also ensures the model contains any readOnly attributes
  • It also sets the model to None when returning a progress event in the delete handler.

When the delete handler returns SUCCESS, the ProgressEvent object MUST NOT contain a model.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ammokhov ammokhov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for the PR, this addresses quite a few contract requirements

@ammokhov

Copy link
Copy Markdown
Contributor

Description of changes:
Updates the handlers.py template file to be more in line with the contract definitions - https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-test-contract.html

* This PR adds the call to `read_handler` at the end of create and update, instead of returning a success progress event.
  My understanding is that this is required for stabilization and also ensures the model contains any readOnly attributes

* It also sets the model to None when returning a progress event in the delete handler.

When the delete handler returns SUCCESS, the ProgressEvent object MUST NOT contain a model.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

read handler delegate makes sense on the last invocation as the create/update handler output must be equal to read handler output, however throughout execution we should return progress as it contains information necessary to the callback

@ammokhov
ammokhov merged commit ac02839 into aws-cloudformation:master Oct 30, 2020
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