Last active
February 25, 2019 13:37
-
-
Save foospidy/6366e2893e3992b0f6052d31f4ac03c1 to your computer and use it in GitHub Desktop.
Copy a rule to all sites in Signal Sciences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################### | |
# Signal Sciences helper script: | |
# sigsci-copy-request-rule.sh | |
# For a given site and rule id, the script will the rule to all sites. | |
# Requires: | |
# - pysigsci (https://pypi.org/project/pysigsci/) | |
# - jq (https://stedolan.github.io/jq/) | |
if [ -z $1 ]; | |
then | |
echo "Usage: ./sigsci-copy-request-rule.sh <site> <id>" | |
exit | |
fi | |
if [ -z $2 ]; | |
then | |
echo "Usage: ./sigsci-copy-request-rule.sh <site> <id>" | |
exit | |
fi | |
JSON=`pysigsci --get request-rules --site ${1} | jq ".data[] | select(.id == \"${2}\")"` | |
pysigsci --add request-rules --all-sites --data "$JSON" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment