provisioning tool for building opinionated architecture
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
773 B

8 months ago
  1. #!/bin/bash
  2. # GET DOMAIN : https://eu.api.ovh.com/createToken/?GET=/me*&POST=/me*&PUT=/me*&DELETE=/me*
  3. function set_base {
  4. BASE_URL="https://eu.api.ovh.com/1.0"
  5. source ./.ovh-credential
  6. }
  7. function get_me {
  8. local method query body tstamp sha signature
  9. method="GET"
  10. query="${BASE_URL}/me"
  11. body=""
  12. tstamp=$(date +%s)
  13. sha=$(echo -n "$AS+$CK+$method+$query+$body+$tstamp" | shasum | cut -d ' ' -f 1)
  14. signature="\$1\$$sha"
  15. curl -s \
  16. -X $method \
  17. -H "Content-type: application/json" \
  18. -H "X-Ovh-Application: $AK" \
  19. -H "X-Ovh-Consumer: $CK" \
  20. -H "X-Ovh-Signature: $signature" \
  21. -H "X-Ovh-Timestamp: $tstamp" \
  22. "$query" | yq -P
  23. }
  24. . "$MIAOU_BASEDIR/lib/init.sh"
  25. set_base
  26. get_me