cURL is a well known HTTP client. In order to use it, log into the Cloud@CNAF dashboard at tb-cloud-dashboard.cr.cnaf.infn.it and download the openrc file from the upper right drop down menu option:



After sourcing the openrc file, get from Keystone a token and the endpoint url specific for your project authentication, contacting https://tb-cloud-api-pub.cr.cnaf.infn.it:5000/v3/auth/tokens:


curl -s -i -H "Content-Type: application/json" -d '

{

    "auth": {

        "identity": {

            "methods": ["password"],

            "password": {

                "user": {

                    "name": "'"$OS_USERNAME"'",

                    "domain":{ "name": "'"$OS_USER_DOMAIN_NAME"'" },

                    "password": "'"$OS_PASSWORD"'"

                }

            }

        },

        "scope": {

            "project": {

                "name": "'"$OS_PROJECT_NAME"'",

                "domain": { "name": "'"$OS_USER_DOMAIN_NAME"'" }

            }

        }

    }

}' https://tb-cloud-api-pub.cr.cnaf.infn.it:5000/v3/auth/tokens > /tmp/response


export AUTH_TOKEN=$(cat /tmp/response | grep X-Subject-Token | awk '{print $2}' | sed 's/\r$//')

export ENDPOINT_URL=$(cat /tmp/response | awk '{if(NR>9)print}' | jq --unbuffered '.token .catalog | .[].endpoints | .[].url' | grep -m1 AUTH | sed 's/"//g')


Now you are ready to manage your containers and objects, e.g.:


(NG-ffornari-tier1) [ffornari@tb-cloud-ui test_clients]# cat ls_container.sh 

#!/bin/bash 

curl -H "X-Auth-Token: $AUTH_TOKEN" -X GET $ENDPOINT_URL/$1/

(NG-ffornari-tier1) [ffornari@tb-cloud-ui test_clients]# ./ls_container.sh

pippo

(NG-ffornari-tier1) [ffornari@tb-cloud-ui test_clients]# ./ls_container.sh pippo

pippo.txt

(NG-ffornari-tier1) [ffornari@tb-cloud-ui test_clients]#

  • No labels