Update Datadog::Dashboards::Dashboard UPDATE handler to check/convert types of sub-models #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #127, allowing updates of
Datadog::Dashboards::Dashboard
resources created via CFT.Description of the Change
Sets the
validate_and_convert_types
_check_type
arg toTrue
inupdate_handler
, allowing sub-models of the input value (DashboardDefinition
JSON payload) to be deserialized into applicable DataDog API Client models.Both
create_handler
andupdate_handler
have comments indicating that this is meant to beTrue
, and it is indeedTrue
in thecreate_handler
, but it appears to have been set toFalse
for theupdate_handler
. As a result, initial creation of dashboard resources succeeds, but dashboards cannot be updated after creation.When the API client object attempts to serialize the models before sending to the DataDog REST API, it appears to assume all objects will be
OpenApiModel
subclasses. When_check_type=False
, nested JSON objects are not deserialized to their applicableOpenApiModel
subclasses, but instead retain their nativedict
deserialization types. This leads to the followingAttributeError
:AttributeError
Stack TraceVerification Process
Change was verified by using aws-sam-cli to invoke the resource provider locally:
sam local invoke TestEntrypoint --event update-event.json
update-event.json
Note that the
DatadogCredentials.ApiKey
,DatadogCredentials.ApplicationKey
, andId
fields (withinrequest.desiredResourceState
) must be set appropriately.Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.