Xuanwo commented on PR #1861:
URL: 
https://github.com/apache/incubator-opendal/pull/1861#issuecomment-1500151628

   The s3 cpp sdk:
   
   ```cpp
   bool AwsDoc::S3::PutObject(const Aws::String &bucketName,
                              const Aws::String &fileName,
                              const Aws::Client::ClientConfiguration 
&clientConfig) {
       Aws::S3::S3Client s3_client(clientConfig);
   
       Aws::S3::Model::PutObjectRequest request;
       request.SetBucket(bucketName);
       //We are using the name of the file as the key for the object in the 
bucket.
       //However, this is just a string and can be set according to your 
retrieval needs.
       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);
   
       Aws::S3::Model::PutObjectOutcome outcome =
               s3_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();
   }
   ```
   
   Seems we do have to return `result` for every operation... :disappointed: 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to