-
Notifications
You must be signed in to change notification settings - Fork 67
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
pass valid props to root stack #1675
Open
renevatium
wants to merge
10
commits into
aws-amplify:main
Choose a base branch
from
renevatium:root-stack-props
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+98
−13
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e3dfa31
pass valid props to root stack
renevatium 93b77dc
mainStackProps as key in DefineBackendProps
renevatium e931b42
pick only MainStackProps relevant to region handling
renevatium 1f79750
fix missing update:api for #e931b42
renevatium 28a8743
mainStackProps in DefineBackendProps should be optional
renevatium 93e0222
better import path for MainStackProps
renevatium 3b24347
BackendFactory constructor overloading for conditional prop exclusion
renevatium 279f393
revert DefineBackendConstructFactories back to DefineBackendProps and…
renevatium 5fb4e03
revert and update backend API doc
renevatium 898a4cc
Merge branch 'main' of https://github.com/aws-amplify/amplify-backend…
renevatium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@aws-amplify/backend': minor | ||
--- | ||
|
||
Allow StackProps to be passed from defineBackend down to AmplifyStack for root Stack configuration |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
import { App, Stack } from 'aws-cdk-lib'; | ||
import { ProjectEnvironmentMainStackCreator } from './project_environment_main_stack_creator.js'; | ||
import { getBackendIdentifier } from './backend_identifier.js'; | ||
import { MainStackProps } from './engine/amplify_stack.js'; | ||
|
||
/** | ||
* Creates a default CDK scope for the Amplify backend to use if no scope is provided to the constructor | ||
*/ | ||
export const createDefaultStack = (app = new App()): Stack => { | ||
export const createDefaultStack = ( | ||
app?: App, | ||
props?: MainStackProps | ||
): Stack => { | ||
if (app === undefined) { | ||
app = new App(); | ||
} | ||
const mainStackCreator = new ProjectEnvironmentMainStackCreator( | ||
app, | ||
getBackendIdentifier(app) | ||
); | ||
return mainStackCreator.getOrCreateMainStack(); | ||
return mainStackCreator.getOrCreateMainStack(props); | ||
}; |
This file contains 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
This file contains 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
This file contains 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
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.
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.
does a type of
never
here not work?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.
never
would prevent passing anything in props, but onlymainStackProps
conflicts with a passed Stack. While there are currently no other props in theDefineBackendOptions
type, @sobolk requested this implementation for the further expansion of the API and backend options could potentially be used for anything in the process tree, not only for the root Stack config. Semantically it also makes sense to allowDefineBackendOptions
to be passed todefineBackend
even if a Stack is passed, as long as those options aren't specific to the root Stack definition.FYI I did try with built-in Omit, but it's not explicit so doesn't prevent passing
mainStackProps
. Hence theExplicitOmit
implementation.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.
We should maybe change the
props
key tooptions
though, for consistency sake. Thoughts?