From 8be1828ddc8d855f5075e6648bc51e0cfa21f44f Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 26 Jul 2024 17:10:17 +0200 Subject: [PATCH] demo data --- README.md | 3 + demo.json | 765 ++++++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 2 +- go.sum | 4 + populate.sh | 41 +++ 5 files changed, 814 insertions(+), 1 deletion(-) create mode 100644 demo.json create mode 100755 populate.sh diff --git a/README.md b/README.md index 5a1e9c1..19f555c 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,6 @@ If default Swagger page is displayed instead of tyour api, change url in swagger url: "swagger.json" +Populate : + +`./populate.sh ./demo.sh` \ No newline at end of file diff --git a/demo.json b/demo.json new file mode 100644 index 0000000..02bbe44 --- /dev/null +++ b/demo.json @@ -0,0 +1,765 @@ +[ + { + "api": "/oc/data/", + "content": [ + { + "name": "Mundi Sentienl 3 SRAL Images", + "short_description": "Mundi Sentinels 3 SAR Altiemter image", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Mundi Sentienl 3 SRAL Images.png", + "description": "A very long description of what this data is", + "owner": "Mundi Web", + "example": "string", + "datatype": "string", + "source_url": "string" + }, + { + "name": "Mundi Sentienl 3 OLCI Images", + "short_description": "Mundi Sentinels 3 Ocean and land color Altiemter image", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Mundi Sentienl 3 OLCI Images.png", + "description": "A very long description of what this data is", + "owner": "Mundi Web", + "example": "string", + "datatype": "string", + "source_url": "string" + }, + { + "name": "Meteo-France forecasts", + "short_description": "Meteo France weather forecasts", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Meteo-France forecasts.png", + "description": "A very long description of what this data is", + "owner": "Meteo-France", + "example": "string", + "datatype": "string", + "source_url": "string" + }, + { + "name": "Meteo-France wind archive", + "short_description": "Meteo France wind archive", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Meteo-France wind archive.png", + "description": "A very long description of what this data is", + "owner": "Meteo-France", + "example": "string", + "datatype": "string", + "source_url": "string" + } + ] + }, + { + "api": "/oc/processing/", + "content": [ + { + "name": "SAR High points", + "short_description": "SAR Altimeter High points extraction Software", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/SAR High points.png", + "description": "A very long description of what this data is", + "owner": "IRT", + "price": 300, + "license": "GPLv2", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "storage": 300, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "source_url": "http://www.google.com" + }, + { + "name": "Flammable vegetation slicer", + "short_description": "Analyze land cover and define optimum vegetation slices to prevent fire propagation", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Flammable vegetation slicer.png", + "description": "A very long description of what this data is", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 4096, + "storage": 30000, + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "owner": "Gob.fr", + "price": 330, + "license": "Copyright", + "source_url": "http://www.google.com" + }, + { + "name": "Long term fire risk mitigation planner", + "short_description": "Long term fire risk mitigation planner : provides list of actions to be performed to mitigate fire propagation", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Long term fire risk mitigation planner.png", + "description": "A very long description of what this data is", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "disk_io": "30 MB/s", + "parallel": false, + "scaling_model": 2, + "owner": "Gob.fr", + "price": 30, + "license": "GPLv3", + "source_url": "http://www.google.com" + }, + { + "name": "Fire propagation simulator", + "short_description": "Fire propagation simulator", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Fire propagation simulator.png", + "description": "A very long description of what this data is", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 8192, + "storage": 30000, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "owner": "Gob.fr", + "price": 39, + "license": "GPLv3", + "source_url": "http://www.google.com" + }, + { + "name": "Environment builder", + "short_description": "build simulated environment from real environmental data and fire mitigation rules ", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Environment builder.png", + "description": "A very long description of what this data is", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 2049, + "storage": 500, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "owner": "Gob.fr", + "price": 39, + "license": "GPLv3", + "source_url": "http://www.google.com" + }, + { + "name": "CURL", + "image" : "curlimages/curl:7.88.1", + "short_description": "Transfer or retrieve information from or to a server ", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/curl-logo.png", + "description": "curl is a tool for transferring data from or to a server. It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS.", + "owner": "IRT", + "price": 300, + "license": "GPLv2", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "storage": 300, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "source_url": "http://www.google.com" + }, + { + "name": "alpine", + "image" : "alpine:3.7", + "short_description": "A minimal Docker image ", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/alpine-logo.png", + "description": "Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications", + "owner": "IRT", + "price": 300, + "license": "GPLv2", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "storage": 300, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "source_url": "http://www.google.com" + }, + { + "name": "alpr", + "image" : "openalpr/openalpr", + "short_description": "Open source Automatic License Plate Recognition library.", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/alpr-logo.png", + "description": "Deploy license plate and vehicle recognition with Rekorā€™s OpenALPR suite of solutions designed to provide invaluable vehicle intelligence which enhances business capabilities, automates tasks, and increases overall community safety!", + "owner": "IRT", + "price": 300, + "license": "GPLv2", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "storage": 300, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "source_url": "http://www.google.com" + }, + { + "name": "imagemagic", + "image" : "dpokidov/imagemagick:7.1.0-62-2", + "short_description": "ImageMagickĀ® is a free, open-source software suite, used for editing and manipulating digital images.", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/imagemagic-logo.png", + "description": "Use ImageMagick to create, edit, compose, and convert digital images. Resize an image, crop it, change its shades and colors, add captions, and more.", + "owner": "IRT", + "price": 300, + "license": "GPLv2", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "storage": 300, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "source_url": "http://www.google.com" + }, + { + "name": "Mosquito server", + "short_description": "open source message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1.", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/mosquitto-logo.png", + "description": "A very long description of what this storage is", + "owner": "IRT", + "price": 300, + "license": "GPLv2", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": 1024, + "storage": 300, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "disk_io": "30 MB/s", + "parallel": true, + "scaling_model": 2, + "source_url": "http://www.google.com" + } + ] + }, + { + "api": "/oc/storage/", + "content": [ + { + "name": "IRT risk database", + "short_description": "IRT Database instance", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/IRT risk database.png", + "owner": "IRT", + "description": "A very long description of what this storage is", + "type": "database", + "acronym": "DC_myDC", + "size": 4000, + "price": 90, + "encryption": false, + "redundancy": "RAID5", + "throughput": "r:200,w:150", + "source_url": "http://www.google.com" + }, + { + "name": "IRT local file storage", + "short_description": "S3 compliant IRT file storage", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/IRT local file storage.png", + "description": "A very long description of what this storage is", + "owner": "IRT", + "acronym": "DC_myDC", + "size": 40000, + "encryption": false, + "redundancy": "RAID5S", + "throughput": "r:300,w:350", + "price": 90, + "source_url": "http://www.google.com" + } + ] + }, + { + "api": "/oc/datacenter/", + "content": [ + { + "name": "Mundi datacenter", + "acronym": "DC_myDC", + "hosts": [ + "localhost:49618", + "oc-catalog:49618" + ], + "short_description": "Mundi Opencloud Instance", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Mundi datacenter.png", + "description": "A very long description of what this data is", + "type": "datacenter", + "bookingPrice": 650, + "owner": "IRT", + "cpus": [{ + "cores": 8, + "architecture": "x86", + "shared": false + }], + "ram": { + "size": 16384, + "ecc": false + }, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "source_url": "http://www.google.com" + }, + { + "name": "CNES datacenter", + "acronym": "DC_superDC1", + "hosts": [ + "localhost:49619", + "dc1:49618" + ], + "short_description": "CNES Opencloud Instance", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/CNES datacenter.png", + "description": "A very long description of what this data is", + "type": "datacenter", + "bookingPrice": 650, + "owner": "IRT", + "cpus": [{ + "cores": 32, + "architecture": "x86", + "shared": false + }], + "ram": { + "size": 100000, + "ecc": false + }, + "gpus": [], + "source_url": "http://www.google.com" + }, + { + "name": "Meteo France datacenter", + "acronym": "DC_superDC2", + "hosts": [ + "localhost:49620", + "dc2:49618" + ], + "short_description": "Meteo France Opencloud Instance", + "logo": "https://cloud.o-forge.io/core/deperecated-oc-catalog/src/branch/main/scripts/local_imgs/Meteo France datacenter.png", + "description": "A very long description of what this data is", + "type": "datacenter", + "bookingPrice": 650, + "owner": "Meteo France", + "cpus": [{ + "cores": 16, + "architecture": "x86", + "shared": false + }], + "ram": { + "size": 32786, + "ecc": false + }, + "gpus": [ + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + }, + { + "cuda_cores": 10496, + "model": "RTX 3090 FE", + "memory": 24000, + "tensor_cores": 328 + } + ], + "source_url": "http://www.google.com" + } + ] + } +] \ No newline at end of file diff --git a/go.mod b/go.mod index 1cff6e0..06cbf6e 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20240726121555-eb1417853a1c // indirect + cloud.o-forge.io/core/oc-lib v0.0.0-20240726144711-ff286583aada // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/beego/bee/v2 v2.1.0 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/go.sum b/go.sum index 3a32119..8cd5b7f 100644 --- a/go.sum +++ b/go.sum @@ -94,6 +94,10 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20240726114510-8c97fca96c85 h1:PPFwnkl9m8WCr cloud.o-forge.io/core/oc-lib v0.0.0-20240726114510-8c97fca96c85/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= cloud.o-forge.io/core/oc-lib v0.0.0-20240726121555-eb1417853a1c h1:GS1E071bdeKpMgq9i6KMa87zUJkoB7+8miQlvVViHHs= cloud.o-forge.io/core/oc-lib v0.0.0-20240726121555-eb1417853a1c/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= +cloud.o-forge.io/core/oc-lib v0.0.0-20240726131936-87b7cda0ce28 h1:nx7xOMXuQHDJNkXw7NCFrsOG/PzbhKNV4/4Ea2arkzg= +cloud.o-forge.io/core/oc-lib v0.0.0-20240726131936-87b7cda0ce28/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= +cloud.o-forge.io/core/oc-lib v0.0.0-20240726144711-ff286583aada h1:pUe+iliStLC0vcK9Qkn5PZlE39QtcrCntH5cxduxZjE= +cloud.o-forge.io/core/oc-lib v0.0.0-20240726144711-ff286583aada/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= diff --git a/populate.sh b/populate.sh new file mode 100755 index 0000000..5ecbfba --- /dev/null +++ b/populate.sh @@ -0,0 +1,41 @@ +#!/usr/bin/bash + + +# Must specify a JSON with a following structure: + +ENDPOINT="http://localhost:8087" +if [[ $DOCKER_ENVIRONMENT ]]; then + ENDPOINT="http://oc-catalog:8087" +fi + +if [[ $DOCKER_ENDPOINT ]]; then + ENDPOINT="$DOCKER_ENDPOINT" +fi + +[[ -z $1 ]] && { echo "Must specify a json path"; exit 1; } +[[ ! -f $1 ]] && { echo "$1 is not a file"; exit 1; } +cat "$1" | jq empty || { echo "$1 is not a valid JSON"; exit 1; } + +######## + +while read row; do + TRGT_ENDPOINT=$(echo $row | jq -r '.api') + + while read item; do + echo `echo $item | jq -r '.name'` to $ENDPOINT${TRGT_ENDPOINT} + answer=$(curl --fail "$ENDPOINT${TRGT_ENDPOINT}" \ + -X POST \ + -H "Content-Type: application/json" \ + -d "$item") + echo $answer + if [[ $? -ne 0 || "$answer" == *""* ]]; then + exit 1 + fi + done < <(echo "$row" | jq -c '.content[]') +done < <(jq -c '.[]' $1) + + +echo +echo +echo +echo "All models submitted correctly!"