-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathresend
executable file
·50 lines (44 loc) · 979 Bytes
/
resend
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash -e
# Resend an incident notification.
usage() {
(
echo "usage: ${0##*/} [-h|--help] [options] INCIDENT_UUID"
echo "Resend an incident notification."
echo
echo "options:"
(
echo " -h, --help@ show usage help"
echo " -t@ set trigger to true"
) | column -ts@
) >&2
exit 1
}
if echo "$*" | grep -Eq -- '--help\b|-h\b' || [[ -z $1 ]]; then
usage
fi
TRIGGER="false"
while getopts "t" opt; do
case "$opt" in
t) TRIGGER="true" ;;
*) usage ;;
esac
done
shift $((OPTIND - 1))
ENV="${ENV:-dev}"
INCIDENT_UUID="$1"
PROXY="https://cli.$ENV.mcinfra.io"
ROUTE="notifications/resend"
METHOD="method=POST"
awscurl --profile "$ENV" \
-XPOST "$PROXY/$ROUTE?$METHOD" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "$(
cat <<EOF | jq -c
{
"incident_uuid": "$INCIDENT_UUID",
"trigger": $TRIGGER
}
EOF
)"
echo