summaryrefslogtreecommitdiff
path: root/functions/list_all_vps.sh
blob: 8ce99eb6319efa40f7429cda08ae7e12a797cbd1 (plain)
1
2
3
4
5
6
7
8
9
list_all_vps() {
  curl -s -H "Authorization: Bearer $LINODE_API_TOKEN" \
    https://api.linode.com/v4/linode/instances | \
    jq -r '
      .data[] | [.label, .id, .region, .type, .ipv4[0], .status] |
      @tsv' | column -t -s $'\t' | \
    awk 'BEGIN { print "LABEL       ID         REGION     TYPE             IP             STATUS" }
         { printf "%-11s %-10s %-10s %-16s %-15s %s\n", $1, $2, $3, $4, $5, $6 }'
}