Created
February 25, 2021 18:06
-
-
Save tspannhw/5e061a2c4188171b2dcbf6198012d310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "" | |
| echo "" | |
| echo "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔" | |
| echo " Building Schemas" | |
| echo "" | |
| echo "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔" | |
| echo "" | |
| echo "" | |
| # | |
| # Get Schema Registry URL | |
| curl -X GET "http://edge2ai-1.dim.local:8585/api/v1/admin/schemas/registryInfo" -H "accept: application/json" | |
| echo "" | |
| echo "" | |
| # Load Schemas into Schema Registry | |
| # https://registry-project.readthedocs.io/en/latest/schema-registry.html#api-examples | |
| # http://edge2ai-1.dim.local:7788/swagger | |
| for f in /opt/demo/ApacheConAtHome2020/schemas/*.avsc | |
| do | |
| echo "Uploading Schema File $f" | |
| schemaname="`echo $f | awk -F'[/.]' '{print $(NF-1)}'`" | |
| echo "Schema [$schemaname]" | |
| echo "" | |
| curl -X POST "http://edge2ai-1.dim.local:7788/api/v1/schemaregistry/schemas" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"type\": \"avro\", \"schemaGroup\": \"Kafka\", \"name\": \"$schemaname\", \"description\": \"schemaname\", \"compatibility\": \"BOTH\", \"validationLevel\": \"LATEST\"}" | |
| echo "" | |
| # Upload body | |
| curl -X POST "http://edge2ai-1.dim.local:7788/api/v1/schemaregistry/schemas/$schemaname/versions/upload?branch=MASTER&disableCanonicalCheck=false" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/opt/demo/ApacheConAtHome2020/schemas/$schemaname.avsc;type=application/json" -F "description=schemaname" | |
| echo "Added." | |
| echo "" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment