-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add post_read custom_code #12703
Add post_read custom_code #12703
Conversation
1 similar comment
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @c2thorn, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Tests analyticsTotal tests: 1208 Click here to see the affected service packages
🟢 All tests passed! View the build log |
Tests analyticsTotal tests: 1208 Click here to see the affected service packages
🟢 All tests passed! View the build log |
Tests analyticsTotal tests: 1208 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide an example template and use it with post_read
in some resource's YAML file so we can see that its working?
The template can just add dummy comments so it won't have any functional change to the resource
@@ -243,6 +243,9 @@ func resource{{ $.ResourceName }}ListForPatch(d *schema.ResourceData, meta inter | |||
return nil, err | |||
} | |||
|
|||
{{- if $.CustomCode.PostRead }} | |||
{{ $.CustomTemplate $.CustomCode.PostRead false -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the CustomTemplate function is from here: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource.go#L1510
the false
will toggle off the option for appending a new line - a feature we really only cared about for an older migration and should not be relevant either way for you
the -
tells the go template to delete any whitespace after the statement. Getting an example working with this should show how that ends up looking
Done and thanks for the review! I added a |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 1208 Click here to see the affected service packages
🟢 All tests passed! View the build log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly what I wanted to see. Generated output looks good, so looks like post_read
is good to go. Thanks @coder-221 !
This is to unblock a future PR for etags in
access_context_manager
resources. We'll need to access the etag in the GET response that's made from the nested_query code. For consistency, I also added thepost_read
to the normal resource read function as well, but that's not strictly required for our use case.I'm also not sure what the params
false -
are for in the template, so would appreciate a check to ensure those are correct. Thanks!Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.