-
Notifications
You must be signed in to change notification settings - Fork 28
/
ceph-delete-object.py
executable file
·41 lines (29 loc) · 1.08 KB
/
ceph-delete-object.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /usr/bin/env python3
import os
import sys
from argparse import ArgumentParser
import json
import boto3
with open('credentials.json', 'r') as fd:
credentials = json.loads(fd.read())
def main():
parser = ArgumentParser(description='Creates a bucket')
parser.add_argument('--bucket-name',
dest='bucket_name',
action='store',
required=True,
help='the name of the bucket to create')
parser.add_argument('--key-name',
dest='key_name',
action='store',
required=True,
help='the objects key name name')
args = parser.parse_args()
s3 = boto3.client('s3',
endpoint_url=credentials['endpoint_url'],
aws_access_key_id=credentials['access_key'],
aws_secret_access_key=credentials['secret_key'])
s3.delete_object(Bucket=args.bucket_name,
Key=args.key_name)
if __name__ == '__main__':
main()