Skip to content
Snippets Groups Projects
Select Git revision
  • 2d426dd9f24ebf831918e7170d99e093f3f3838b
  • master default protected
  • dev protected
  • 553-semantic-recommendation-2
  • 553-semantic-recommendation
  • replication_test
  • release-1.10 protected
  • release-1.9 protected
  • 551-init-broker-service-permissions
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • 485-fixity-checks
  • v1.10.3 protected
  • v1.10.2 protected
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
  • v1.9.2 protected
41 results

FdaContainerManagingApplication.java

Blame
  • generate.sh 2.16 KiB
    #!/bin/bash
    
    declare -A services
    services[5010]=units
    services[9091]=container
    services[9092]=database
    services[9093]=query
    services[9094]=table
    services[9097]=authentication
    services[9096]=identifier
    
    function retrieve () {
      echo "... retrieve api"
      if [[ "$2" == units ]]; then
        wget "http://localhost:$1/api-$2.json" -O "./api-$2.yaml" -q
      else
        wget "http://localhost:$1/v3/api-docs.yaml" -O "./api-$2.yaml" -q
      fi
    }
    
    function generate () {
      echo "... generate python api"
      java -jar swagger-codegen-cli.jar generate -i "./api-$1.yaml" -l python -o "./api-$1" > /dev/null
    }
    
    function remove () {
      echo "... removing old python api"
      rm -rf "${HOME}/Projects/fda-services/.gitlab/api_$1"
      rm -rf "${HOME}/Projects/fda-services/.demo/api_$1"
      rm -rf "./api/api_$1"
    }
    
    function copy () {
      echo "... copying python api"
      cp -r "./api-$1/swagger_client" "${HOME}/Projects/fda-services/.gitlab/api_$1"
      cp -r "./api-$1/swagger_client" "${HOME}/Projects/fda-services/.demo/api_$1"
      cp -r "./api-$1/swagger_client" "./api/api_$1"
    }
    
    function replace () {
      echo "... replacing swagger client package name and gateway"
      find "${HOME}/Projects/fda-services/.gitlab/api_$2" -type f -exec sed -i -e "s/swagger_client/api_$2/g" {} \;
      find "${HOME}/Projects/fda-services/.gitlab/api_$2" -type f -exec sed -i -e "s/self.host = .*/self.host = \"http:\/\/localhost:9095\"/g" {} \;
      find "${HOME}/Projects/fda-services/.demo/api_$2" -type f -exec sed -i -e "s/swagger_client/api_$2/g" {} \;
      find "${HOME}/Projects/fda-services/.demo/api_$2" -type f -exec sed -i -e "s/self.host = .*/self.host = \"http:\/\/localhost:9095\"/g" {} \;
      find "./api/api_$2" -type f -exec sed -i -e "s/swagger_client/api_$2/g" {} \;
      find "./api/api_$2" -type f -exec sed -i -e "s/self.host = .*/self.host = \"http:\/\/localhost:9095\"/g" {} \;
    }
    
    for key in "${!services[@]}"; do
      echo "Generating ${services[$key]} API"
      retrieve "$key" "${services[$key]}"
      generate "${services[$key]}"
      remove "${services[$key]}"
      copy "${services[$key]}"
      replace "$key" "${services[$key]}"
    done
    
    cp -r ./api/* "${HOME}/Projects/dbrepo-tuw/worker-airquality/"
    cp -r ./client "${HOME}/Projects/dbrepo-tuw/worker-airquality/"