]> git.proxmox.com Git - ceph.git/blob - ceph/examples/boto3/get_notification.py
import ceph 15.2.14
[ceph.git] / ceph / examples / boto3 / get_notification.py
1 #!/usr/bin/python
2
3 import boto3
4 import sys
5
6 if len(sys.argv) != 3:
7 print('Usage: ' + sys.argv[0] + ' <bucket> <notification>')
8 sys.exit(1)
9
10 # bucket name as first argument
11 bucketname = sys.argv[1]
12 # notification name as second argument
13 notification_name = sys.argv[2]
14
15 # endpoint and keys from vstart
16 endpoint = 'http://127.0.0.1:8000'
17 access_key='0555b35654ad1656d804'
18 secret_key='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
19
20 client = boto3.client('s3',
21 endpoint_url=endpoint,
22 aws_access_key_id=access_key,
23 aws_secret_access_key=secret_key)
24
25 # getting a specific notification configuration is an extension to AWS S3 API
26
27 print(client.get_bucket_notification_configuration(Bucket=bucketname,
28 Notification=notification_name))