-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
199 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
function federation_createkey { | ||
apiCall -X POST -d '{"apiKeyName": "${n}"}' "/controller/rest/federation/apikeyforfederation" "$@" | ||
} | ||
|
||
register federation_createkey Create API Key for Federation | ||
describe federation_createkey << EOF | ||
Create API Key for Federation. | ||
EOF |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
function federation_establish { | ||
local ACCOUNT=${CONFIG_CONTROLLER_CREDENTIALS##*@} | ||
ACCOUNT=${ACCOUNT%%:*} | ||
info "Establishing friendship..." | ||
apiCall -X POST -d "{ \ | ||
\"accountName\": \"${ACCOUNT}\", \ | ||
\"controllerUrl\": \"${CONFIG_CONTROLLER_HOST}\", \ | ||
\"friendAccountName\": \"\${a}\", \ | ||
\"friendAccountApiKey\": \"\${k}\", \ | ||
\"friendAccountControllerUrl\": \"\${c}\" \ | ||
}" "/controller/rest/federation/establishmutualfriendship" "$@" | ||
} | ||
|
||
register federation_establish Establish Mutual Friendship | ||
describe federation_establish << EOF | ||
Establish Mutual Friendship | ||
EOF |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
function federation_setup { | ||
|
||
local FRIEND_CONTROLLER_CREDENTIALS="" | ||
local FRIEND_CONTROLLER_HOST="" | ||
local KEY_NAME="" | ||
|
||
local MY_ACCOUNT=${CONFIG_CONTROLLER_CREDENTIALS##*@} | ||
MY_ACCOUNT=${MY_ACCOUNT%%:*} | ||
|
||
while getopts "c:h:k:" opt "$@"; | ||
do | ||
case "${opt}" in | ||
c) | ||
FRIEND_CONTROLLER_CREDENTIALS=${OPTARG} | ||
;; | ||
h) | ||
FRIEND_CONTROLLER_HOST=${OPTARG} | ||
;; | ||
k) | ||
KEY_NAME=${OPTARG} | ||
;; | ||
esac | ||
done; | ||
shiftOptInd | ||
shift $SHIFTS | ||
if [ -z "$KEY_NAME" ] ; then | ||
local FRIEND_ACCOUNT=${FRIEND_CONTROLLER_CREDENTIALS##*@} | ||
FRIEND_ACCOUNT=${FRIEND_ACCOUNT%%:*} | ||
KEY_NAME=${FRIEND_ACCOUNT}_${FRIEND_CONTROLLER_HOST//[:\/]/_}_$RANDOM | ||
fi; | ||
federation_createkey -n $KEY_NAME | ||
debug "Key creation result: $COMMAND_RESULT" | ||
KEY=${COMMAND_RESULT##*\"key\": \"} | ||
KEY=${KEY%%\",\"*} | ||
debug "Identified key: $KEY" | ||
|
||
debug "Establishing mutual friendship: $0 -J /tmp/appdynamics-federation-cookie.txt -H $FRIEND_CONTROLLER_HOST -C $FRIEND_CONTROLLER_CREDENTIALS federation establish -a $MY_ACCOUNT -k $KEY -c $CONFIG_CONTROLLER_HOST" | ||
FRIEND_RESULT=`$0 -J /tmp/appdynamics-federation-cookie.txt -H "$FRIEND_CONTROLLER_HOST" -C "$FRIEND_CONTROLLER_CREDENTIALS" federation establish -a "$MY_ACCOUNT" -k "$KEY" -c "$CONFIG_CONTROLLER_HOST"` | ||
|
||
if [ -z "$FRIEND_RESULT" ] ; then | ||
COMMAND_RESULT="Federation between $CONFIG_CONTROLLER_HOST and $FRIEND_CONTROLLER_HOST successfully established." | ||
else | ||
COMMAND_RESULT="" | ||
error "Federation setup failed. Error from $FRIEND_CONTROLLER_HOST: ${FRIEND_RESULT}" | ||
fi | ||
|
||
|
||
rm /tmp/appdynamics-federation-cookie.txt | ||
} | ||
|
||
register federation_setup Setup a controller federation: Generates a key and establishes the mutal friendship. | ||
describe federation_setup << EOF | ||
Setup a controller federation: Generates a key and establishes the mutal friendship. | ||
EOF |
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
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
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
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