|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include <optional> |
| 23 | +#include <string> |
| 24 | +#include <unordered_map> |
| 25 | +#include <vector> |
| 26 | + |
| 27 | +#include "iceberg/catalog/rest/iceberg_rest_export.h" |
| 28 | +#include "iceberg/table_identifier.h" |
| 29 | +#include "iceberg/table_metadata.h" |
| 30 | + |
| 31 | +namespace iceberg::rest { |
| 32 | + |
| 33 | +/// \brief An opaque token that allows clients to make use of pagination for list APIs. |
| 34 | +using PageToken = std::string; |
| 35 | + |
| 36 | +/// \brief Result body for table create/load/register APIs. |
| 37 | +/// \details Matches **components/schemas/LoadTableResult** in the REST spec. |
| 38 | +struct ICEBERG_REST_EXPORT LoadTableResult { |
| 39 | + std::optional<std::string> metadata_location; |
| 40 | + TableMetadata metadata; // required |
| 41 | + std::unordered_map<std::string, std::string> config; |
| 42 | + // TODO(Li Feiyang): Add std::vector<StorageCredential> storage_credentials; |
| 43 | +}; |
| 44 | + |
| 45 | +/// \brief Alias of LoadTableResult used as the body of CreateTableResponse |
| 46 | +using CreateTableResponse = LoadTableResult; |
| 47 | + |
| 48 | +/// \brief Alias of LoadTableResult used as the body of LoadTableResponse |
| 49 | +using LoadTableResponse = LoadTableResult; |
| 50 | + |
| 51 | +/// \brief Alias of LoadTableResult used as the body of RegisterTableResponse |
| 52 | +using RegisterTableResponse = LoadTableResult; |
| 53 | + |
| 54 | +/// \brief Response body for listing namespaces. |
| 55 | +/// Contains all namespaces and an optional pagination token. |
| 56 | +struct ICEBERG_REST_EXPORT ListNamespacesResponse { |
| 57 | + std::optional<PageToken> next_page_token; |
| 58 | + std::vector<Namespace> namespaces; |
| 59 | +}; |
| 60 | + |
| 61 | +/// \brief Response body after creating a namespace. |
| 62 | +/// \details Contains the created namespace and its resolved properties. |
| 63 | +struct ICEBERG_REST_EXPORT CreateNamespaceResponse { |
| 64 | + Namespace namespace_; // required |
| 65 | + std::unordered_map<std::string, std::string> properties; |
| 66 | +}; |
| 67 | + |
| 68 | +/// \brief Response body for loading namespace properties. |
| 69 | +/// \details Contains stored properties, may be null if unsupported by the server. |
| 70 | +struct ICEBERG_REST_EXPORT GetNamespaceResponse { |
| 71 | + Namespace namespace_; // required |
| 72 | + std::unordered_map<std::string, std::string> properties; |
| 73 | +}; |
| 74 | + |
| 75 | +/// \brief Response body after updating namespace properties. |
| 76 | +/// \details Lists keys that were updated, removed, or missing. |
| 77 | +struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse { |
| 78 | + std::vector<std::string> updated; // required |
| 79 | + std::vector<std::string> removed; // required |
| 80 | + std::vector<std::string> missing; |
| 81 | +}; |
| 82 | + |
| 83 | +/// \brief Response body for listing tables in a namespace. |
| 84 | +/// \details Contains all table identifiers and an optional pagination token. |
| 85 | +struct ICEBERG_REST_EXPORT ListTablesResponse { |
| 86 | + std::optional<PageToken> next_page_token; |
| 87 | + std::vector<TableIdentifier> identifiers; |
| 88 | +}; |
| 89 | + |
| 90 | +} // namespace iceberg::rest |
0 commit comments