1#pragma once
2
3#include <Common/config.h>
4
5#if USE_AWS_S3
6
7#include <Core/Types.h>
8#include <Poco/URI.h>
9#include <aws/core/Aws.h>
10
11namespace Aws::S3
12{
13 class S3Client;
14}
15
16namespace DB::S3
17{
18
19class ClientFactory
20{
21public:
22 ~ClientFactory();
23
24 static ClientFactory & instance();
25
26 std::shared_ptr<Aws::S3::S3Client> create(const String & endpoint,
27 const String & access_key_id,
28 const String & secret_access_key);
29
30private:
31 ClientFactory();
32
33private:
34 Aws::SDKOptions aws_options;
35};
36
37/**
38 * Represents S3 URI.
39 *
40 * The following patterns are allowed:
41 * s3://bucket/key
42 * http(s)://endpoint/bucket/key
43 */
44struct URI
45{
46 Poco::URI uri;
47 // Custom endpoint if URI scheme is not S3.
48 String endpoint;
49 String bucket;
50 String key;
51
52 explicit URI (Poco::URI & uri_);
53};
54
55}
56
57#endif
58