Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/src/main/java/org/apache/iceberg/rest/Endpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class Endpoint {
Endpoint.create("GET", ResourcePaths.V1_NAMESPACES);
public static final Endpoint V1_LOAD_NAMESPACE =
Endpoint.create("GET", ResourcePaths.V1_NAMESPACE);
public static final Endpoint V1_NAMESPACE_EXISTS =
Endpoint.create("HEAD", ResourcePaths.V1_NAMESPACE);
public static final Endpoint V1_CREATE_NAMESPACE =
Endpoint.create("POST", ResourcePaths.V1_NAMESPACES);
public static final Endpoint V1_UPDATE_NAMESPACE =
Expand All @@ -52,6 +54,7 @@ public class Endpoint {
// table endpoints
public static final Endpoint V1_LIST_TABLES = Endpoint.create("GET", ResourcePaths.V1_TABLES);
public static final Endpoint V1_LOAD_TABLE = Endpoint.create("GET", ResourcePaths.V1_TABLE);
public static final Endpoint V1_TABLE_EXISTS = Endpoint.create("HEAD", ResourcePaths.V1_TABLE);
public static final Endpoint V1_CREATE_TABLE = Endpoint.create("POST", ResourcePaths.V1_TABLES);
public static final Endpoint V1_UPDATE_TABLE = Endpoint.create("POST", ResourcePaths.V1_TABLE);
public static final Endpoint V1_DELETE_TABLE = Endpoint.create("DELETE", ResourcePaths.V1_TABLE);
Expand All @@ -61,10 +64,23 @@ public class Endpoint {
Endpoint.create("POST", ResourcePaths.V1_TABLE_REGISTER);
public static final Endpoint V1_REPORT_METRICS =
Endpoint.create("POST", ResourcePaths.V1_TABLE_METRICS);
public static final Endpoint V1_TABLE_CREDENTIALS =
Endpoint.create("GET", ResourcePaths.V1_TABLE_CREDENTIALS);

// table scan plan endpoints
public static final Endpoint V1_SUBMIT_TABLE_SCAN_PLAN =
Endpoint.create("POST", ResourcePaths.V1_TABLE_SCAN_PLAN_SUBMIT);
public static final Endpoint V1_FETCH_TABLE_SCAN_PLAN =
Endpoint.create("GET", ResourcePaths.V1_TABLE_SCAN_PLAN);
public static final Endpoint V1_CANCEL_TABLE_SCAN_PLAN =
Endpoint.create("DELETE", ResourcePaths.V1_TABLE_SCAN_PLAN);
public static final Endpoint V1_FETCH_TABLE_SCAN_PLAN_TASKS =
Endpoint.create("POST", ResourcePaths.V1_TABLE_SCAN_PLAN_TASKS);

// view endpoints
public static final Endpoint V1_LIST_VIEWS = Endpoint.create("GET", ResourcePaths.V1_VIEWS);
public static final Endpoint V1_LOAD_VIEW = Endpoint.create("GET", ResourcePaths.V1_VIEW);
public static final Endpoint V1_VIEW_EXISTS = Endpoint.create("HEAD", ResourcePaths.V1_VIEW);
public static final Endpoint V1_CREATE_VIEW = Endpoint.create("POST", ResourcePaths.V1_VIEWS);
public static final Endpoint V1_UPDATE_VIEW = Endpoint.create("POST", ResourcePaths.V1_VIEW);
public static final Endpoint V1_DELETE_VIEW = Endpoint.create("DELETE", ResourcePaths.V1_VIEW);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog
ImmutableSet.<Endpoint>builder()
.add(Endpoint.V1_LIST_NAMESPACES)
.add(Endpoint.V1_LOAD_NAMESPACE)
.add(Endpoint.V1_NAMESPACE_EXISTS)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added namespace exists to the default list

.add(Endpoint.V1_CREATE_NAMESPACE)
.add(Endpoint.V1_UPDATE_NAMESPACE)
.add(Endpoint.V1_DELETE_NAMESPACE)
.add(Endpoint.V1_LIST_TABLES)
.add(Endpoint.V1_LOAD_TABLE)
.add(Endpoint.V1_TABLE_EXISTS)
.add(Endpoint.V1_CREATE_TABLE)
.add(Endpoint.V1_UPDATE_TABLE)
.add(Endpoint.V1_DELETE_TABLE)
Expand All @@ -155,6 +157,7 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog
ImmutableSet.<Endpoint>builder()
.add(Endpoint.V1_LIST_VIEWS)
.add(Endpoint.V1_LOAD_VIEW)
.add(Endpoint.V1_VIEW_EXISTS)
.add(Endpoint.V1_CREATE_VIEW)
.add(Endpoint.V1_UPDATE_VIEW)
.add(Endpoint.V1_DELETE_VIEW)
Expand Down Expand Up @@ -434,6 +437,7 @@ public void renameTable(SessionContext context, TableIdentifier from, TableIdent

@Override
public boolean tableExists(SessionContext context, TableIdentifier identifier) {
Endpoint.check(endpoints, Endpoint.V1_TABLE_EXISTS);
checkIdentifierIsValid(identifier);

try {
Expand Down Expand Up @@ -654,6 +658,7 @@ public List<Namespace> listNamespaces(SessionContext context, Namespace namespac

@Override
public boolean namespaceExists(SessionContext context, Namespace namespace) {
Endpoint.check(endpoints, Endpoint.V1_NAMESPACE_EXISTS);
checkNamespaceIsValid(namespace);

try {
Expand Down Expand Up @@ -1227,6 +1232,7 @@ public List<TableIdentifier> listViews(SessionContext context, Namespace namespa

@Override
public boolean viewExists(SessionContext context, TableIdentifier identifier) {
Endpoint.check(endpoints, Endpoint.V1_VIEW_EXISTS);
checkViewIdentifierIsValid(identifier);

try {
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ public class ResourcePaths {
"/v1/{prefix}/namespaces/{namespace}/properties";
public static final String V1_TABLES = "/v1/{prefix}/namespaces/{namespace}/tables";
public static final String V1_TABLE = "/v1/{prefix}/namespaces/{namespace}/tables/{table}";
public static final String V1_TABLE_CREDENTIALS =
"/v1/{prefix}/namespaces/{namespace}/tables/{table}/credentials";
public static final String V1_TABLE_REGISTER = "/v1/{prefix}/namespaces/{namespace}/register";
public static final String V1_TABLE_METRICS =
"/v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics";
public static final String V1_TABLE_RENAME = "/v1/{prefix}/tables/rename";
public static final String V1_TABLE_SCAN_PLAN_SUBMIT = "/v1/{prefix}/tables/{table}/plan";
public static final String V1_TABLE_SCAN_PLAN = "/v1/{prefix}/tables/{table}/plan/{plan-id}";
public static final String V1_TABLE_SCAN_PLAN_TASKS = "/v1/{prefix}/tables/{table}/tasks";
public static final String V1_TRANSACTIONS_COMMIT = "/v1/{prefix}/transactions/commit";
public static final String V1_VIEWS = "/v1/{prefix}/namespaces/{namespace}/views";
public static final String V1_VIEW = "/v1/{prefix}/namespaces/{namespace}/views/{view}";
Expand Down