Skip to content

Set Default Values to Construct Properties using PropertyInjector #693

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

Open
4 of 11 tasks
pcheungamz opened this issue Jan 28, 2025 · 0 comments
Open
4 of 11 tasks
Labels
status/proposed Newly proposed RFC

Comments

@pcheungamz
Copy link
Contributor

pcheungamz commented Jan 28, 2025

Description

We would like to propose a framework for organizations to set default values to Construct Properties such as BucketProps.

Key Components:

  • IPropertyInjector - has constructFqn and and inject function that takes in the original BucketProps and returns a BucketProps.
  • PropertyInjectors - A collection of IPropertyInjectors. There is only one IPropertyInjector for a Construct. We can attach PropertyInjectors to any Construct, but the typical use case is to set PropertyInjectors on App, Stage, or Stack.
  • applyInjectors - Constructs such as Bucket will call applyInjectors in their constructors to get the new BucketProps. It calls findInjectorsFromConstruct to find the correct injector to apply to the properties.
  • findInjectorsFromConstruct - This starts from the Construct's parent Node and walk up the Tree to find an IPropertyInjector applicable to this Construct.
  • Constructs that support Property Injection will need a FQN and call applyInjectors.

With this PropertyInjector Framework, organizations can set default properties for builders that meet their security bars.

Roles

Role User
Proposed by @pcheungamz
Author(s) @pcheungamz
API Bar Raiser @rix0rrr
Stakeholders @pcheungamz, @manan-pancholi

See RFC Process for details

Workflow

  • Tracking issue created (label: status/proposed)
  • API bar raiser assigned (ping us at #aws-cdk-rfcs if needed)
  • Kick off meeting
  • RFC pull request submitted (label: status/review)
  • Community reach out (via Slack and/or Twitter)
  • API signed-off (label status/api-approved applied to pull request)
  • Final comments period (label: status/final-comments-period)
  • Approved and merged (label: status/approved)
  • Execution plan submitted (label: status/planning)
  • Plan approved and merged (label: status/implementing)
  • Implementation complete (label: status/done)

Author is responsible to progress the RFC according to this checklist, and
apply the relevant labels to this issue so that the RFC table in README gets
updated.

@pcheungamz pcheungamz added the status/proposed Newly proposed RFC label Jan 28, 2025
rix0rrr pushed a commit that referenced this issue Mar 24, 2025
This is a request for comments about Set Default Values to Construct
Properties using PropertyInjector. See #693 for
additional details. 

APIs are signed off by @{rix0rrr}.

---

_By submitting this pull request, I confirm that my contribution is made
under
the terms of the Apache-2.0 license_

---------

Co-authored-by: Mohamed Elasmar <71043312+moelasmar@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/proposed Newly proposed RFC
Projects
None yet
Development

No branches or pull requests

1 participant