mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 21:57:57 +03:00
28 lines
630 B
C++
28 lines
630 B
C++
![]() |
#include "AmazonS3Utils.h"
|
||
|
|
||
|
ListObjectsResult AmazonS3Utils::GetListObjects(std::string accessKeyId, std::string secretAccessKey, std::string bucketName)
|
||
|
{
|
||
|
std::string bucketRegion;
|
||
|
|
||
|
//Obtain bucket region
|
||
|
try
|
||
|
{
|
||
|
{
|
||
|
CAmazonS3Client client(accessKeyId, secretAccessKey);
|
||
|
|
||
|
GetBucketLocationRequest request;
|
||
|
request.bucket = bucketName;
|
||
|
|
||
|
auto result = client.GetBucketLocation(request);
|
||
|
bucketRegion = result.locationConstraint;
|
||
|
}
|
||
|
|
||
|
//List objects
|
||
|
CAmazonS3Client client(accessKeyId, secretAccessKey, bucketRegion);
|
||
|
return client.ListObjects(bucketName);
|
||
|
}
|
||
|
catch(...)
|
||
|
{
|
||
|
return ListObjectsResult();
|
||
|
}
|
||
|
}
|