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.

57 lines
1.8 KiB

#!/bin/bash
# eqx-create-project
# Create an Equinix Project.
# If no name is given, a random string is chosen
#
# Usage:
# eqx-create-project [name]
# Example:
# eqx-create-project
# eqx-create-project fooproject
EQXRAND=`dd bs=12 count=1 if=/dev/random 2>/dev/null | base64 | tr [:upper:] [:lower:] | tr -dc [:alpha:]`
EQXPROJECT="$1"
if [[ $1 == "" ]]
then EQXPROJECT=$EQXRAND
fi
packet \
project \
create \
--name \
$EQXPROJECT \
2>/dev/null | \
grep -v -e "^+" -e "CREATED" | \
cut -f 4 -d " "
exit
2021/01/23 14:45:25 [DEBUG] POST https://api.equinix.com/metal/v1/projects
+--------------------------------------+--------------+----------------------+
| ID | NAME | CREATED |
+--------------------------------------+--------------+----------------------+
| 7ac35d0b-17be-4e76-a15a-cc68a3f3d81b | udmlbdyxsouf | 2021-01-23T21:45:26Z |
+--------------------------------------+--------------+----------------------+
packet project create --name [project_name]
Usage:
packet project create [flags]
Flags:
-h, --help help for create
-n, --name string Name of the project
-o, --organization-id string UUID of the organization
-m, --payment-method-id string UUID of the payment method
Global Flags:
--config string Path to JSON or YAML configuration file
--exclude strings Comma seperated Href references to collapse in results, may be dotted three levels deep
--include strings Comma seperated Href references to expand in results, may be dotted three levels deep
-j, --json JSON output
--search string Search keyword for use in 'get' actions. Search is not supported by all resources.
-y, --yaml YAML output