-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdateAPI.sh
More file actions
executable file
·65 lines (57 loc) · 2.93 KB
/
Copy pathupdateAPI.sh
File metadata and controls
executable file
·65 lines (57 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash -e
only_neo=false
if [ "$1" = "--only-neo" ]; then
only_neo=true
shift
fi
if [ "$#" != 2 ]; then
echo "oops $#"
echo "updateAPI.sh [--only-neo] [server] [version]"
echo "exemple : ./updateAPI.sh https://regards.cnes.fr 1.15.0"
echo "C-S : ./updateAPI.sh https://validation-regards.cloud-espace.si.c-s.fr 1.15.0"
echo "Neo only : ./updateAPI.sh --only-neo https://regards.cnes.fr 1.15.0"
exit 1
fi
server=$1
version=$2
# Param 1 : microservice name
function importMServiceControllers
{
microservice=$1
folder_name=$2
dest=./docs/development/services/$folder_name/api-guides/rest/$microservice.json
echo "Fetching ${server}/api/v1/$microservice/v3/api-docs"
curl -s -S -f -X GET -k ${server}/api/v1/$microservice/v3/api-docs --output $dest || printf >&2 "[\033[31mFailed\033[m] $microservice api doc generation failed\n"
sed -i s/\'\@project.version\@\'/$version/g $dest
sed -i s@$server@https://regardsoss.github.io/@g $dest
sed -i s@https://regardsoss.github.io/\:80/@https://regardsoss.github.io/@g $dest
sed -i s@https://regardsoss.github.io/\:443/@https://regardsoss.github.io/@g $dest
sed -i s@https://regardsoss.github.io//@https://regardsoss.github.io/@g $dest
sed -i -E "s@\"scopes\"\:\{\".*\"}@\"scopes\"\:\{}@g" $dest
jq -S . ./docs/development/services/$folder_name/api-guides/rest/$microservice.json > ./docs/development/services/$folder_name/api-guides/rest/$microservice.json.formated
mv ./docs/development/services/$folder_name/api-guides/rest/$microservice.json.formated ./docs/development/services/$folder_name/api-guides/rest/$microservice.json
}
if [ "$only_neo" = true ]; then
importMServiceControllers rs-file-access neo-storage/file-access
importMServiceControllers rs-file-packager neo-storage/file-packager
importMServiceControllers rs-file-catalog neo-storage/file-catalog
else
importMServiceControllers rs-access-instance access-instance
importMServiceControllers rs-access-project access-project
importMServiceControllers rs-admin admin
importMServiceControllers rs-admin-instance admin-instance
importMServiceControllers rs-authentication authentication
importMServiceControllers rs-catalog catalog
importMServiceControllers rs-dam dam
importMServiceControllers rs-dataprovider dataprovider
importMServiceControllers rs-fem fem
importMServiceControllers rs-ingest ingest
importMServiceControllers rs-lta-manager lta-manager
importMServiceControllers rs-notifier notifier
importMServiceControllers rs-order order
importMServiceControllers rs-processing processing
importMServiceControllers rs-storage storage
importMServiceControllers rs-worker-manager worker-manager
importMServiceControllers rs-delivery delivery
importMServiceControllers rs-downloader downloader
fi