27#include <unordered_map>
53ICEBERG_REST_EXPORT
Result<PlanStatus> PlanStatusFromString(std::string_view status_str);
57 std::unordered_map<std::string, std::string> defaults;
58 std::unordered_map<std::string, std::string> overrides;
59 std::vector<Endpoint> endpoints;
72 std::vector<std::string> stack;
76 if (message.empty() || type.empty()) {
77 return ValidationFailed(
"Invalid error response: missing required fields");
80 if (code < 400 || code > 600) {
81 return ValidationFailed(
82 "Invalid error response: code {} is out of range [400, 600]", code);
95 std::unordered_map<std::string, std::string> properties;
105 std::vector<std::string> removals;
106 std::unordered_map<std::string, std::string> updates;
110 for (
const auto& key : removals) {
111 if (updates.contains(key)) {
112 return ValidationFailed(
"Duplicate key to update and remove: {}", key);
124 std::string metadata_location;
125 bool overwrite =
false;
130 return ValidationFailed(
"Missing table name");
133 if (metadata_location.empty()) {
134 return ValidationFailed(
"Empty metadata location");
150 ICEBERG_RETURN_UNEXPECTED(source.Validate());
151 ICEBERG_RETURN_UNEXPECTED(destination.
Validate());
161 std::string location;
162 std::shared_ptr<Schema> schema;
163 std::shared_ptr<PartitionSpec> partition_spec;
164 std::shared_ptr<SortOrder> write_order;
165 bool stage_create =
false;
166 std::unordered_map<std::string, std::string> properties;
171 return ValidationFailed(
"Missing table name");
174 return ValidationFailed(
"Missing schema");
187 std::string metadata_location;
188 std::shared_ptr<TableMetadata> metadata;
189 std::unordered_map<std::string, std::string> config;
198 return ValidationFailed(
"Invalid metadata: null");
200 for (
const auto& credential : storage_credentials) {
201 ICEBERG_RETURN_UNEXPECTED(credential.Validate());
217 std::vector<StorageCredential> storage_credentials;
221 for (
const auto& credential : storage_credentials) {
222 ICEBERG_RETURN_UNEXPECTED(credential.Validate());
233 std::vector<Namespace> namespaces;
244 std::unordered_map<std::string, std::string> properties;
255 std::unordered_map<std::string, std::string> properties;
265 std::vector<std::string> updated;
266 std::vector<std::string> removed;
267 std::vector<std::string> missing;
278 std::vector<TableIdentifier> identifiers;
289 std::vector<std::shared_ptr<TableRequirement>> requirements;
290 std::vector<std::shared_ptr<TableUpdate>> updates;
300 std::string metadata_location;
301 std::shared_ptr<TableMetadata> metadata;
305 if (metadata_location.empty()) {
306 return ValidationFailed(
"Invalid metadata location: empty");
309 return ValidationFailed(
"Invalid metadata: null");
319 std::string access_token;
320 std::string token_type;
321 std::optional<int64_t> expires_in_secs;
322 std::string issued_token_type;
323 std::string refresh_token;
334 std::optional<int64_t> snapshot_id;
335 std::vector<std::string> select;
336 std::shared_ptr<Expression> filter;
337 bool case_sensitive =
true;
338 bool use_snapshot_schema =
false;
339 std::optional<int64_t> start_snapshot_id;
340 std::optional<int64_t> end_snapshot_id;
341 std::vector<std::string> stats_fields;
342 std::optional<int64_t> min_rows_requested;
352 std::optional<std::vector<std::string>> plan_tasks;
353 std::optional<std::vector<std::shared_ptr<FileScanTask>>> file_scan_tasks;
354 std::vector<std::shared_ptr<DataFile>> delete_files;
355 PlanStatus plan_status = PlanStatus::kCompleted;
357 std::optional<ErrorResponse> error;
358 std::vector<StorageCredential> storage_credentials;
368 std::optional<std::vector<std::string>> plan_tasks;
369 std::optional<std::vector<std::shared_ptr<FileScanTask>>> file_scan_tasks;
370 std::vector<std::shared_ptr<DataFile>> delete_files;
371 PlanStatus plan_status = PlanStatus::kCompleted;
372 std::optional<ErrorResponse> error;
373 std::vector<StorageCredential> storage_credentials;
382 std::string planTask;
391 std::optional<std::vector<std::string>> plan_tasks;
392 std::optional<std::vector<std::shared_ptr<FileScanTask>>> file_scan_tasks;
393 std::vector<std::shared_ptr<DataFile>> delete_files;
Definition expected.h:1199
Define symbol visibility macros for the REST catalog library.
Catalog-provided labels for tables and their fields.
Define common Iceberg utility macros.
REST catalog APIs.
Definition auth_manager.h:34
constexpr std::string_view ToString(HttpMethod method)
Convert HttpMethod to string representation.
Definition http_request.h:41
std::string PageToken
An opaque token that allows clients to make use of pagination for list APIs.
Definition types.h:183
PlanStatus
Status of a REST server-side scan planning operation.
Definition types.h:45
Define Result, Status, and error helpers.
Define storage credential metadata.
Optional catalog-provided labels returned when a table is loaded.
Definition labels.h:46
A namespace in a catalog.
Definition table_identifier.h:35
Identifies a table in iceberg catalog.
Definition table_identifier.h:46
Status Validate() const
Validates the TableIdentifier.
Definition table_identifier.h:55
Server-provided configuration for the catalog.
Definition types.h:56
Status Validate() const
Validates the CatalogConfig.
Definition types.h:62
Request to commit changes to a table.
Definition types.h:287
Status Validate() const
Validates the CommitTableRequest.
Definition types.h:293
Response from committing changes to a table.
Definition types.h:299
Status Validate() const
Validates the CommitTableResponse.
Definition types.h:304
Request to create a namespace.
Definition types.h:93
Status Validate() const
Validates the CreateNamespaceRequest.
Definition types.h:98
Response body after creating a namespace.
Definition types.h:242
Status Validate() const
Validates the CreateNamespaceResponse.
Definition types.h:247
Request to create a table.
Definition types.h:159
Status Validate() const
Validates the CreateTableRequest.
Definition types.h:169
JSON error payload returned in a response with further details on the error.
Definition types.h:68
Status Validate() const
Validates the ErrorResponse.
Definition types.h:75
Response from polling an asynchronous scan plan, including current status and available scan tasks.
Definition types.h:367
Request to fetch the scan tasks for a given plan task token.
Definition types.h:381
Response containing the file scan tasks for a given plan task token.
Definition types.h:390
Response body for loading namespace properties.
Definition types.h:253
Status Validate() const
Validates the GetNamespaceResponse.
Definition types.h:258
Response body for listing namespaces.
Definition types.h:231
Status Validate() const
Validates the ListNamespacesResponse.
Definition types.h:236
Response body for listing tables in a namespace.
Definition types.h:276
Status Validate() const
Validates the ListTablesResponse.
Definition types.h:281
Response body of the LoadCredentials API.
Definition types.h:216
Status Validate() const
Validates the LoadCredentialsResponse.
Definition types.h:220
Result body for table create/load/register APIs.
Definition types.h:186
Status Validate() const
Validates the LoadTableResult.
Definition types.h:196
Labels labels
Catalog-provided labels; empty if none.
Definition types.h:193
std::vector< StorageCredential > storage_credentials
Vended storage credentials, one per URI prefix; empty if none.
Definition types.h:191
Response from an OAuth2 token endpoint.
Definition types.h:318
Status Validate() const
Validates the token response.
Request to initiate a server-side scan planning operation.
Definition types.h:333
Response from initiating a scan planning operation, including plan status and initial scan tasks.
Definition types.h:351
Request to register a table.
Definition types.h:122
Status Validate() const
Validates the RegisterTableRequest.
Definition types.h:128
Update or delete namespace properties request.
Definition types.h:104
Status Validate() const
Validates the UpdateNamespacePropertiesRequest.
Definition types.h:109
Response body after updating namespace properties.
Definition types.h:264
Status Validate() const
Validates the UpdateNamespacePropertiesResponse.
Definition types.h:270