2727
2828namespace iceberg ::rest {
2929
30- Result<std::unique_ptr<ResourcePaths>> ResourcePaths::Make (std::string base_uri,
31- const std::string& prefix) {
30+ Result<std::unique_ptr<ResourcePaths>> ResourcePaths::Make (
31+ std::string base_uri, const std::string& prefix,
32+ const std::string& namespace_separator) {
3233 if (base_uri.empty ()) {
3334 return InvalidArgument (" Base URI is empty" );
3435 }
35- return std::unique_ptr<ResourcePaths>(new ResourcePaths (std::move (base_uri), prefix));
36+ return std::unique_ptr<ResourcePaths>(
37+ new ResourcePaths (std::move (base_uri), prefix, namespace_separator));
3638}
3739
38- ResourcePaths::ResourcePaths (std::string base_uri, const std::string& prefix)
39- : base_uri_(std::move(base_uri)), prefix_(prefix.empty() ? " " : (prefix + " /" )) {}
40+ ResourcePaths::ResourcePaths (std::string base_uri, const std::string& prefix,
41+ std::string namespace_separator)
42+ : base_uri_(std::move(base_uri)),
43+ prefix_ (prefix.empty() ? "" : (prefix + " /" )),
44+ namespace_separator_(std::move(namespace_separator)) {}
4045
4146Result<std::string> ResourcePaths::Config () const {
4247 return std::format (" {}/v1/config" , base_uri_);
@@ -51,31 +56,36 @@ Result<std::string> ResourcePaths::Namespaces() const {
5156}
5257
5358Result<std::string> ResourcePaths::Namespace_ (const Namespace& ns) const {
54- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ns));
59+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
60+ EncodeNamespace (ns, namespace_separator_));
5561 return std::format (" {}/v1/{}namespaces/{}" , base_uri_, prefix_, encoded_namespace);
5662}
5763
5864Result<std::string> ResourcePaths::NamespaceProperties (const Namespace& ns) const {
59- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ns));
65+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
66+ EncodeNamespace (ns, namespace_separator_));
6067 return std::format (" {}/v1/{}namespaces/{}/properties" , base_uri_, prefix_,
6168 encoded_namespace);
6269}
6370
6471Result<std::string> ResourcePaths::Tables (const Namespace& ns) const {
65- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ns));
72+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
73+ EncodeNamespace (ns, namespace_separator_));
6674 return std::format (" {}/v1/{}namespaces/{}/tables" , base_uri_, prefix_,
6775 encoded_namespace);
6876}
6977
7078Result<std::string> ResourcePaths::Table (const TableIdentifier& ident) const {
71- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ident.ns ));
79+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
80+ EncodeNamespace (ident.ns , namespace_separator_));
7281 ICEBERG_ASSIGN_OR_RAISE (std::string encoded_table_name, EncodeString (ident.name ));
7382 return std::format (" {}/v1/{}namespaces/{}/tables/{}" , base_uri_, prefix_,
7483 encoded_namespace, encoded_table_name);
7584}
7685
7786Result<std::string> ResourcePaths::Register (const Namespace& ns) const {
78- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ns));
87+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
88+ EncodeNamespace (ns, namespace_separator_));
7989 return std::format (" {}/v1/{}namespaces/{}/register" , base_uri_, prefix_,
8090 encoded_namespace);
8191}
@@ -85,14 +95,16 @@ Result<std::string> ResourcePaths::Rename() const {
8595}
8696
8797Result<std::string> ResourcePaths::Metrics (const TableIdentifier& ident) const {
88- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ident.ns ));
98+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
99+ EncodeNamespace (ident.ns , namespace_separator_));
89100 ICEBERG_ASSIGN_OR_RAISE (std::string encoded_table_name, EncodeString (ident.name ));
90101 return std::format (" {}/v1/{}namespaces/{}/tables/{}/metrics" , base_uri_, prefix_,
91102 encoded_namespace, encoded_table_name);
92103}
93104
94105Result<std::string> ResourcePaths::Credentials (const TableIdentifier& ident) const {
95- ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace, EncodeNamespace (ident.ns ));
106+ ICEBERG_ASSIGN_OR_RAISE (std::string encoded_namespace,
107+ EncodeNamespace (ident.ns , namespace_separator_));
96108 ICEBERG_ASSIGN_OR_RAISE (std::string encoded_table_name, EncodeString (ident.name ));
97109 return std::format (" {}/v1/{}namespaces/{}/tables/{}/credentials" , base_uri_, prefix_,
98110 encoded_namespace, encoded_table_name);
0 commit comments