-
Notifications
You must be signed in to change notification settings - Fork 0
/
4-dump-dual-accounts.sh
executable file
·47 lines (40 loc) · 1.44 KB
/
4-dump-dual-accounts.sh
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
#!/bin/bash
source env-vars.sh
source ./dual-account-params.sh
main() {
dump_platforms
dump_group
dump_accounts
}
dump_platforms() {
echo "$ENV_TAG: Platforms ==========================="
echo " $ENV_TAG: Rotational Group Platform:"
./cybrvault-cli.sh platform_details $ROTATIONAL_GROUP_PLATFORM_ID | jq .
echo "-----------------------------------------------"
echo " $ENV_TAG: Target Account Platform:"
./cybrvault-cli.sh platform_details $ACCOUNT_PLATFORM_ID | jq .
echo "==============================================="
}
dump_group() {
allSafeGroups=$(./cybrvault-cli.sh safe_groups_get $SAFE_NAME)
printf -v query '.[] | select(.GroupName=="%s")' $GROUP_NAME
groupJson=$(echo $allSafeGroups | jq -r "$query")
groupId=$(echo $groupJson | jq -r .GroupID)
echo "$ENV_TAG: Rotational Group ===================="
echo $groupJson | jq .
if [[ "$groupId" != "" ]]; then
echo "Group members:"
./cybrvault-cli.sh safe_group_members_get $groupId | jq .
fi
echo "==============================================="
}
dump_accounts() {
echo "$ENV_TAG: Dual Accounts ======================="
echo " $ENV_TAG: $ACCOUNT_NAME1:"
./cybrvault-cli.sh account_get $SAFE_NAME $ACCOUNT_NAME1 | jq .
echo "-----------------------------------------------"
echo " $ENV_TAG: $ACCOUNT_NAME2:"
./cybrvault-cli.sh account_get $SAFE_NAME $ACCOUNT_NAME2 | jq .
echo "==============================================="
}
main "$@"