Created
April 14, 2017 21:30
-
-
Save JohnTheodore/5aa69bb6d8c1b0b83943284e0cdd2d60 to your computer and use it in GitHub Desktop.
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
{% set custodian_tables = { 'ebs': { 'headers': { 'VolumeId': '', 'CreateTime': { 'display_name': 'CreationTime' }, 'State': '', 'Tags': '' } } } %} | |
{% macro get_header_name(header, resource, custodian_tables) -%} | |
{% if 'display_name' in custodian_tables[resource]['headers'][header] %} | |
{{ custodian_tables[resource]['headers'][header]['display_name'] }} | |
{% endif %} | |
{{ header }} | |
{%- endmacro %} | |
{% macro create_table_header(table_headers, resource, custodian_tables) -%} | |
{% for table_header in table_headers %} | |
<th style="border:2px solid grey; text-align: center; padding: 5px;">{{ get_header_name(table_header, resource, custodian_tables) }}</th> | |
{% endfor %} | |
{%- endmacro %} | |
{% macro create_table_rows(resources, table_headers) -%} | |
{% for resource in resources %} | |
<tr style="border:none; border-collapse:collapse"> | |
{% for columnName in table_headers %} | |
<td style="border:2px solid grey; padding:4px">{{ resource[columnName] }}</td> | |
{% endfor %} | |
</tr> | |
{% endfor %} | |
{%- endmacro %} | |
{% set table_headers = custodian_tables[policy['resource']]['headers'].keys() %} | |
{{ create_table_header(table_headers, resource, custodian_tables) }} | |
{{ create_table_rows(resources, table_headers) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment