#pragma once #include #if USE_AWS_S3 #include #include #include #include #include namespace Aws::S3 { class S3Client; } namespace DB { class RemoteHostFilter; struct HttpHeader; using HeaderCollection = std::vector; } namespace DB::S3 { class ClientFactory { public: ~ClientFactory(); static ClientFactory & instance(); std::shared_ptr create( const String & endpoint, bool is_virtual_hosted_style, const String & access_key_id, const String & secret_access_key, bool use_environment_credentials, const RemoteHostFilter & remote_host_filter, unsigned int s3_max_redirects); std::shared_ptr create( const PocoHTTPClientConfiguration & cfg, bool is_virtual_hosted_style, const String & access_key_id, const String & secret_access_key, bool use_environment_credentials); std::shared_ptr create( const PocoHTTPClientConfiguration & cfg, bool is_virtual_hosted_style, const String & access_key_id, const String & secret_access_key, HeaderCollection headers, bool use_environment_credentials); PocoHTTPClientConfiguration createClientConfiguration( const RemoteHostFilter & remote_host_filter, unsigned int s3_max_redirects); 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; String storage_name; bool is_virtual_hosted_style; explicit URI(const Poco::URI & uri_); }; } #endif