ceph/examples/boto3
Abhishek Lekshmanan c968f418de examples: add python source for append & get_usage_stats
Add some pythonic examples that can be reused

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
2020-02-26 10:27:10 +01:00
..
README.md rgw/pubsub: notification filtering by object tags 2019-12-15 14:20:41 +02:00
append_object.py examples: add python source for append & get_usage_stats 2020-02-26 10:27:10 +01:00
delete_notification.py
get_notification.py
get_usage_stats.py examples: add python source for append & get_usage_stats 2020-02-26 10:27:10 +01:00
list_unordered.py
notification_filters.py rgw/pubsub: notification filtering by object tags 2019-12-15 14:20:41 +02:00
service-2.sdk-extras.json eg: boto3 update doc urls to the latest 2020-02-25 19:16:27 +01:00
topic_with_endpoint.py

README.md

Introduction

This directory contains examples on how to use AWS CLI/boto3 to exercise the RadosGW extensions to the S3 API. This is an extension to the AWS SDK.

Users

For the standard client to support these extensions, the: service-2.sdk-extras.json file should be placed under: ~/.aws/models/s3/2006-03-01/ directory. For more information see here.

Python

The boto3 client could be used with the extensions, code samples exists in this directory.

AWS CLI

The standard AWS CLI may also be used with these extensions. For example:

  • Unordered listing:
aws --endpoint-url http://localhost:8000 s3api list-objects --bucket=mybucket --allow-unordered
  • Bucket notifications with filtering extensions:
aws --region=default --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration --bucket mybucket --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::mytopic",  
"Events": ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"],  
"Filter": {"Metadata": {"FilterRules": [{"Name": "x-amz-meta-foo", "Value": "bar"}, {"Name": "x-amz-meta-hello", "Value": "world"}]}, "Key": {"FilterRules": [{"Name": "regex", "Value": "([a-z]+)"}]}}}]}'
  • Get configuration of a specific notification of a bucket:
aws --endpoint-url http://localhost:8000 s3api get-bucket-notification-configuration --bucket=mybucket --notification=notif1

Developers

Anyone developing an extension to the S3 API supported by AWS, please modify service-2.sdk-extras.json (all extensions should go into the same file), so that boto3 could be used to test the new API. In addition, python files with code samples should be added to this directory demonstrating use of the new API. When testing you changes please:

  • make sure that the modified file is in the boto3 path as explained above
  • make sure that the standard S3 tests suit is not broken, even with the extensions files in the path