You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
eqx/eqx-market-convert-spot-pro...

38 lines
667 B

#!/bin/bash
# eqx-market-convert-spot-project
# Convert all the devices in a project from spot to on demand pricing.
#
# Usage:
# eqx-market-convert-spot-project [project name]
# Example:
# eqx-market-convert-spot-project fooproject
EQXPROJECT="$1"
if [[ $1 == "" ]]
then \
echo -e "Need project name, such as:\n"
eqx-get-project-names
echo
exit
fi
EQXPROJECTID=`eqx-get-project-uuid $EQXPROJECT`
EQXDEVICEIDS=`packet \
device \
get \
--json \
--project-id \
$EQXPROJECTID \
2>/dev/null \
| jq '.[].id' | \
sed -e 's/"//g'`
for i in $EQXDEVICEIDS
do \
echo "Converting $i ..."
eqx-market-convert-spot $i
done