agent: |
c3b7fsINWxdArRvSkBFWTabulate non-compliant security groups based on their regions and compliance
Tabulate non-compliant security groups based on their regions and compliance
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
This script tabulates non-compliant security groups by region, listing their details.
inputs
outputs
table = context.newtable()
# Calculate the number of non-compliant groups
num_non_compliant = sum(len(region_data['NonCompliantGroups']) for region_data in security_group_summary.values())
# Set table properties
if num_non_compliant > 0:
table.num_rows = num_non_compliant + 1 # +1 for header
table.num_cols = 5
table.title = "Non-Compliant Security Groups by Region"
table.has_header_row = True
# Set header
table.setval(0, 0, "Region")
table.setval(0, 1, "GroupId")
table.setval(0, 2, "GroupName")
table.setval(0, 3, "Port")
table.setval(0, 4, "CIDR")
# Fill table with non-compliant security groups
row = 1
for region, region_data in security_group_summary.items():
for group in region_data['NonCompliantGroups']:
table.setval(row, 0, region)
table.setval(row, 1, group['GroupId'])
table.setval(row, 2, group['GroupName'])
table.setval(row, 3, str(group['Port']))
table.setval(row, 4, group.get('CidrIp', group.get('CidrIpv6', '')))
row += 1
print("Non-compliant security groups table created successfully.")
copied