Re: Is there an api to list all s3 user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Php aws sdk with personal updates can do that.
First, you need a functionnal php_aws_sdk with your radosgw and an account (access/secret key) with metadata caps.

I use aws Version 2.8.22 :
$aws = Aws::factory('config.php');
$this->s3client = $aws->get('s3');
http://docs.aws.amazon.com/aws-sdk-php/v2/guide/configuration.html

Exemple of config.php file :
return array (
    'includes' => array('_aws'),
    'services' => array(
        // All AWS clients extend from 'default_settings'. Here we are
        // overriding 'default_settings' with our default credentials and
        // providing a default region setting.
        'default_settings' => array(
            'params' => array(
                'version' => 'latest',
                'region' => 'us-west-1',
                'endpoint' => HOST,
                'signature_version' => 'v2',
                'credentials' => array(
                        'key'    => AWS_KEY,
                        'secret' => AWS_SECRET_KEY,
                ),
                "bucket_endpoint" => false,
                'debug'   => true,
            )
        )
    )
);



And second, this is an example of my updates :

I add a new ServiceDescription to Guzzle :
$aws = Aws::factory(YOUR_PHP_RGW_CONFIG_FILE);
$this->s3client = $aws->get('s3');
$cephCommand = include __DIR__.'/ceph-services.php';
$description = new \Guzzle\Service\Description\ServiceDescription($cephCommand);
       
$default = \Guzzle\Service\Command\Factory\CompositeFactory::getDefaultChain($this->s3client);
$default->add(
    new \Guzzle\Service\Command\Factory\ServiceDescriptionFactory($description),
    'Guzzle\Service\Command\Factory\ServiceDescriptionFactory');

$this->s3client->setCommandFactory($default);


The ceph-services.php file contains :
return array(
        'apiVersion' => '2015-12-08',
        'serviceFullName' => 'Ceph Gateway',
        'serviceAbbreviation' => 'CEPH ULR',
        'serviceType' => 'rest-xml',
        'operations' => array(
                'ListAllUsers' => array(
                        'httpMethod' => 'GET',
                        'uri' => '/admin/metadata/user',
                        'class' => 'Aws\S3\Command\S3Command',
                        'responseClass' => 'ListAllUsersOutput',
                        'responseType' => 'model',
                        'parameters' => array(
                                'format' => array(
                                        'type' => 'string',
                                        'location' => 'query',
                                        'sentAs' => 'format',
                                        'require' => true,
                                        'default' => 'xml',
                                ),
                        ),
                ),
        ),
        'models' => array(
                'ListAllUsersOutput' => array(
                        'type' => 'object',
                        'additionalProperties' => true,
                        'properties' => array(
                                'Keys' => array(
                                        'type' => 'string',
                                        'location' => 'xml',
                                ),
                        ),
                ),
        )
);

Just call it by :
$result = $this->s3client->listAllUsers();

Good luck ...

Mikaël

Le 16/03/2016 07:51, Mika c a écrit :
Hi all,
Hi, I try to find an api that can list all s3 user like command 'radosgw-admin metadata list user'. 
But I can not find any document related. Have anyone know how to get this information?
Any comments will be much appreciated!
​​

Best wishes,
Mika
 

_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux