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

feat(networkfirewall): change network_firewalls from list to dict #5169

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

HugoPBrito
Copy link
Member

@HugoPBrito HugoPBrito commented Sep 24, 2024

Context

network_firewalls variable is a list, but this does not align with other services structure and scalability.

Description

network_firewalls has been changed from list to dict. This change will improve performance when accessing this variable and make the code more readable and maintainable. The new structure maintains backward compatibility and include necessary adjustments to any methods or functions interacting with the firewall list.

Checklist

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@HugoPBrito HugoPBrito requested review from a team as code owners September 24, 2024 10:16
@github-actions github-actions bot added the provider/aws Issues/PRs related with the AWS provider label Sep 24, 2024
Copy link
Member

@pedrooot pedrooot left a comment

Choose a reason for hiding this comment

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

Remember to change how we use network_firewalls inside networkfirewall_deletion_protection and networkfirewall_in_all_vpc and all the related tests :)

pedrooot
pedrooot previously approved these changes Sep 24, 2024
Copy link
Member

@pedrooot pedrooot 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 this! 💪🏼

@@ -27,13 +27,14 @@ def _list_firewalls(self, regional_client):
network_firewall["FirewallArn"], self.audit_resources
)
):
self.network_firewalls.append(
self.network_firewalls[network_firewall.get("FirewallArn")] = (
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.network_firewalls[network_firewall.get("FirewallArn")] = (
self.network_firewalls[network_firewall.get("FirewallArn", "")] = (

@@ -27,13 +27,14 @@ def _list_firewalls(self, regional_client):
network_firewall["FirewallArn"], self.audit_resources
)
):
self.network_firewalls.append(
self.network_firewalls[network_firewall.get("FirewallArn")] = (
Firewall(
arn=network_firewall.get("FirewallArn"),
Copy link
Member

Choose a reason for hiding this comment

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

Please could you remove the ARN from the model since that information is already in the key

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.24%. Comparing base (7c7132f) to head (5ca0d3e).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...ervices/networkfirewall/networkfirewall_service.py 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5169      +/-   ##
==========================================
+ Coverage   89.12%   89.24%   +0.11%     
==========================================
  Files         976      976              
  Lines       29909    29951      +42     
==========================================
+ Hits        26657    26730      +73     
+ Misses       3252     3221      -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MrCloudSec MrCloudSec dismissed puchy22’s stale review September 24, 2024 16:42

Changes requested were done.

@MrCloudSec MrCloudSec merged commit 980b9b4 into master Sep 24, 2024
10 of 11 checks passed
@MrCloudSec MrCloudSec deleted the PRWLR-4915-change-firewalls-from-list-to-dict branch September 24, 2024 16:43
HugoPBrito added a commit that referenced this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/aws Issues/PRs related with the AWS provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants