download file from workspace
Authenticate the service on Keycloak, retrieve a token then download the file using the authentication token
The input form allows to select from the user workspace files
method json
{
"inputs": {
"inputFile": {
"id": "inputFile",
"title": "inputFile",
"description": "Input CSV file()",
"minOccurs": 1,
"maxOccurs": 1,
"schema": {
"type": "string",
"format": "remotefile",
"default": "",
"contentMediaType": "text/csv"
}
}
},
"additionalParameters": {
"parameters": [
{
"name": "deploy-script",
"value": [
"./download.sh {{inputFile}}"
]
},
{
"name": "execute-script",
"value": [
"python XXX.py /ccp_data/inputFile.csv [[ARGS]]",
"cp -f result.csv /ccp_data/"
]
}
]
}
}
download implementation: the docker image contains the download script [download.sh](../support_files/download.sh]`
echo "Getting token"
TOKEN=$(curl -X POST $ccpiamurl -d grant_type=refresh_token -d client_id=$ccpclientid -d refresh_token=$ccprefreshtoken -H "X-D4Science-Context: $ccpcontext" | jq -r '."access_token"')
echo Downloading /ccp_data/inputFile.csv
curl $1 -o /ccp_data/inputFile.csv -H "Authorization: Bearer $TOKEN"
echo "Downloaded"