ungleich-tools/vm-create

45 lines
1.4 KiB
Plaintext
Raw Normal View History

2019-01-18 16:25:08 +00:00
#!/bin/random
# This is a sample script / prototype to create VMs in Data Center
# Light
#
# Flow to register payment:
#
# - Connect to account.ungleich.ch with (username, password) for getting (name, realm, seed)
# - Connect to pay.ungleich.ch with (name, realm, token) { JSON }
# Json similar to:
#
# { type: "credit-card" cc number, name, verify, ... }
#
#
# Flow to add an ssh key:
# - Connect to account.ungleich.ch with (username, password) for getting (name, realm, seed)
# - Connect to infra.ungleich.ch/api using (name, realm, token) POST { json }
# { key: ... }
# Standard rest, registering it internally to a user
#
# Flow to create a VM:
#
# - Connect to account.ungleich.ch with (username, password) for getting (name, realm, seed)
# - Connect to infra.ungleich.ch/api using (name, realm, token) POST { json }
# - infra.ungleich.ch then connects to otp.ungleich.ch verifying the (name, realm, token)
# - infra.ungleich.ch checks that user has >= 1 ssh keys registered, otherwise gives error message
# - infra.ungleich.ch then connects to pay.ungleich.ch verifying that the user can "afford" the VM / books it
# infra passes (user, product, productvariant)
# --> infra needs to be able to derive a product from the parameters!
# --> if user is not able to afford, return error to the user
# -
#
#
#
#
if [ $# -ne 2 ]; then
echo "$0: username password template ssdsizegb ramgb cpunum hddsizegb onlyipv6"
exit 1
fi
curl https://