8000 added apis for route53resovler by macnev2013 · Pull Request #6673 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

added apis for route53resovler #6673

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
merged 12 commits into from
Aug 21, 2022
Merged

added apis for route53resovler #6673

merged 12 commits into from
Aug 21, 2022

Conversation

macnev2013
Copy link
Contributor

API Added

  • createResolverQueryLogConfig
  • getResolverQueryLogConfig
  • deleteResolverQueryLogConfig
  • listResolverQueryLogConfigs
  • associateResolverQueryLogConfig
  • disassociateResolverQueryLogConfig
  • getResolverQueryLogConfigAssociation
  • listResolverQueryLogConfigAssociations
  • getFirewallConfig
  • listFirewallConfigs
  • updateFirewallConfig

@macnev2013 macnev2013 requested review from whummer and giograno August 15, 2022 17:38
Copy link
Member
@giograno giograno left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @macnev2013 Could you please rebase to master (it should drop the S3 failing tests)?

return resolver_query_log_config


def get_resolver_query_log_config_associations(id):
Copy link
Member

Choose a reason for hiding this comment

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

nit: I would just add some type hints to these utility functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments

Copy link
Member
@whummer whummer left a comment

Choose a reason for hiding this comment

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

Great set of changes @macnev2013 ! 🚀 Only a minor comment related to attaching the util functions to the backend - would be great if we could add this before merging (this will make some future refactorings easier for us to handle 👍 ).

@@ -106,3 +114,72 @@ def delete_firewall_rule(firewall_rule_group_id, firewall_domain_list_id):
firewall_rule = get_firewall_rule(firewall_rule_group_id, firewall_domain_list_id)
region_details.firewall_rules.get(firewall_rule_group_id, {}).pop(firewall_domain_list_id)
return firewall_rule


def get_resolver_query_log_config(id):
Copy link
Member
@whummer whummer Aug 18, 2022

Choose a reason for hiding this comment

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

It would be preferable to attach these util functions to the backend directly, i.e.:

class Route53ResolverBackend(RegionBackend):
    ...
    def get_resolver_query_log_config(self, id):
        ...

This will help us to unify the access to the backends, and avoid having too many calls to Route53ResolverBackend.get() spread over the codebase.. (i.e., you would then access self.resolver_query_log_configs instead of region_details.resolver_query_log_configs, etc.)

Can we make this change for the new util functions below, as well as the existing ones above?

Copy link
Member

Choose a reason for hiding this comment

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

Chiming in here. I think this was due to a previous suggestion of mine since I wanted to keep the backends as lean as possible to avoid picking issues. But as discussed with @whummer, this should not be a big issue.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, ok good point @giograno . Either way is fine - we can also fix that up in a follow-up iteration, if and when we make the switch to unify the backend access protocol.. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, It would be a clean approach to keep the backend related operation in the same class. I've updated it.

return resolver_query_log_config


def delete_resolver_query_log_config(id):
Copy link
Member
@whummer whummer Aug 18, 2022

Choose a reason for hiding this comment

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

nit: Inside this method we could call get_resolver_query_log_config(id) to assert the existence of the query log config with the given id - the ResourceNotFoundException will be raised from there directly. This would help us reduce the duplicate checks and exceptions a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Updated.

@macnev2013
Copy link
Contributor Author

Hey @whummer @giograno, I've updated the requested changes.

if not firewall_rule_group:
raise ResourceNotFoundException(
f"Can't find the resource with ID '{id}'. Trace Id: '{aws_stack.get_trace_id()}'"
self.resolver_query_log_configs = {}
Copy link
Member

Choose a reason for hiding this comment

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

nit: One more small comment - would be great if we could add type hints (and a short description) for these member variables, similar to what we have for firewall_rule_groups in line 15 above.

We could also pick that up in one of the next PRs @macnev2013 .. 👍

Copy link
Member
@whummer whummer left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for updating the PR! 👍

@whummer whummer merged commit 9f53fee into localstack:master Aug 21, 2022
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
0