mirror of
https://github.com/valitydev/holmes.git
synced 2024-11-06 09:55:19 +00:00
36 lines
924 B
Bash
36 lines
924 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
USAGE=$(cat <<EOF
|
||
|
Usage: ${SCRIPTNAME} plan-id batch
|
||
|
Prepares and then rolls back a plan made up of the single posting batch provided by
|
||
|
the user.
|
||
|
plan-id Posting plan ID (string)
|
||
|
batch Posting batch (json object, see [2])
|
||
|
|
||
|
More information:
|
||
|
[1]: https://github.com/rbkmoney/damsel
|
||
|
[2]: https://github.com/rbkmoney/damsel/blob/b0806eb1/proto/accounter.thrift#L67
|
||
|
EOF
|
||
|
)
|
||
|
|
||
|
function usage {
|
||
|
echo "${USAGE}"
|
||
|
exit 127
|
||
|
}
|
||
|
|
||
|
[ -f woorlrc ] && source woorlrc
|
||
|
|
||
|
PLANID="${1}"
|
||
|
[ -z "${PLANID}" ] && usage
|
||
|
BATCH="${2}"
|
||
|
[ -z "${BATCH}" ] && usage
|
||
|
|
||
|
ACCOUNTER="http://${SHUMWAY:-shumway}:8022/accounter"
|
||
|
|
||
|
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
|
||
|
${ACCOUNTER} Accounter Hold \
|
||
|
"{\"id\": \"${PLANID}\", \"batch\": ${BATCH}}" && \
|
||
|
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
|
||
|
${ACCOUNTER} Accounter RollbackPlan \
|
||
|
"{\"id\": \"${PLANID}\", \"batch_list\": [${BATCH}]}"
|