]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add new sync-policy related params to boto3 extension 57391/head
authorSoumya Koduri <skoduri@redhat.com>
Fri, 10 May 2024 11:34:37 +0000 (17:04 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Mon, 13 May 2024 16:45:53 +0000 (22:15 +0530)
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
examples/rgw/boto3/put-bucket-replication.py [new file with mode: 0755]
examples/rgw/boto3/service-2.sdk-extras.json

diff --git a/examples/rgw/boto3/put-bucket-replication.py b/examples/rgw/boto3/put-bucket-replication.py
new file mode 100755 (executable)
index 0000000..efadd7c
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+
+from __future__ import print_function
+from botocore.client import Config
+from pprint import pprint
+
+import boto3
+import json
+
+
+# endpoint and keys from vstart
+endpoint = 'http://127.0.0.1:8101'
+access_key='0555b35654ad1656d804'
+secret_key='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
+
+client = boto3.client('s3',
+        endpoint_url=endpoint,
+        aws_access_key_id=access_key,
+        aws_secret_access_key=secret_key,
+        config=Config(parameter_validation=False))
+
+response = client.put_bucket_replication(
+    Bucket='sample-bucket',
+    ReplicationConfiguration={
+        'Role': '',
+        'Rules': [
+            {
+                'ID': 'sample-bucket-rule',
+                "Status": "Enabled",
+                "Filter" : { "Prefix": ""},
+                "Source": { "Zones": ["zg1-1"] },
+                "Destination": {"Zones": ["zg1-1", "zg1-2"], "Bucket": "*"}
+            }
+        ]
+    }
+)
+
+pprint(response)
+
index d660b6a024240960f9439bf31766b15dab617b33..46fef1abdbbe321ddc93229df03e53ce48e69bcf 100644 (file)
                 }
             }
         },
+        "ReplicationRule":{
+            "members":{
+               "Source": {
+                   "shape":"S3RepSource",
+                   "documentation":"<p>A container for information about the replication source.<p>",
+                   "locationName":"Source"
+               }
+           }
+       },
+       "S3RepSource": {
+           "type": "structure",
+           "members": {
+                "Zones": {
+                    "shape":"ZoneList",
+                    "documentation":"<p>Array of replication source zone names.</p>",
+                   "locationName":"Zone"
+                }
+            }
+        },
+       "Destination": {
+           "members": {
+                "Zones": {
+                    "shape":"ZoneList",
+                    "documentation":"<p>Array of replication destination zone names.</p>",
+                   "locationName":"Zone"
+                }
+            }
+        },
+       "ZoneList": {
+           "type":"list",
+           "member":{"shape":"Zone"},
+           "flattened":true
+       },
+        "Zone":{"type":"string"},
         "AllowUnordered":{"type":"boolean"},
         "PutObjectRequest": {
             "members": {