#!# # example: # ./ IAAP -example.sh[示例id][附加参数,例如]set -e: "${IAAP_HOST? "设置IAAP_HOST环境变量(例如。export IAAP_HOST=localhost或export IAAP_HOST=127.0.0.1)}" example_id=$1 check_token_is_set() {: "${IAAP_TOKEN?设置IAAP_TOKEN环境变量来授权API请求(例如。export IAAP_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE4NTcxMDQzODd9.XEGelyNIyD0L_afWnaZqTRnEFqLjiIYRb8Jy8FeIjVc)}"}} print_row() {printf "%-3s | %-50 | %-100 | %-50 \n" "$@"} case $example_id in 1) #获取API授权令牌client_name=${2?缺少客户端名称}client_key=${3?缺少客户端键}curl -k -X POST "https://${IAAP_HOST}/auth/v1.0/Authorization?ClientName=${client_name}&ClientKey=${client_key}" \ -H "accept: application/json" echo;2) #检查API授权token的有效性缺少API令牌}curl -k -X GET "https://${IAAP_HOST}/auth/v1.0/Authorization/${token}" -H "accept: application/json" echo;3) #获取所有的工作区check_token_is_set curl -k -X Get "https://${IAAP_HOST}/api/v1.0/workspace" \ -H "accept: application/json" -H "JWT: ${ap_token}" echo;4) #获取一个单独的工作区check_token_is_set workspace_id=${2?Missing workspace ID} curl -k -X GET "https://${IAAP_HOST}/api/v1.0/workspace/${workspace_id}" \ -H "accept: application/json" -H "JWT: ${IAAP_TOKEN}" echo ;; 5) # Get a workspace summary of a single workspace check_token_is_set workspace_id=${2?Missing workspace ID} curl -k -X GET "https://${IAAP_HOST}/api/v1.0/workspaceSummary/${workspace_id}" \ -H "accept: application/json" -H "JWT: ${IAAP_TOKEN}" echo ;; 6) # Create a workspace to process idats into gtcs check_token_is_set idat_folder=${2?Missing idat folder} output_folder=${3?Missing output folder} bpm_file=${4?Missing manifest file} egt_file=${5?Missing cluster file} workspace_name=${6?Missing workspace name} curl -k -X POST "https://${IAAP_HOST}/api/v1.0/workspace" \ -H "accept: application/json" -H "JWT: ${IAAP_TOKEN}" \ -H "Content-Type: application/json" \ -d @- <