Created
April 22, 2019 19:00
-
-
Save macdonst/f7e17dbd61e950f0f6bbba8cf1b73073 to your computer and use it in GitHub Desktop.
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
function owenv() { | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
switches="" | |
space=$1 | |
case "$space" in | |
"cloudshell") | |
host=runtime.adobe.io | |
key=<api key> | |
;; | |
"solutions") | |
host=runtime.adobe.io | |
key=<api key> | |
;; | |
"sensei") | |
host=runtime.adobe.io | |
key=<api key> | |
;; | |
"smacdona") | |
host=runtime.adobe.io | |
key=<api key> | |
;; | |
"vagrant") | |
host=192.168.33.16 | |
key=<api key> | |
;; | |
"io-onboarding") | |
host=wsk-edge.corp.adobe.com | |
key=<api key> | |
;; | |
*) | |
apihost=`wsk -i property get --apihost | rev | cut -f1 | rev` | |
namespace=`wsk -i namespace list | tail -n1` | |
echo "Host ${bold}${apihost}${normal}" | |
echo "Namespace ${bold}${namespace}${normal}" | |
echo "Change using: owenv {cloudshell|solutions|sensei|smacdona|vagrant|io-onboarding}" | |
return | |
esac | |
if [ -z $key ] ; then | |
return | |
fi | |
wsk $switches property set --apihost $host --auth $key > /dev/null && \ | |
wsk $switches property unset --namespace > /dev/null | |
# display some information | |
apihost=`wsk $switches property get --apihost | rev | cut -f1 | rev` | |
namespace=`wsk $switches namespace list | tail -n1` | |
echo "Host ${bold}${apihost}${normal}" | |
echo "Namespace ${bold}${namespace}${normal}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment