Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #include <iostream>
  2. using std::cerr;
  3. using std::cout;
  4. using std::endl;
  5.  
  6. #include <string>
  7. using std::string;
  8. #include <array>
  9. using std::array;
  10.  
  11. #include <aws/core/client/ClientConfiguration.h>
  12. #include <aws/s3/S3Client.h>
  13. #include <aws/s3/model/PutObjectRequest.h>
  14. #include <aws/core/utils/memory/stl/AWSStringStream.h>
  15.  
  16. #include <aws/transfer/TransferClient.h>
  17. #include <aws/transfer/UploadFileRequest.h>
  18. using Aws::Transfer::UploadFileRequest;
  19.  
  20. int main(int argc, const char* argv[]) {
  21. static const char* ALLOCATION_TAG = "RedSink";
  22.  
  23. Aws::Client::ClientConfiguration config;
  24. config.region = Aws::Region::EU_WEST_1;
  25.  
  26. auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(ALLOCATION_TAG, config);
  27.  
  28. Aws::Transfer::TransferClientConfiguration transferConfig;
  29. transferConfig.m_uploadBufferCount = 1;
  30. auto transferClient = Aws::MakeShared<Aws::Transfer::TransferClient>(ALLOCATION_TAG, s3Client, transferConfig);
  31.  
  32. array<string, 16> outFilenames = {
  33. "0.bin",
  34. "1.bin",
  35. "2.bin",
  36. "3.bin",
  37. "4.bin",
  38. "5.bin",
  39. "6.bin",
  40. "7.bin",
  41. "8.bin",
  42. "9.bin",
  43. "10.bin",
  44. "11.bin",
  45. "12.bin",
  46. "13.bin",
  47. "14.bin",
  48. "15.bin",
  49. };
  50.  
  51. for (const auto& fn : outFilenames) {
  52. cerr << "uploading " << fn << "..." << endl;
  53.  
  54. auto req = transferClient->UploadFile(fn, "aws-sdk-test-bucket", fn, "application/octet-stream");
  55. req->WaitUntilDone();
  56.  
  57. if (req->CompletedSuccessfully()) {
  58. cerr << "OK" << endl;
  59. } else {
  60. cerr << "FAILED!" << endl;
  61. cerr << req->GetFailure() << endl;
  62. exit(1);
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement