Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cerr;
- using std::cout;
- using std::endl;
- #include <string>
- using std::string;
- #include <array>
- using std::array;
- #include <aws/core/client/ClientConfiguration.h>
- #include <aws/s3/S3Client.h>
- #include <aws/s3/model/PutObjectRequest.h>
- #include <aws/core/utils/memory/stl/AWSStringStream.h>
- #include <aws/transfer/TransferClient.h>
- #include <aws/transfer/UploadFileRequest.h>
- using Aws::Transfer::UploadFileRequest;
- int main(int argc, const char* argv[]) {
- static const char* ALLOCATION_TAG = "RedSink";
- Aws::Client::ClientConfiguration config;
- config.region = Aws::Region::EU_WEST_1;
- auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(ALLOCATION_TAG, config);
- Aws::Transfer::TransferClientConfiguration transferConfig;
- transferConfig.m_uploadBufferCount = 1;
- auto transferClient = Aws::MakeShared<Aws::Transfer::TransferClient>(ALLOCATION_TAG, s3Client, transferConfig);
- array<string, 16> outFilenames = {
- "0.bin",
- "1.bin",
- "2.bin",
- "3.bin",
- "4.bin",
- "5.bin",
- "6.bin",
- "7.bin",
- "8.bin",
- "9.bin",
- "10.bin",
- "11.bin",
- "12.bin",
- "13.bin",
- "14.bin",
- "15.bin",
- };
- for (const auto& fn : outFilenames) {
- cerr << "uploading " << fn << "..." << endl;
- auto req = transferClient->UploadFile(fn, "aws-sdk-test-bucket", fn, "application/octet-stream");
- req->WaitUntilDone();
- if (req->CompletedSuccessfully()) {
- cerr << "OK" << endl;
- } else {
- cerr << "FAILED!" << endl;
- cerr << req->GetFailure() << endl;
- exit(1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement