|
| 1 | +package kasanari.catalog.iceberg; |
| 2 | + |
| 3 | +import org.apache.iceberg.rest.Endpoint; |
| 4 | +import org.apache.iceberg.rest.responses.ConfigResponse; |
| 5 | + |
| 6 | +import java.util.List; |
| 7 | + |
| 8 | +public class IcebergCatalogConfigurationService { |
| 9 | + private final List<Endpoint> endpoints; |
| 10 | + |
| 11 | + public IcebergCatalogConfigurationService() { |
| 12 | + endpoints = List.of( |
| 13 | + // namespace |
| 14 | + Endpoint.V1_CREATE_NAMESPACE, |
| 15 | + Endpoint.V1_DELETE_NAMESPACE, |
| 16 | + Endpoint.V1_LIST_NAMESPACES, |
| 17 | + Endpoint.V1_LOAD_NAMESPACE, |
| 18 | + Endpoint.V1_NAMESPACE_EXISTS, |
| 19 | + Endpoint.V1_UPDATE_NAMESPACE, |
| 20 | + // table |
| 21 | + Endpoint.V1_CREATE_TABLE, |
| 22 | + Endpoint.V1_DELETE_TABLE, |
| 23 | + Endpoint.V1_LIST_TABLES, |
| 24 | + Endpoint.V1_LOAD_TABLE, |
| 25 | + Endpoint.V1_REGISTER_TABLE, |
| 26 | + Endpoint.V1_RENAME_TABLE, |
| 27 | + Endpoint.V1_UPDATE_TABLE, |
| 28 | + Endpoint.V1_TABLE_EXISTS, |
| 29 | + // view |
| 30 | + Endpoint.V1_CREATE_VIEW, |
| 31 | + Endpoint.V1_DELETE_VIEW, |
| 32 | + Endpoint.V1_LIST_VIEWS, |
| 33 | + Endpoint.V1_LOAD_VIEW, |
| 34 | + Endpoint.V1_UPDATE_VIEW, |
| 35 | + Endpoint.V1_RENAME_VIEW, |
| 36 | + Endpoint.V1_VIEW_EXISTS, |
| 37 | + // transactions |
| 38 | + Endpoint.V1_COMMIT_TRANSACTION, |
| 39 | + // other |
| 40 | + Endpoint.V1_REPORT_METRICS |
| 41 | + ); |
| 42 | + } |
| 43 | + |
| 44 | + public ConfigResponse getConfig(String warehouse) { |
| 45 | + return ConfigResponse |
| 46 | + .builder() |
| 47 | + .withEndpoints(endpoints) |
| 48 | + .withOverride("prefix", warehouse) |
| 49 | + .build(); |
| 50 | + } |
| 51 | +} |
0 commit comments