Commit 443c2891 authored by Vincent Rondot's avatar Vincent Rondot
Browse files

Merge branch 'slb-add-script-load-schema' into 'master'

Add convenient script to load the schema

See merge request !41
parents 1ce7532d 783b7f8a
Pipeline #33358 passed with stages
in 9 minutes and 24 seconds
......@@ -67,3 +67,13 @@ curl \
}'
```
The `loadschema.sh` script is a convenient script to register all schemas (to be run from within this directory), and can be used the following way:
```bash
#set the following variable
BASE_URL=TBD
DATA_PARTITION=TBD
TOKEN=TBD
./loadSchema.sh $BASE_URL $DATA_PARTITION $TOKEN
```
#!/bin/bash
#This is a convenient script for loading all the schemas
set -e
if [ $# -ne 3 ]
then
echo "Usage ./loadSchema.sh $BASE_URL $DATA_PARTITION $TOKEN"
fi
BASE_URL=$1
DATA_PARTITION=$2
TOKEN=$3
echo "Loading Schemas on '$BASE_URL', for DataPartition '$DATA_PARTITION'"
schemaFiles=$(ls *.json)
for schemaFile in $schemaFiles
do
echo "loading $schemaFile: "
schema=$(sed "s/DATA_PARTITION_TAG/${DATA_PARTITION}/" ${schemaFile})
echo $schema | head -c 100
echo "..."
curl \
--location \
--request POST "$BASE_URL/api/storage/v2/schemas" \
--header "Content-Type: application/json" \
--header "data-partition-id: $DATA_PARTITION" \
--header "Authorization: Bearer $TOKEN" \
--data-raw "${schema}"
echo ""
echo "---"
done
echo "Done!"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment