Project

General

Profile

Bug #38758 » rgw_lifecycle_prefix_reproducer.php

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

 
<?php

# https://github.com/aws/aws-sdk-php
require 'aws-sdk/aws-autoloader.php';

use Aws\S3\S3Client as S3Client;
use Aws\S3\Exception\S3Exception as S3Exception;

function main() {
$s3 = new S3Client(['region' => 'us-east-1', 'version' => 'latest',
'endpoint' => 'https://rgw_civetweb',
'use_path_style_endpoint' => true,
'signature_version' => 'v4',
'credentials' => [
'key' => 'abc',
'secret' => 'xyz',
],
]);

$s3_bucket = "bucket";

try {
$s3_set_bucket_lifecycle = $s3->putBucketLifecycleConfiguration([
"Bucket" => $s3_bucket,
"LifecycleConfiguration" => [
"Rules" => [
[
"Expiration" => [
"Days" => 2
],
"Status" => "Enabled"
],
],
],
]);

} catch (S3Exception $e) {
echo("Code: ".$e->getStatusCode()."\nError: ".$e->getAwsErrorCode());
}
}

main()

?>
(3-3/4)