Blog
Search…
Ceph RadosGW admin Ops
How to use it
Using RadosGW admin ops for the first time, can be a real headache , for this purpose i have made this post, where you will understand how to use this API.
Let's start:
For issue a request through admin ops, you need to have a signature, this signature is make it signing a header. The header must to be composed by the current date, the request type(GET/PUT/POST/DELETE) and the request itself. This header must be signed by SSL including the admin ops secret on this signature.
Now , you can make a request.
Sometimes, the time is not the same as the radosgw node expect, you can hack on it changing the date=$(date) value with:
If your host has two hours more than the radosgw node, substract this two hours under $(( 10#$i-2)) variable, where 2 is the two hours to substract.
1
date=$(for i in $(date "+%H") ; do date "+%a, %d %b %Y $(( 10#$i-2 )):%M:%S +0000" ; done)
Copied!
Examples:
Create a user named egonzalez
1
#!/bin/bash
2
token=U2JCD4ZG4D1XJOI5XNF4 ## USER_TOKEN
3
secret=+IFgr7POzLWS0i3hQnC+dd3DOAZObHoY5NYm6m3b ## USER_SECRET
4
query=$1
5
name=$2
6
query3="&uid="
7
query2=admin/user
8
query4="&quota-type=user"
9
date=$(date)
10
header="PUT\n\n\n${date}\n/${query2}"
11
sig=$(echo -en ${header} | openssl sha1 -hmac ${secret} -binary | base64)
12
curl -v -H "Date: ${date}" -H "Authorization: AWS ${token}:${sig}" -L -X PUT "http://10.0.2.10/${query2}?format=json${query3}${query}&display-name=${name}" -H "Host: 10.0.2.10"
13
##Change IPs with your own IPs
Copied!
See quotas
1
#!/bin/bash
2
token=U2JCD4ZG4D1XJOI5XNF4 ## USER_TOKEN
3
secret=+IFgr7POzLWS0i3hQnC+dd3DOAZObHoY5NYm6m3b ## USER_SECRET
4
query=$1
5
query3="&uid="
6
query2=admin/user
7
query4="&quota-type=user"
8
date=$(date)
9
header="GET\n\n\n${date}\n/${query2}"
10
sig=$(echo -en ${header} | openssl sha1 -hmac ${secret} -binary | base64)
11
curl -v -H "Date: ${date}" -H "Authorization: AWS ${token}:${sig}" -L -X GET "http://10.0.2.10/${query2}?quota${query3}${query}&quota-type=user" -H "Host: 10.0.2.10"
12
##Change IPs with your own IPs
Copied!
See egonzalez user information
1
#!/bin/bash
2
token=U2JCD4ZG4D1XJOI5XNF4 ## USER_TOKEN
3
secret=+IFgr7POzLWS0i3hQnC+dd3DOAZObHoY5NYm6m3b ## USER_SECRET
4
query=$1
5
query3="&uid="
6
query2=admin/user
7
date=$(date)
8
header="GET\n\n\n${date}\n/${query2}"
9
sig=$(echo -en ${header} | openssl sha1 -hmac ${secret} -binary | base64)
10
curl -v -H "Date: ${date}" -H "Authorization: AWS ${token}:${sig}" -L -X GET "http://10.0.2.10/${query2}?format=json${query3}${query}" -H "Host: 10.0.2.10"
11
##Change IPs with your own IPs
Copied!
When you really understand how admin ops works, is not as difficult to use it, just search at the official documentation and modify the desired values.
I hope this helps:
Regards, Eduardo.
Last modified 1yr ago
Copy link