-
Notifications
You must be signed in to change notification settings - Fork 22
feat(bootstrap): resource-action-map for synth-time validation #165
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
scottschreckengaust
wants to merge
7
commits into
main
Choose a base branch
from
feat/bootstrap-action-map
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.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
eb48cc7
chore(bootstrap): scaffold preflight directory for resource-action-ma…
scottschreckengaust cb787b7
refactor(compute): gate ECS construct on compute_type context
scottschreckengaust a4a7335
feat(bootstrap): add getRequiredBootstrapPolicies for compute-type-aw…
scottschreckengaust e47c49c
feat(bootstrap): add resource-action-map for 57 CF resource types
scottschreckengaust ab01560
test(bootstrap): add dual-config synth-coverage test (agentcore + ecs)
scottschreckengaust 3128560
fix(bootstrap): compute-agentcore is a variant choice, not a core policy
scottschreckengaust eb880b5
Merge branch 'main' into feat/bootstrap-action-map
scottschreckengaust 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 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * MIT No Attribution | ||
| * | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| * the Software without restriction, including without limitation the rights to | ||
| * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| * the Software, and to permit persons to whom the Software is furnished to do so. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| export { | ||
| RESOURCE_ACTION_MAP, | ||
| getActionsForResource, | ||
| getAllMappedActions, | ||
| } from './resource-action-map'; | ||
| export type { ResourceActions } from './resource-action-map'; |
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /** | ||
| * MIT No Attribution | ||
| * | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| * the Software without restriction, including without limitation the rights to | ||
| * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| * the Software, and to permit persons to whom the Software is furnished to do so. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| const CORE_POLICIES = [ | ||
| 'infrastructure', | ||
| 'application', | ||
| 'observability', | ||
| ] as const; | ||
|
|
||
| const COMPUTE_VARIANT_POLICIES: Record<string, string[]> = { | ||
| agentcore: ['compute-agentcore'], | ||
| ecs: ['compute-ecs'], | ||
| }; | ||
|
|
||
| export function getRequiredBootstrapPolicies(computeType: string): string[] { | ||
| const base: string[] = [...CORE_POLICIES]; | ||
| const variants = COMPUTE_VARIANT_POLICIES[computeType]; | ||
| if (variants) base.push(...variants); | ||
| return base; | ||
| } | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /** | ||
| * MIT No Attribution | ||
| * | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| * the Software without restriction, including without limitation the rights to | ||
| * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| * the Software, and to permit persons to whom the Software is furnished to do so. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| import { getRequiredBootstrapPolicies } from '../../src/bootstrap/required-policies'; | ||
|
|
||
| describe('getRequiredBootstrapPolicies', () => { | ||
| it('returns core policies plus compute-agentcore for agentcore type', () => { | ||
| const result = getRequiredBootstrapPolicies('agentcore'); | ||
| expect(result).toEqual(['infrastructure', 'application', 'observability', 'compute-agentcore']); | ||
| }); | ||
|
|
||
| it('returns core policies plus compute-ecs for ecs type', () => { | ||
| const result = getRequiredBootstrapPolicies('ecs'); | ||
| expect(result).toEqual(['infrastructure', 'application', 'observability', 'compute-ecs']); | ||
| expect(result).not.toContain('compute-agentcore'); | ||
| }); | ||
|
|
||
| it('compute variants are independent choices', () => { | ||
| const agentcore = getRequiredBootstrapPolicies('agentcore'); | ||
| const ecs = getRequiredBootstrapPolicies('ecs'); | ||
| expect(agentcore).toContain('compute-agentcore'); | ||
| expect(agentcore).not.toContain('compute-ecs'); | ||
| expect(ecs).toContain('compute-ecs'); | ||
| expect(ecs).not.toContain('compute-agentcore'); | ||
| }); | ||
|
|
||
| it('returns only core policies for unknown compute type', () => { | ||
| const result = getRequiredBootstrapPolicies('unknown'); | ||
| expect(result).toEqual(['infrastructure', 'application', 'observability']); | ||
| expect(result).not.toContain('compute-ecs'); | ||
| expect(result).not.toContain('compute-agentcore'); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.