aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/ProxyConfigurationResolverProvider.h
blob: f8c0552bd8a86708494d8ebeb3247be7fe434de7 (plain) (blame)
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
40
#pragma once

#include <base/types.h>
#include <Poco/Util/AbstractConfiguration.h>
#include <Common/ProxyConfigurationResolver.h>

namespace DB
{


class ProxyConfigurationResolverProvider
{
public:

    using Protocol = ProxyConfiguration::Protocol;

    /*
     * Returns appropriate ProxyConfigurationResolver based on current CH settings (Remote resolver or List resolver).
     * If no configuration is found, returns Environment Resolver.
     * */
    static std::shared_ptr<ProxyConfigurationResolver> get(Protocol protocol);

    /*
     * This API exists exclusively for backward compatibility with old S3 storage specific proxy configuration.
     * If no configuration is found, returns nullptr.
     * */
    static std::shared_ptr<ProxyConfigurationResolver> getFromOldSettingsFormat(
        const String & config_prefix,
        const Poco::Util::AbstractConfiguration & configuration
    );

private:
    static std::shared_ptr<ProxyConfigurationResolver> getFromSettings(
        Protocol protocol,
        const String & config_prefix,
        const Poco::Util::AbstractConfiguration & configuration
    );
};

}