Scripts to use Equinix Bare Metal API
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.

37 lines
667 B

#!/bin/bash
# eqx-market-spot-convert-project
# Convert all the devices in a project from spot to on demand pricing.
#
# Usage:
# eqx-market-spot-convert-project [project name]
# Example:
# eqx-market-spot-convert-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-spot-convert $i
done