-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Open
Labels
BugAn update to fix incorrect code or typos.An update to fix incorrect code or typos.C++This issue relates to the AWS SDK for C++This issue relates to the AWS SDK for C++
Description
Expected behavior
just putobject
Actual behavior
1
Steps to reproduce
bool AWSS3Manager::putObject(const Aws::String &bucketName, const Aws::String &fileName)
{
Aws::S3::Model::PutObjectRequest request;
request.SetBucket(bucketName);
request.SetKey(fileName);
// std::shared_ptr<Aws::IOStream> inputData =
// Aws::MakeShared<Aws::FStream>("SampleAllocationTag",
// fileName.c_str(),
// std::ios_base::in | std::ios_base::binary);
// if (!*inputData)
// {
// std::cerr << "Error unable to read file " << fileName << std::endl;
// return false;
// }
// request.SetBody(inputData);
auto input_data = Aws::MakeShared<Aws::FStream>("PutObjectInputStream", fileName.c_str(), std::ios_base::in | std::ios_base::binary);
request.SetBody(input_data);
Aws::S3::Model::PutObjectOutcome outcome =
client->PutObject(request);
if (!outcome.IsSuccess())
{
std::cerr << "Error: putObject: " << outcome.GetError().GetMessage() << std::endl;
}
else
{
std::cout << "Added object '" << fileName << "' to bucket '"
<< bucketName << "'.";
}
return outcome.IsSuccess();
}Logs / stacktrace (if applicable)
Which SDK were you using?
C++
Which OS were you using?
Linux
SDK version
1.11.526
OS version
centos8
Metadata
Metadata
Assignees
Labels
BugAn update to fix incorrect code or typos.An update to fix incorrect code or typos.C++This issue relates to the AWS SDK for C++This issue relates to the AWS SDK for C++