-
Notifications
You must be signed in to change notification settings - Fork 9
Add AWS Route 53 Resolver SDK-Compat Parity (72 Operations) #328
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
Merged
thzgajendra
merged 3 commits into
stackshy:development
from
thzgajendra:feat/aws-route53resolver-parity
Aug 6, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
6fbbac3
feat(aws): add Route 53 Resolver SDK-compat parity (72 operations)
thzgajendra b77d382
test(aws): add Route 53 Resolver provider unit tests and server error…
thzgajendra b9a4dcc
fix(aws): address Route 53 Resolver review — AWS-fidelity & robustness
thzgajendra 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
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
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,168 @@ | ||
| package route53resolver | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/stackshy/cloudemu/v2/internal/idgen" | ||
| "github.com/stackshy/cloudemu/v2/services/route53resolver/driver" | ||
| ) | ||
|
|
||
| const ( | ||
| autodefinedReverseEnabled = "ENABLED" | ||
| autodefinedReverseDisabled = "DISABLED" | ||
| autodefinedReverseLocal = "USE_LOCAL_RESOURCE_SETTING" | ||
|
|
||
| dnssecStatusEnabled = "ENABLED" | ||
| dnssecStatusDisabled = "DISABLED" | ||
| dnssecStatusLocal = "USE_LOCAL_RESOURCE_SETTING" | ||
|
|
||
| flagEnable = "ENABLE" | ||
| flagLocal = "USE_LOCAL_RESOURCE_SETTING" | ||
| ) | ||
|
|
||
| func cloneResolverConfig(c *driver.ResolverConfig) driver.ResolverConfig { return *c } | ||
|
|
||
| func cloneDnssecConfig(c *driver.ResolverDnssecConfig) driver.ResolverDnssecConfig { return *c } | ||
|
|
||
| // autodefinedReverseFor maps a request flag to a stored autodefined-reverse | ||
| // status. Autodefined reverse-DNS rules are enabled by default in AWS. | ||
| func autodefinedReverseFor(flag string) string { | ||
| switch flag { | ||
| case flagEnable: | ||
| return autodefinedReverseEnabled | ||
| case flagLocal: | ||
| return autodefinedReverseLocal | ||
| default: | ||
| return autodefinedReverseDisabled | ||
| } | ||
| } | ||
|
|
||
| // dnssecStatusFor maps a request validation value to a stored DNSSEC status. | ||
| // DNSSEC validation is disabled by default in AWS. | ||
| func dnssecStatusFor(validation string) string { | ||
| switch validation { | ||
| case flagEnable: | ||
| return dnssecStatusEnabled | ||
| case flagLocal: | ||
| return dnssecStatusLocal | ||
| default: | ||
| return dnssecStatusDisabled | ||
| } | ||
| } | ||
|
|
||
| // resolverConfigFor returns the stored config for a VPC, materializing a | ||
| // default (autodefined reverse enabled) one on first access. Caller holds m.mu. | ||
| func (m *Mock) resolverConfigFor(resourceID string) *driver.ResolverConfig { | ||
| if c, ok := m.rslvrConfigs.Get(resourceID); ok { | ||
| return c | ||
| } | ||
|
|
||
| c := &driver.ResolverConfig{ | ||
| ID: idgen.GenerateID("rslvr-rc-"), | ||
| OwnerID: m.opts.AccountID, | ||
| ResourceID: resourceID, | ||
| AutodefinedReverse: autodefinedReverseEnabled, | ||
| } | ||
| m.rslvrConfigs.Set(resourceID, c) | ||
|
|
||
| return c | ||
| } | ||
|
|
||
| // dnssecConfigFor returns the stored DNSSEC config for a VPC, materializing a | ||
| // default (validation disabled) one on first access. Caller holds m.mu. | ||
| func (m *Mock) dnssecConfigFor(resourceID string) *driver.ResolverDnssecConfig { | ||
| if c, ok := m.dnssecCfgs.Get(resourceID); ok { | ||
| return c | ||
| } | ||
|
|
||
| c := &driver.ResolverDnssecConfig{ | ||
| ID: idgen.GenerateID("rslvr-ds-"), | ||
| OwnerID: m.opts.AccountID, | ||
| ResourceID: resourceID, | ||
| ValidationStatus: dnssecStatusDisabled, | ||
| } | ||
| m.dnssecCfgs.Set(resourceID, c) | ||
|
|
||
| return c | ||
| } | ||
|
|
||
| func (m *Mock) GetResolverConfig(_ context.Context, resourceID string) (*driver.ResolverConfig, error) { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
|
|
||
| if c, ok := m.rslvrConfigs.Get(resourceID); ok { | ||
| out := cloneResolverConfig(c) | ||
|
|
||
| return &out, nil | ||
| } | ||
|
|
||
| // A pure read never persists: return the AWS default (autodefined reverse | ||
| // enabled) without materializing a record that would then pollute the List. | ||
| return &driver.ResolverConfig{ | ||
| OwnerID: m.opts.AccountID, | ||
| ResourceID: resourceID, | ||
| AutodefinedReverse: autodefinedReverseEnabled, | ||
| }, nil | ||
| } | ||
|
|
||
| func (m *Mock) UpdateResolverConfig( | ||
| _ context.Context, resourceID, autodefinedReverseFlag string, | ||
| ) (*driver.ResolverConfig, error) { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
|
|
||
| c := m.resolverConfigFor(resourceID) | ||
| c.AutodefinedReverse = autodefinedReverseFor(autodefinedReverseFlag) | ||
|
|
||
| out := cloneResolverConfig(c) | ||
|
|
||
| return &out, nil | ||
| } | ||
|
|
||
| func (m *Mock) ListResolverConfigs(_ context.Context) ([]driver.ResolverConfig, error) { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
|
|
||
| return sortedValues(m.rslvrConfigs.All(), cloneResolverConfig), nil | ||
| } | ||
|
|
||
| func (m *Mock) GetResolverDnssecConfig( | ||
| _ context.Context, resourceID string, | ||
| ) (*driver.ResolverDnssecConfig, error) { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
|
|
||
| if c, ok := m.dnssecCfgs.Get(resourceID); ok { | ||
| out := cloneDnssecConfig(c) | ||
|
|
||
| return &out, nil | ||
| } | ||
|
|
||
| // A pure read never persists: return the AWS default (validation disabled). | ||
| return &driver.ResolverDnssecConfig{ | ||
| OwnerID: m.opts.AccountID, | ||
| ResourceID: resourceID, | ||
| ValidationStatus: dnssecStatusDisabled, | ||
| }, nil | ||
| } | ||
|
|
||
| func (m *Mock) UpdateResolverDnssecConfig( | ||
| _ context.Context, resourceID, validation string, | ||
| ) (*driver.ResolverDnssecConfig, error) { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
|
|
||
| c := m.dnssecConfigFor(resourceID) | ||
| c.ValidationStatus = dnssecStatusFor(validation) | ||
|
|
||
| out := cloneDnssecConfig(c) | ||
|
|
||
| return &out, nil | ||
| } | ||
|
|
||
| func (m *Mock) ListResolverDnssecConfigs(_ context.Context) ([]driver.ResolverDnssecConfig, error) { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
|
|
||
| return sortedValues(m.dnssecCfgs.All(), cloneDnssecConfig), nil | ||
| } | ||
Oops, something went wrong.
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.
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.
resolverConfigFordoes no validation and keys by the raw string, soGetResolverConfig("")(or any bogus id) mints and persists a default config that then appears inListResolverConfigsforever. Same fordnssecConfigFor/firewallConfigFor. Validate the VpcId, or don't persist on a pure read.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.
Fixed.
GetResolverConfig/GetResolverDnssecConfig/GetFirewallConfignow return the AWS default without persisting; onlyUpdate*materializes a stored record. A pureGeton a bogus VpcId no longer pollutes the List. UpdatedTestResolverConfigLazyDefaultAndUpdateto assert this.