Skip to content
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

[CFN-27] Working towards a more extensible DBInstance create flow.... #574

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

npxcomplete
Copy link

Incomplete, for early feedback from the other core maintainers. We (AWS RDS) have a number of upcoming features that stand to benefit from presenting an cleaner way to extend the create paths. The core team have discussed what this might look like and this is a first pass attempt to separate shape the code to that vision.

Description of changes: Static methods and error rules have been pulled out of the base handler class; The instance create factory is now constructed by factory according to the model.

I plan to follow up with a second revision but wanted to stop here as the decomposition of the BaseHandlerStd, while simple, has become somewhat large. The "FreshInstance" factory has copied a few methods that need to be reconciled.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Comment on lines 412 to 414
final Optional<DBCluster> maybeDbCluster = DBInstancePredicates.isDBClusterMember(model)
? Optional.of(fetchDBCluster(rdsProxyClient, model))
: Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not use optionals, it adds more cognitive load for the reader, can we instead use method overloads for when there is a dbcluster vs when there isn't?

From Brian Goetz himself: https://stackoverflow.com/questions/26327957/should-java-8-getters-return-optional-type/26328555#26328555

And: http://dolszewski.com/java/java-8-optional-use-cases/

Copy link
Author

Choose a reason for hiding this comment

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

We can not-use Optionals here. But let's avoid taking the java authors word as gospel. What they intended Optionals for says nothing about what they are good for. What they are good for is avoiding null. The cognitive load of an optional is really just the cognitive load of a nullable reference, but it's in your face so you/we are more likely to handle it correctly.

@zrfr
Copy link
Collaborator

zrfr commented Nov 24, 2024

What is CFN-27?

Keynan Pratt added 2 commits November 25, 2024 05:59
…atic methods and error rules have been pulled out of the base handler class; The instance create factory is now constructed by factory according to the model.

[CFN-27] Continuing to seperate db-instance create flows. This pulls out the create from snapshot logic at the cost of some more copy pasta to be addressed in the next commit.
[CFN-27] The 'safeAddTags' method is still c/p but the core change in pattern has finished resulting in a trim create step in the create handler (line 103).

...
@npxcomplete npxcomplete force-pushed the polymorphic-create-flow branch from 77e00a3 to 9727a77 Compare November 25, 2024 06:32
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