⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
rgw
All Projects
Ceph
»
rgw
Overview
Activity
Roadmap
Issues
Spent time
Gantt
Download (951 Bytes)
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}
\n
Error: {1}
"
.
format
(
e
.
response
[
'
ResponseMetadata
'
][
'
HTTPStatusCode
'
],
e
))
if
__name__
==
"
__main__
"
:
main
()
« Previous
1
2
3
4
Next »
(4-4/4)
Loading...