dev-master
9999999-devPHP library to communicate with Ceph's REST API
MIT
by Antoni Orfin
by Rafał Lorenz
client ceph php-cephclient cephclient
Wallogit.com
2017 © Pedro Peláez
PHP library to communicate with Ceph's REST API
php-cephclient is a PHP library to communicate with Ceph's REST API., (*1)
This is currently a work in progress., (*2)
The CurlClient class takes care of sending calls to the API through HTTP and handle the responses. It supports queries for JSON, XML, plain text or binary., (*3)
The CephClient class provides helper functions to communicate with the API. The CallWrapper uses the CephClient., (*4)
Nothing prevents you from calling the client directly., (*5)
Contributors:, (*6)
Thanks to David Moreau Simard, who is an author of python-cephclient, which was our inspiration on creating php-cephclient library., (*7)
Want to contribute ? Feel free to send pull requests!, (*8)
Have problems, bugs, feature ideas? We are using the github issue tracker to manage them., (*9)
Install the package through composer::, (*10)
php composer.phar require octivi/php-cephclient:*
Instanciate CephClient:, (*11)
use Octivi\CephClient\Client\CephClient; $url = 'http://10.20.51.201:5000/api/v0.1/'; $cephClient = new CephClient($url);
Optional with authentication:, (*12)
use Octivi\CephClient\Client\CephClient;
$url = 'http://10.20.51.201:5000/api/v0.1/';
$cephClient = new CephClient($url);
$cephClient->useAuth('name', 'password');
Do your request., (*13)
$response = $cephClient->getRoot()->fsId();
Response example:, (*14)
object(stdClass)[91]
public 'status' => string 'OK' (length=2)
public 'output' =>
object(stdClass)[109]
public 'fsid' => string '60d98352-115b-4ca1-a51b-414d98492168' (length=36)
You can set your CephClient to return json respons by setting debug parametr as true, (*15)
new CephClient($url, true);
Response example:, (*16)
{
"status": "OK",
"output": {
"fsid": "d5252e7d-75bc-4083-85ed-fe51fa83f62b"
}
}
Optional possibility: After geting your response you can draw info about the call:, (*17)
$cephClient->root->fsId(); $cephClient->getInfo();
Info example:, (*18)
array (size=26)
'url' => string 'http://10.20.51.201:5000/api/v0.1/fsid' (length=38)
'content_type' => string 'application/json' (length=16)
'http_code' => int 200
'header_size' => int 145
'request_size' => int 148
'filetime' => int -1
'ssl_verify_result' => int 0
'redirect_count' => int 0
'total_time' => float 0.015
'namelookup_time' => float 0
'connect_time' => float 0
'pretransfer_time' => float 0
'size_upload' => float 0
'size_download' => float 76
'speed_download' => float 5066
'speed_upload' => float 0
'download_content_length' => float 76
'upload_content_length' => float 0
'starttransfer_time' => float 0.015
'redirect_time' => float 0
'certinfo' =>
array (size=0)
empty
'primary_ip' => string '10.20.51.201' (length=12)
'primary_port' => int 5000
'local_ip' => string '10.20.52.231' (length=12)
'local_port' => int 52062
'redirect_url' => string '' (length=0)
Read more: cephClient calls group and functions, (*19)
0.1.0, (*20)
PHP library to communicate with Ceph's REST API
MIT
client ceph php-cephclient cephclient