Skip to content

Commit

Permalink
rename variable AGENT to USER_AGENT
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 committed Dec 27, 2024
1 parent 169e86c commit c35068c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/demo_scripts/create_qovery_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ QOVERY_API_URL=${QOVERY_API_URL:='https://api.qovery.com'}
CLUSTER_NAME=$1
ARCH=$2
ORGANIZATION_ID=$3
AGENT=$6
USER_AGENT=$6
case $3 in
qov_*)
AUTHORIZATION_HEADER="Authorization: Token $4"
Expand All @@ -30,10 +30,10 @@ esac
POWERSHELL_CMD='powershell.exe'

get_or_create_on_premise_account() {
accountId=$(curl -s --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${AGENT}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/onPremise/credentials | jq -r .results[0].id)
accountId=$(curl -s --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${USER_AGENT}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/onPremise/credentials | jq -r .results[0].id)
if [ "$accountId" = "null" ]
then
accountId=$(curl -s -X POST --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${AGENT}" -d '{"name": "on-premise"}' ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/onPremise/credentials | jq -r .id)
accountId=$(curl -s -X POST --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${USER_AGENT}" -d '{"name": "on-premise"}' ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/onPremise/credentials | jq -r .id)
fi

echo "$accountId"
Expand All @@ -42,20 +42,20 @@ get_or_create_on_premise_account() {
get_or_create_demo_cluster() {
accountId=$1
clusterName=$2
clusterId=$(curl -s -X GET --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${AGENT}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/cluster | jq -r '.results[] | select(.name=="'"$clusterName"'") | .id')
clusterId=$(curl -s -X GET --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${USER_AGENT}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/cluster | jq -r '.results[] | select(.name=="'"$clusterName"'") | .id')

if [ "$clusterId" = "" ]
then
payload='{"name":"'$2'","region":"on-premise","cloud_provider":"ON_PREMISE","kubernetes":"SELF_MANAGED", "production": false, "is_demo": true, "features":[],"cloud_provider_credentials":{"cloud_provider":"ON_PREMISE","credentials":{"id":"'${accountId}'","name":"on-premise"},"region":"unknown"}}'
clusterId=$(curl -s -X POST --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${AGENT}" -d "${payload}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/cluster | jq -r .id)
clusterId=$(curl -s -X POST --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/json' -H "User-Agent: ${USER_AGENT}" -d "${payload}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/cluster | jq -r .id)
fi

echo "$clusterId"
}

get_cluster_values() {
clusterId=$1
curl -s -X GET --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/x-yaml' -H "User-Agent: ${AGENT}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/cluster/"${clusterId}"/installationHelmValues
curl -s -X GET --fail-with-body -H "${AUTHORIZATION_HEADER}" -H 'Content-Type: application/x-yaml' -H "User-Agent: ${USER_AGENT}" ${QOVERY_API_URL}/organization/"${ORGANIZATION_ID}"/cluster/"${clusterId}"/installationHelmValues
}

get_or_create_cluster() {
Expand Down

0 comments on commit c35068c

Please sign in to comment.