Browse Source

termination and price scripts

master
Jeff Moe 10 months ago
parent
commit
271ef13dd7
  1. 3
      TODO
  2. 28
      eqx-get-deviceid-termination
  3. 0
      eqx-get-project-termination
  4. 25
      eqx-market-spot-price-deviceid

3
TODO

@ -21,3 +21,6 @@ set up second ethernet interface
SSH keys per project, auto-generate
# "backend_transfer_enabled": false

28
eqx-get-deviceid-termination

@ -0,0 +1,28 @@
#!/bin/bash
# eqx-get-deviceid-termination
#
# Give a device ID, get termination time
EQXTOKEN=`cat ~/.packet-cli.json | jq ".token" --raw-output`
EQXDEVICEID="$1"
echo "XXX not tested on server with actual termination time!!!"
if [[ $1 == "" ]]
then \
echo -e "Need device ID"
echo -e "To get device IDs in a project, run:"
echo -e "eqx-get-project-devices [project name]"
echo
exit
fi
curl \
--silent \
-X GET \
--header 'Accept: application/json' \
--header "X-Auth-Token: ${EQXTOKEN}" \
"https://api.equinix.com/metal/v1/devices/$EQXDEVICEID" | \
jq '.[]' | \
grep -i termination

0
eqx-get-project-termination

25
eqx-market-spot-price-deviceid

@ -0,0 +1,25 @@
#!/bin/bash
# eqx-get-deviceid-spot-price
#
# Give a device ID, get max spot price
EQXDEVICEID="$1"
if [[ $1 == "" ]]
then \
echo -e "Need device ID"
echo -e "To get device IDs in a project, run:"
echo -e "eqx-get-project-devices [project name]"
echo
exit
fi
packet \
device get \
--json \
--id $EQXDEVICEID \
2>/dev/null | \
jq '.spot_price_max' | \
sed -e 's/"//g'
Loading…
Cancel
Save