docs(events): add examples for RuleTargetInput and EventField - #38470
Open
krantboy wants to merge 2 commits into
Open
docs(events): add examples for RuleTargetInput and EventField#38470krantboy wants to merge 2 commits into
krantboy wants to merge 2 commits into
Conversation
`input.ts` carried no examples, so the generated API reference listed the factory methods with no indication of what to pass or what they produce. Add an example to each factory method, document the three CloudFormation shapes `RuleTargetInput` abstracts over, and add a section to the aws-events README so the capability is discoverable from the module docs. Closes aws#11210
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue # (if applicable)
Closes #11210.
Reason for this change
RuleTargetInputalready supports everything the issue asks for, but it wasundocumented.
input.tscarried no examples at all, so the generatedRuleTargetInputAPI pagelisted four factory methods with no indication of what to pass or what they produce.
The README did show
RuleTargetInputin use, but only inside a CodeCommit walkthroughand without a section of its own, so it read as a detail of that example rather than a
general capability, and it did not say which CloudFormation property each factory
method produces.
Description of changes
Documented on
RuleTargetInputthe three CloudFormation shapes it abstracts over(
Input,InputPath,InputTransformer) and when each is synthesized, and added an@exampletofromText(),fromMultilineText(),fromObject()andfromEventPath(). ThefromObject()example shows the method both with and withoutEventField, since that is what decides between a literalInputand anInputTransformer. Also documented onEventFieldhow referenced paths becomeInputPathsMapentries with<key>placeholders in theInputTemplate.Added a short README section so the capability is discoverable from the module docs.
It notes that the prop accepting a
RuleTargetInputis named per target (eventonLambdaFunction,messageonSnsTopic) and that some targets such asEcsTaskshape their input differently.
Describe any new or updated permissions being added
None.
Description of how you validated changes
Documentation only, no runtime behavior affected.
aws-cdk-libbuilds andrun-rosetta.shpasses, so the new examples compile and translate to all targetlanguages. The synthesized values shown in the examples match the expectations in
aws-events/test/input.test.ts.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license