Ceph RADOS Gateway admin operations REST API
Project description
Python REST API for the Ceph RADOS Gateway (radosgw) admin operations
http://docs.ceph.com/docs/master/radosgw/adminops/
Requirement
boto
Installation
The package is available on https://pypi.python.org/pypi/radosgw-admin. To install it use pip:
pip install radosgw-admin
Or clone this repository and install it locally:
python setup.py install
Configuration of the admin user
To create or modify a bucket/user in radosgw, the admin user require the following read,write capabilities (caps):
"caps": [ { "type": "buckets", "perm": "*" }, { "type": "usage", "perm": "read" }, { "type": "metadata", "perm": "read" }, { "type": "users", "perm": "*" } ]
You can use the radosgw-admin command to add capabilities to an existing user:
radosgw-admin caps add --uid <USER_ID> --caps "buckets=read,write" radosgw-admin caps add --uid <USER_ID> --caps "users=read,write"
Examples
See the example in examples/radosgw-admin-example.py
Here is a simple example:
import radosgw
rgwadmin = radosgw.connection.RadosGWAdminConnection(host='hostname.example.org',
access_key='<ADMIN_ACCESS_KEY>',
secret_key='<ADMIN_SECRET_KEY>')
# user operations
testuser2 = rgwadmin.create_user('testuser2',
display_name='A test user',
email='testuser2@example.org')
testuser2.update(display_name='Second test user', suspended=True)
testuser1 = rgwadmin.get_user('testuser1')
# bucket operations
buckets = rgwadmin.get_buckets()
for bucket in buckets:
print bucket
testuser1_buckets = testuser1.get_buckets()
for bucket in testuser1_buckets:
# transfer buckets to testuser2
rgwadmin.link_bucket(bucket.name, bucket.id, testuser2.id)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
radosgw-admin-1.3.0.tar.gz
(22.8 kB
view hashes)
Built Distribution
Close
Hashes for radosgw_admin-1.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4f089c117ce6cd576511729582a7c9e0d5cfc711711c4af6effb67b76778676 |
|
MD5 | 6e8f2790e9ebadb5083db8d70dbb128c |
|
BLAKE2b-256 | a92f3a6790b1ce83d52b1eab1cc6e6703dc074db70fec208a2a06f3371e3786c |