add ec2 network-acl egress filter (#5174)

This commit is contained in:
Thomas Rausch 2022-05-29 18:39:19 +02:00 committed by GitHub
parent e372287147
commit 68b93c3b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -238,6 +238,8 @@ class NetworkAcl(TaggedEC2Resource):
return [entry.rule_number for entry in self.network_acl_entries] return [entry.rule_number for entry in self.network_acl_entries]
elif filter_name == "entry.rule-action": elif filter_name == "entry.rule-action":
return [entry.rule_action for entry in self.network_acl_entries] return [entry.rule_action for entry in self.network_acl_entries]
elif filter_name == "entry.egress":
return [entry.egress for entry in self.network_acl_entries]
elif filter_name == "owner-id": elif filter_name == "owner-id":
return self.owner_id return self.owner_id
else: else:

View File

@ -385,6 +385,21 @@ def test_describe_network_acls():
) )
resp4["NetworkAcls"].should.have.length_of(0) resp4["NetworkAcls"].should.have.length_of(0)
# Ensure filtering by egress flag
resp4 = conn.describe_network_acls(
Filters=[{"Name": "entry.egress", "Values": ["false"]}]
)
[entry["NetworkAclId"] for entry in resp4["NetworkAcls"]].should.contain(
network_acl_id
)
# the ACL with network_acl_id contains no entries with Egress=True
resp4 = conn.describe_network_acls(
Filters=[{"Name": "entry.egress", "Values": ["true"]}]
)
[entry["NetworkAclId"] for entry in resp4["NetworkAcls"]].shouldnt.contain(
network_acl_id
)
# Ensure filtering by rule action # Ensure filtering by rule action
resp4 = conn.describe_network_acls( resp4 = conn.describe_network_acls(
Filters=[ Filters=[