File size: 1,788 Bytes
2abfccb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/s3/model/ListObjectsRequest.h>
#include <aws/s3/model/Object.h>
#include <aws/s3/S3Client.h>
#include <aws/core/Aws.h>
#include <chrono>
#include <list>
#include <vector>
#include <string>
#include <fstream>
#include <aws/s3/model/CompletedPart.h>
#include <aws/transfer/TransferManager.h>
class S3Client
{
public:
S3Client(const std::string &ak, const std::string &sk, const std::string &endpoint, bool verify_ssl, bool enable_https, bool use_dual_stack, int threads_num);
~S3Client();
int get_object(const std::string &bucket, const std::string &key, int &error_type, std::string &error_message, std::string &result, std::string &range);
int multipart_download_concurrency(const std::string &bucket, const std::string &key, const std::string &filename, int &error_type, std::string &error_message);
int put_object(const std::string &bucket, const std::string &key, const std::string &data, int &error_type, std::string &error_message);
int multipart_upload_concurrency(const std::string bucket, const std::string key, const std::string filename, int &error_type, std::string &error_message);
int delete_obj(const std::string &bucket, const std::string &key, int error_type, std::string &error_message);
int contains(const std::string &bucket, const std::string &key, int error_type, std::string &error_message);
std::vector<std::string> list(const std::string &bucket, const std::string &key, int error_type, std::string &error_message);
private:
std::shared_ptr<Aws::S3::S3Client> client;
int threads_num;
};
void init_api(const std::string &level);
void shutdown_api();
std::list<std::pair<int, std::string>> get_error_list();
|