mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 03:12:43 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
58 lines
910 B
C++
58 lines
910 B
C++
#pragma once
|
|
|
|
#include <Common/config.h>
|
|
|
|
#if USE_AWS_S3
|
|
|
|
#include <Core/Types.h>
|
|
#include <Poco/URI.h>
|
|
#include <aws/core/Aws.h>
|
|
|
|
namespace Aws::S3
|
|
{
|
|
class S3Client;
|
|
}
|
|
|
|
namespace DB::S3
|
|
{
|
|
|
|
class ClientFactory
|
|
{
|
|
public:
|
|
~ClientFactory();
|
|
|
|
static ClientFactory & instance();
|
|
|
|
std::shared_ptr<Aws::S3::S3Client> create(const String & endpoint,
|
|
const String & access_key_id,
|
|
const String & secret_access_key);
|
|
|
|
private:
|
|
ClientFactory();
|
|
|
|
private:
|
|
Aws::SDKOptions aws_options;
|
|
};
|
|
|
|
/**
|
|
* Represents S3 URI.
|
|
*
|
|
* The following patterns are allowed:
|
|
* s3://bucket/key
|
|
* http(s)://endpoint/bucket/key
|
|
*/
|
|
struct URI
|
|
{
|
|
Poco::URI uri;
|
|
// Custom endpoint if URI scheme is not S3.
|
|
String endpoint;
|
|
String bucket;
|
|
String key;
|
|
|
|
explicit URI(const Poco::URI & uri_);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|