Skip to content

Commit

Permalink
removed automation api token creation
Browse files Browse the repository at this point in the history
  • Loading branch information
olegvorobiov committed Sep 3, 2024
1 parent b1e0cce commit 0ce9b27
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions scripts/rancher/user-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,3 @@ rancher_update_password() {
}' \
"$rancherUrl/v3/users?action=changepassword"
}

#######################################
# Create an API key Rancher
# Globals:
# API_TOKEN
# Arguments:
# Rancher URL
# token
# key description
# Examples:
# rancher_create_apikey rancher.random_string.geek xxxxx 'Automation API Key'
#######################################
rancher_create_apikey() {
local rancherUrl=$1
local token=$2
local description=$3

echo "Creates a Rancher API Key..."
API_KEY_RESPONSE=$(curl -s -k "$rancherUrl/v3/tokens" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $token" \
--data-binary '{
"type": "token",
"description": "'"$description"'",
"ttl": 0
}')
echo "DEBUG API_KEY_RESPONSE=${API_KEY_RESPONSE}"
API_TOKEN=$(echo $API_KEY_RESPONSE | jq -r .token)
sleep 5
}

0 comments on commit 0ce9b27

Please sign in to comment.