Project

General

Profile

Bug #38758 » rgw_lifecycle_prefix_reproducer.py

python reproducer - Konstantin Shalygin, 03/15/2019 09:19 AM

 
#!/usr/bin/python
# -*- coding: utf-8 -*-

# https://github.com/boto/boto3
import boto3
import botocore

def main():
global s3
s3 = boto3.client(service_name='s3', endpoint_url='https://rgw_civetweb',
aws_access_key_id='abc',
aws_secret_access_key='xyz')

put_bucket_lifecycle('bucket')

def put_bucket_lifecycle(bucket):
try:
s3.put_bucket_lifecycle_configuration(
Bucket=bucket,
LifecycleConfiguration={
"Rules": [
{
"Expiration": {
"Days": 2
},
"Status": "Enabled"
}
]
})
except botocore.exceptions.ClientError as e:
print("Code: {0}\nError: {1}".format(
e.response['ResponseMetadata']['HTTPStatusCode'], e))

if __name__ == "__main__":
main()
(4-4/4)