1919
2020#pragma once
2121
22+ #include < memory>
2223#include < optional>
2324#include < string>
2425#include < unordered_map>
2526#include < vector>
2627
2728#include " iceberg/catalog/rest/iceberg_rest_export.h"
2829#include " iceberg/table_identifier.h"
29- #include " iceberg/table_metadata.h"
30+ #include " iceberg/type_fwd.h"
31+
32+ // / \file iceberg/catalog/rest/types.h
33+ // / Request and response types for Iceberg REST Catalog API.
3034
3135namespace iceberg ::rest {
3236
37+ // / \brief Request to create a namespace.
38+ struct ICEBERG_REST_EXPORT CreateNamespaceRequest {
39+ Namespace namespace_; // required
40+ std::unordered_map<std::string, std::string> properties;
41+ };
42+
43+ // / \brief Update or delete namespace properties request.
44+ struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesRequest {
45+ std::vector<std::string> removals;
46+ std::unordered_map<std::string, std::string> updates;
47+ };
48+
49+ // / \brief Request to create a table.
50+ struct ICEBERG_REST_EXPORT CreateTableRequest {
51+ std::string name; // required
52+ std::string location;
53+ std::shared_ptr<Schema> schema; // required
54+ std::shared_ptr<PartitionSpec> partition_spec;
55+ std::shared_ptr<SortOrder> write_order;
56+ std::optional<bool > stage_create;
57+ std::unordered_map<std::string, std::string> properties;
58+ };
59+
60+ // / \brief Request to register a table.
61+ struct ICEBERG_REST_EXPORT RegisterTableRequest {
62+ std::string name; // required
63+ std::string metadata_location; // required
64+ bool overwrite = false ;
65+ };
66+
67+ // / \brief Request to rename a table.
68+ struct ICEBERG_REST_EXPORT RenameTableRequest {
69+ TableIdentifier source; // required
70+ TableIdentifier destination; // required
71+ };
72+
3373// / \brief An opaque token that allows clients to make use of pagination for list APIs.
3474using PageToken = std::string;
3575
3676// / \brief Result body for table create/load/register APIs.
37- // / \details Matches **components/schemas/LoadTableResult** in the REST spec.
3877struct ICEBERG_REST_EXPORT LoadTableResult {
3978 std::optional<std::string> metadata_location;
40- TableMetadata metadata; // required
79+ std::shared_ptr< TableMetadata> metadata; // required // required
4180 std::unordered_map<std::string, std::string> config;
42- // TODO(Li Feiyang): Add std::vector <StorageCredential> storage_credentials ;
81+ // TODO(Li Feiyang): Add std::shared_ptr <StorageCredential> storage_credential ;
4382};
4483
4584// / \brief Alias of LoadTableResult used as the body of CreateTableResponse
@@ -48,42 +87,34 @@ using CreateTableResponse = LoadTableResult;
4887// / \brief Alias of LoadTableResult used as the body of LoadTableResponse
4988using LoadTableResponse = LoadTableResult;
5089
51- // / \brief Alias of LoadTableResult used as the body of RegisterTableResponse
52- using RegisterTableResponse = LoadTableResult;
53-
5490// / \brief Response body for listing namespaces.
55- // / Contains all namespaces and an optional pagination token.
5691struct ICEBERG_REST_EXPORT ListNamespacesResponse {
57- std::optional< PageToken> next_page_token;
92+ PageToken next_page_token;
5893 std::vector<Namespace> namespaces;
5994};
6095
6196// / \brief Response body after creating a namespace.
62- // / \details Contains the created namespace and its resolved properties.
6397struct ICEBERG_REST_EXPORT CreateNamespaceResponse {
6498 Namespace namespace_; // required
6599 std::unordered_map<std::string, std::string> properties;
66100};
67101
68102// / \brief Response body for loading namespace properties.
69- // / \details Contains stored properties, may be null if unsupported by the server.
70103struct ICEBERG_REST_EXPORT GetNamespaceResponse {
71104 Namespace namespace_; // required
72105 std::unordered_map<std::string, std::string> properties;
73106};
74107
75108// / \brief Response body after updating namespace properties.
76- // / \details Lists keys that were updated, removed, or missing.
77109struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse {
78110 std::vector<std::string> updated; // required
79111 std::vector<std::string> removed; // required
80112 std::vector<std::string> missing;
81113};
82114
83115// / \brief Response body for listing tables in a namespace.
84- // / \details Contains all table identifiers and an optional pagination token.
85116struct ICEBERG_REST_EXPORT ListTablesResponse {
86- std::optional< PageToken> next_page_token;
117+ PageToken next_page_token;
87118 std::vector<TableIdentifier> identifiers;
88119};
89120
0 commit comments