https://github.com/valerytschopp/python-radosgw-admin
Ceph RADOS Gateway admin operations
https://github.com/valerytschopp/python-radosgw-admin
ceph ceph-radosgw pip python radosgw radosgwadmin rgw rgwadmin
Last synced: 4 months ago
JSON representation
Ceph RADOS Gateway admin operations
- Host: GitHub
- URL: https://github.com/valerytschopp/python-radosgw-admin
- Owner: valerytschopp
- License: gpl-3.0
- Created: 2013-10-11T14:49:17.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-10-07T08:49:08.000Z (over 5 years ago)
- Last Synced: 2025-10-21T19:55:30.099Z (8 months ago)
- Topics: ceph, ceph-radosgw, pip, python, radosgw, radosgwadmin, rgw, rgwadmin
- Language: Python
- Homepage:
- Size: 122 KB
- Stars: 37
- Watchers: 5
- Forks: 22
- Open Issues: 4
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
python-radosgw-admin
====================
Python REST API for the Ceph RADOS Gateway (radosgw) admin operations
http://docs.ceph.com/docs/master/radosgw/adminops/
**NOTICE:** The library support Ceph version >= 10.2 (Jewel).
Changes
-------
- Version 1.6: Support for Ceph Hammer or older have been dropped.
- Version 1.7: Functions ``get_buckets()`` and ``get_users()`` returns an iterator, not a list anymore.
- Version 1.7.1: Function ``get_uids()`` added.
- Version 1.7.2: Functions ``get_policy(bucket, object=None, ...)`` and ``delete_usage()`` added. Function ``set_quota(...)`` returns ``None``.
Requirement
-----------
- boto
Installation
------------
.. image:: https://img.shields.io/pypi/v/radosgw-admin.svg
:target: https://pypi.python.org/pypi/radosgw-admin
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 --caps "buckets=read,write"
radosgw-admin caps add --uid --caps "users=read,write"
Examples
--------
See the example in `examples/radosgw-admin-example.py `_
Here is a simple example:
.. code-block:: python
import radosgw
rgwadmin = radosgw.connection.RadosGWAdminConnection(host='hostname.example.org',
access_key='',
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)