Request to S3, v2 API.
$result = $client->getBucketLifecycleConfiguration(array(
// Bucket is required
'Bucket' => 'string',
));
I get the following response
Guzzle\Service\Resource\Model::__set_state(array(
'structure' => NULL,
'data' =>
array (
'Rules' =>
array (
0 =>
array (
'ID' => 'Test',
'Filter' =>
array (
'Prefix' =>
array (
),
),
'Status' => 'Enabled',
'NoncurrentVersionExpiration' =>
array (
'NoncurrentDays' => '250',
),
),
),
'RequestId' => 'E83571AFC306FFFD',
),
))
I want to parse this object!
Tried to get data like following $result->data
got NULL
I tried to typecast it to array but got the following array index. it seems I am doing it wrong.
array (
'' . "\0" . '*' . "\0" . 'structure' => NULL,
'' . "\0" . '*' . "\0" . 'data' =>
array (
'Rules' =>
array (
0 =>
array (
'ID' => 'Test',
'Filter' =>
array (
'Prefix' =>
array (
),
),
'Status' => 'Enabled',
'NoncurrentVersionExpiration' =>
array (
'NoncurrentDays' => '250',
),
),
),
'RequestId' => 'E83571AFC306FFFD',
),
)
Take a look at http://docs.aws.amazon.com/aws-sdk-php/v2/guide/feature-models.html
According to link, you can convert the Model to array using $result->toArray()
method or access directly the result attribute you want through array keys, i.e. $result['Rules']
.