-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_table.sh
executable file
·25 lines (19 loc) · 1.39 KB
/
generate_table.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Fetch available AWS regions
regions=$(aws ec2 describe-regions --query "Regions[].RegionName" --output text | tr '\t' '\n')
# Initialize the table with headers
echo "| Stack | Config | Forwarder |"
echo "|------------|--------|-----------|"
# Generate rows for each region
for region in $regions; do
# Normalize region name for badge (replace '-' with '_')
normalized_region=$(echo $region | tr '-' '_')
# Create shield badge markdown
badge_md="![Static Badge](https://img.shields.io/badge/$normalized_region-latest-blue?logo=amazonaws)"
# Create CloudFormation console links
stack_link="https://$region.console.aws.amazon.com/cloudformation/home?region=$region#/stacks/create/review?templateURL=https://observeinc-$region.s3.amazonaws.com/aws-sam-apps/latest/stack.yaml"
config_link="https://$region.console.aws.amazon.com/cloudformation/home?region=$region#/stacks/create/review?templateURL=https://observeinc-$region.s3.amazonaws.com/aws-sam-apps/latest/config.yaml"
forwarder_link="https://$region.console.aws.amazon.com/cloudformation/home?region=$region#/stacks/create/review?templateURL=https://observeinc-$region.s3.amazonaws.com/aws-sam-apps/latest/forwarder.yaml"
# Generate table row with shield badges linking to CloudFormation console
echo "| [$badge_md]($stack_link) | [$badge_md]($config_link) | [$badge_md]($forwarder_link) |"
done