From fea145cf372129a511cb4a7b7dd912e9fbf00c82 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Jan 2019 17:25:08 +0100 Subject: [PATCH] Begin to hack on vm-create --- vm-create | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 vm-create diff --git a/vm-create b/vm-create new file mode 100644 index 0000000..8baced4 --- /dev/null +++ b/vm-create @@ -0,0 +1,44 @@ +#!/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://