Turi Create  4.0
get_s3_endpoint.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_FILEIO_GET_S3_ENDPOINT_HPP
7 #define TURI_FILEIO_GET_S3_ENDPOINT_HPP
8 #include <vector>
9 #include <string>
10 #include <boost/optional/optional.hpp>
11 
12 namespace turi {
13 namespace fileio {
14 /**
15  * \ingroup fileio
16  * Returns a complete list of all available S3 region-specific endpoints.
17  */
18 std::vector<std::string> get_s3_endpoints();
19 
20 
21 /**
22  * set by env var AWS_DEFAULT_REGION or TURI_S3_REGION
23  */
24 boost::optional<std::string> get_auth_region_from_env();
25 
26 /**
27  * set by env var TURI_S3_ENDPOINT
28  */
29 boost::optional<std::string> get_endpoint_from_env();
30 
31 /**
32  * \ingroup fileio
33  * Get an region name from the endpoint url.
34  */
35 std::string get_region_name_from_endpoint(std::string endpoint);
36 
37 /**
38  * \ingroup fileio
39  * Returns a S3 bucket specific path. On regular S3 this returns the
40  * virtualhosting style bucket. On other explicitly specified endpoints,
41  * this returns $S3_ENDPOINT/[bucket]/
42  *
43  * For consistency, the returned bucket path will *always* end with a "/"
44  */
45 std::string get_bucket_path(const std::string& bucket);
46 
47 } // fileio
48 } // turi
49 #endif
std::string get_region_name_from_endpoint(std::string endpoint)
std::string get_bucket_path(const std::string &bucket)
std::vector< std::string > get_s3_endpoints()