# one for sending the requests and one for receiving the response
# but only when using the DMAAP interface
# REST or DMAAP is controlled of the base url of $ADAPTER
-# arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
+# arg: (PA|ECS|CR|RC GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
# (Not for test scripts)
__do_curl_to_api() {
- echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
+ echo " (${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG
paramError=0
if [ $# -gt 0 ]; then
__RESTBASE=$ECS_RESTBASE
__RESTBASE_SECURE=$ECS_RESTBASE_SECURE
__RETRY_CODES=$ECS_RETRY_CODES
+ elif [ $1 == "CR" ]; then
+ __ADAPTER=$CR_ADAPTER
+ __RESTBASE=$CR_RESTBASE
+ __RESTBASE_SECURE=$CR_RESTBASE_SECURE
+ __RETRY_CODES=""
+ elif [ $1 == "RC" ]; then
+ __ADAPTER=$RC_ADAPTER
+ __RESTBASE=$RC_RESTBASE
+ __RESTBASE_SECURE=$RC_RESTBASE_SECURE
+ __RETRY_CODES=""
else
paramError=1
fi
if [ $paramError -eq 1 ]; then
((RES_CONF_FAIL++))
- echo "-Incorrect number of parameters to __do_curl_agent " $@ >> $HTTPLOG
+ echo "-Incorrect number of parameters to __do_curl_to_api " $@ >> $HTTPLOG
echo "-Expected: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)" >> $HTTPLOG
echo "-Returning response 000" >> $HTTPLOG
echo "-000"
payload="$(cat $4 | tr -d '\n' | tr -d ' ' )"
echo "payload: "$payload >> $HTTPLOG
file=" --data-binary "$payload
+ elif [ $# -eq 4 ]; then
+ echo " FILE: $(cat $4)" >> $HTTPLOG
fi
#urlencode the request url since it will be carried by send-request url
requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$3")