]> git.proxmox.com Git - ceph.git/blame - ceph/examples/boto3/delete_notification.py
buildsys: change download over to reef release
[ceph.git] / ceph / examples / boto3 / delete_notification.py
CommitLineData
9f95a23c
TL
1#!/usr/bin/python
2
3import boto3
4import sys
5
6if len(sys.argv) == 3:
7 # bucket name as first argument
8 bucketname = sys.argv[1]
9 # notification name as second argument
10 notification_name = sys.argv[2]
11elif len(sys.argv) == 2:
12 # bucket name as first argument
13 bucketname = sys.argv[1]
14 notification_name = ""
15else:
f67539c2 16 print('Usage: ' + sys.argv[0] + ' <bucket> [notification]')
9f95a23c
TL
17 sys.exit(1)
18
19# endpoint and keys from vstart
20endpoint = 'http://127.0.0.1:8000'
21access_key='0555b35654ad1656d804'
22secret_key='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
23
24client = boto3.client('s3',
25 endpoint_url=endpoint,
26 aws_access_key_id=access_key,
27 aws_secret_access_key=secret_key)
28
20effc67 29# deleting a specific notification configuration from a bucket (when NotificationId is provided) or
9f95a23c
TL
30# deleting all notification configurations on a bucket (without deleting the bucket itself) are extension to AWS S3 API
31
32if notification_name == "":
f67539c2 33 print(client.delete_bucket_notification_configuration(Bucket=bucketname))
9f95a23c 34else:
f67539c2
TL
35 print(client.delete_bucket_notification_configuration(Bucket=bucketname,
36 Notification=notification_name))