This project provides a Flask-based API to interact with Ceph RGW's S3-compatible storage.
- List Buckets: Retrieve a list of all available buckets.
- Create Bucket: Create a new S3 bucket.
- Delete Bucket: Delete a specified bucket (including its objects).
- List Bucket Items: Retrieve all objects stored in all available buckets.
- Get Environment Variables: Retrieve the configured S3 credentials and endpoint.
- Retrieve Object Content: Fetch the content of a specified object.
- Python 3.8+
- Flask
- Boto3 (AWS SDK for Python)
- Ceph RGW configured with S3 API
git clone <repository_url>
cd <project_directory>pip install -r requirements.txtexport BUCKET_HOST="<Your_Ceph_RGW_Host>"
export BUCKET_PORT="<Your_Ceph_RGW_Port>"
export AWS_ACCESS_KEY_ID="<Your_AWS_Access_Key>"
export AWS_SECRET_ACCESS_KEY="<Your_AWS_Secret_Key>"python app.pyThe Flask application will start at http://127.0.0.1:5000/
- Endpoint:
GET /list_buckets - Example Response:
{
"buckets": ["bucket1", "bucket2", "bucket3"]
}- Endpoint:
POST /createBucket?name=<bucket_name> - Example Response:
{
"message": "Bucket '<bucket_name>' created successfully!"
}- Endpoint:
DELETE /deleteBucket?name=<bucket_name> - Example Response:
{
"message": "Bucket '<bucket_name>' deleted successfully!"
}- Endpoint:
GET /list_buckets_items - Example Response:
[
{
"bucket": "bucket1",
"name": "file1.txt",
"size": 1024,
"modified": "2024-02-24T12:00:00Z"
}
]- Endpoint:
GET /getEnv - Example Response:
{
"HOST": "your-host",
"PORT": "your-port",
"AccessKey": "your-access-key",
"AccessKey_Secrets": "your-secret-key"
}- Endpoint:
GET /get_object_content - Example Response:
{
"object_content": "data from the object"
}If you encounter the error:
ValueError: Invalid endpoint: http://"10.0.2.190":"30910"
Ensure your BUCKET_HOST and BUCKET_PORT environment variables are correctly formatted:
export BUCKET_HOST="10.0.2.190"
export BUCKET_PORT="30910"This project is licensed under the MIT License.