]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | # Introduction |
2 | This directory contains examples on how to use AWS CLI/boto3 to exercise the RadosGW extensions to the S3 API. | |
3 | This is an extension to the [AWS SDK](https://github.com/boto/botocore/blob/develop/botocore/data/s3/2006-03-01/service-2.json). | |
4 | ||
5 | # Users | |
6 | 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. | |
7 | For more information see [here](https://github.com/boto/botocore/blob/develop/botocore/loaders.py#L33). | |
8 | ## Python | |
9 | The [boto3 client](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html) could be used with the extensions, code samples exists in this directory. | |
10 | ## AWS CLI | |
11 | The standard [AWS CLI](https://docs.aws.amazon.com/cli/latest/) may also be used with these extensions. For example: | |
12 | - Unordered listing: | |
13 | ``` | |
14 | aws --endpoint-url http://localhost:8000 s3api list-objects --bucket=mybucket --allow-unordered | |
15 | ``` | |
f67539c2 | 16 | |
f67539c2 TL |
17 | - Topic creation with endpoint: |
18 | ``` | |
19 | aws --endpoint-url http://localhost:8000 sns create-topic --name=mytopic --attributes='{"push-endpoint": "amqp://localhost:5672", "amqp-exchange": "ex1", "amqp-ack-level": "broker"}' | |
20 | ``` | |
21 | Expected output: | |
22 | ``` | |
23 | { | |
24 | "TopicArn": "arn:aws:sns:default::mytopic" | |
25 | } | |
26 | ``` | |
27 | ||
28 | - Get topic attributes: | |
9f95a23c | 29 | ``` |
f67539c2 TL |
30 | aws --endpoint-url http://localhost:8000 sns get-topic-attributes --topic-arn="arn:aws:sns:default::mytopic" |
31 | ``` | |
32 | Expected output: | |
33 | ``` | |
34 | { | |
35 | "Attributes": { | |
36 | "User": "", | |
37 | "Name": "mytopic", | |
38 | "EndPoint": "{\"EndpointAddress\":\"amqp://localhost:5672\",\"EndpointArgs\":\"Attributes.entry.1.key=push-endpoint&Attributes.entry.1.value=amqp://localhost:5672&Attributes.entry.2.key=amqp-exchange&Attributes.entry.2.value=ex1&Attributes.entry.3.key=amqp-ack-level&Attributes.entry.3.value=broker&Version=2010-03-31&amqp-ack-level=broker&amqp-exchange=ex1&push-endpoint=amqp://localhost:5672\",\"EndpointTopic\":\"mytopic\",\"HasStoredSecret\":\"false\",\"Persistent\":\"false\"}", | |
39 | "TopicArn": "arn:aws:sns:default::mytopic", | |
40 | "OpaqueData": "" | |
41 | } | |
42 | } | |
43 | ``` | |
44 | ||
45 | - Bucket notifications with filtering extensions (bucket must exist before calling this command): | |
46 | ``` | |
47 | 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]+)"}]}}}]}' | |
48 | ``` | |
49 | ||
9f95a23c TL |
50 | - Get configuration of a specific notification of a bucket: |
51 | ``` | |
52 | aws --endpoint-url http://localhost:8000 s3api get-bucket-notification-configuration --bucket=mybucket --notification=notif1 | |
53 | ``` | |
f67539c2 TL |
54 | Expected output: |
55 | ``` | |
56 | { | |
57 | "TopicConfigurations": [ | |
58 | { | |
59 | "Id": "notif1", | |
60 | "TopicArn": "arn:aws:sns:default::mytopic", | |
61 | "Events": [ | |
62 | "s3:ObjectCreated:*", | |
63 | "s3:ObjectRemoved:*" | |
64 | ], | |
65 | "Filter": { | |
66 | "Key": { | |
67 | "FilterRules": [ | |
68 | { | |
69 | "Name": "regex", | |
70 | "Value": "([a-z]+)" | |
71 | } | |
72 | ] | |
73 | }, | |
74 | "Metadata": { | |
75 | "FilterRules": [ | |
76 | { | |
77 | "Name": "x-amz-meta-foo", | |
78 | "Value": "bar" | |
79 | }, | |
80 | { | |
81 | "Name": "x-amz-meta-hello", | |
82 | "Value": "world" | |
83 | } | |
84 | ] | |
85 | } | |
86 | } | |
87 | } | |
88 | ] | |
89 | } | |
90 | ``` | |
9f95a23c TL |
91 | |
92 | # Developers | |
93 | 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. | |
94 | In addition, python files with code samples should be added to this directory demonstrating use of the new API. | |
95 | When testing you changes please: | |
96 | - make sure that the modified file is in the boto3 path as explained above | |
97 | - make sure that the standard S3 tests suit is not broken, even with the extensions files in the path | |
98 |