summary refs log tree commit diff stats
path: root/get_consumer_key.sh
diff options
context:
space:
mode:
authorAlan Pearce2024-11-27 10:50:55 +0100
committerAlan Pearce2024-11-27 10:51:04 +0100
commitc3e541f2e0cede1a815d6453ce87a3bf7f821d85 (patch)
tree65f0460697540bf212a7e3a9a465cbaf69ba1ccb /get_consumer_key.sh
parent14286fad3e82b2c18a85d5eb2d935a550bcd0c95 (diff)
downloaddns-c3e541f2e0cede1a815d6453ce87a3bf7f821d85.tar.lz
dns-c3e541f2e0cede1a815d6453ce87a3bf7f821d85.tar.zst
dns-c3e541f2e0cede1a815d6453ce87a3bf7f821d85.zip
Add script to provision OVH consumer key
Diffstat (limited to 'get_consumer_key.sh')
-rwxr-xr-xget_consumer_key.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/get_consumer_key.sh b/get_consumer_key.sh
new file mode 100755
index 0000000..12ca489
--- /dev/null
+++ b/get_consumer_key.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -eu
+
+if [ -z "$OVH_APP_KEY" ]; then
+  echo 'Need $OVH_APP_KEY!'
+  echo "https://eu.api.ovh.com/createApp/"
+  exit 1
+fi
+
+BODY='
+{
+  "accessRules": [
+    {
+      "method": "DELETE",
+      "path": "/domain/zone/*"
+    },
+    {
+      "method": "GET",
+      "path": "/domain/zone/*"
+    },
+    {
+      "method": "POST",
+      "path": "/domain/zone/*"
+    },
+    {
+      "method": "PUT",
+      "path": "/domain/zone/*"
+    },
+    {
+      "method": "GET",
+      "path": "/domain/*"
+    },
+    {
+      "method": "PUT",
+      "path": "/domain/*"
+    },
+    {
+      "method": "POST",
+      "path": "/domain/*/nameServers/update"
+    }
+  ]
+}
+'
+
+echo $BODY | xh --json --print=b POST https://eu.api.ovh.com/1.0/auth/credential "X-Ovh-Application:$OVH_APP_KEY"