Skip to content

Commit

Permalink
Tidy up hastily created function
Browse files Browse the repository at this point in the history
  • Loading branch information
mbailey committed Oct 2, 2024
1 parent 9186bc6 commit ce1388e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/vpc-functions
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,19 @@ vpc-default-delete() {
fi
}


subnet-ips() {
# List IP addresses for a subnet along with the resources they are allocated to
#
# USAGE: subnet-ips subnet-id [subnet-id...]
#
# EXAMPLE:
# $ subnet-ips subnet-12345678
# 10.0.1.10 i-abcdef1234567890 EC2 Instance
# 10.0.1.10 i-abcdef1234567890 EC2 Instance
# 10.0.1.20 eni-1234567890abcdef Network Interface
# 10.0.1.30 rds:my-database RDS Instance
# 10.0.1.30 rds:my-database RDS Instance
#
# XXX Tidy up to follow function formatting conventions.

local subnet_ids=$(skim-stdin "$@")
[[ -z "$subnet_ids" ]] && __bma_usage "subnet-id [subnet-id...]" && return 1
Expand All @@ -432,6 +435,5 @@ subnet-ips() {
--query "DBInstances[?DBSubnetGroup.Subnets[?SubnetIdentifier=='$subnet_id']].[Endpoint.Address,DBInstanceIdentifier,'RDS Instance']" \
--output text

# Add more resource types here as needed
done | sort -V | columnise
}

0 comments on commit ce1388e

Please sign in to comment.