Add support for Network ACL tagging

This commit is contained in:
Tyler Sanders 2014-11-20 12:02:38 -06:00
parent 8d6868f9d3
commit d511fd829b
2 changed files with 37 additions and 2 deletions

View File

@ -75,7 +75,16 @@ CREATE_NETWORK_ACL_RESPONSE = """
<default>false</default>
<entrySet/>
<associationSet/>
<tagSet/>
<tagSet>
{% for tag in network_acl.get_tags() %}
<item>
<resourceId>{{ tag.resource_id }}</resourceId>
<resourceType>{{ tag.resource_type }}</resourceType>
<key>{{ tag.key }}</key>
<value>{{ tag.value }}</value>
</item>
{% endfor %}
</tagSet>
</networkAcl>
</CreateNetworkAclResponse>
"""
@ -115,7 +124,16 @@ DESCRIBE_NETWORK_ACL_RESPONSE = """
</item>
{% endfor %}
</associationSet>
<tagSet/>
<tagSet>
{% for tag in network_acl.get_tags() %}
<item>
<resourceId>{{ tag.resource_id }}</resourceId>
<resourceType>{{ tag.resource_type }}</resourceType>
<key>{{ tag.key }}</key>
<value>{{ tag.value }}</value>
</item>
{% endfor %}
</tagSet>
</item>
{% endfor %}
</networkAclSet>

View File

@ -107,5 +107,22 @@ def test_delete_network_acl():
any(acl.id == network_acl.id for acl in updated_network_acls).shouldnt.be.ok
@mock_ec2
def test_network_acl_tagging():
conn = boto.connect_vpc('the_key', 'the secret')
vpc = conn.create_vpc("10.0.0.0/16")
network_acl = conn.create_network_acl(vpc.id)
network_acl.add_tag("a key", "some value")
tag = conn.get_all_tags()[0]
tag.name.should.equal("a key")
tag.value.should.equal("some value")
all_network_acls = conn.get_all_network_acls()
test_network_acl = next(na for na in all_network_acls
if na.id == network_acl.id)
test_network_acl.tags.should.have.length_of(1)
test_network_acl.tags["a key"].should.equal("some value")