kbendick commented on a change in pull request #3561:
URL: https://github.com/apache/iceberg/pull/3561#discussion_r751574869



##########
File path: rest_docs/rest-catalog-open-api-v0.1.yaml
##########
@@ -0,0 +1,761 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+openapi: 3.0.3
+info:
+  title: Apache Iceberg REST Catalog API
+  license:
+    name: Apache 2.0
+    url: https://www.apache.org/licenses/LICENSE-2.0.html
+  version: 0.0.1
+servers:
+  - url: http://127.0.0.1:1080
+    description: URL Used for Mock-Server Unit Tests
+# All routes are currently configured using an Authorization header.
+security:
+- BearerAuth: []
+paths:
+  /v1/config:
+    get:
+      tags:
+      - Configuration API
+      summary: List all catalog configuration settings
+      operationId: getConfig
+      description:
+        All REST catalogs will be initialized by calling this route. This route
+        will return at least the minimum necessary metadata to initialize the
+        catalog. Optionally, it can also include server-side specific 
overrides.
+        For example, it might also include information used to initialize this 
catalog
+        such as the details of the Http connection pooling, etc. This route 
might
+        also advertise information about operations that are not implemented
+        so that the catalog can eagerly throw or go about another way of 
performing
+        the desired action.
+      responses:
+        default:
+          description: Server-Specific Configuration Overrides
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/IcebergConfiguration'
+        "400":
+          description: Unknown Error
+        "401":
+          description: Invalid credentials provided
+  # This might be optional for now as it's not really supported in
+  # the normal Catalog spec, but we might want to include it for
+  # convenience.
+  /v1/catalog/{catalog}:
+    parameters:
+      - name: catalog
+        in: path
+        required: true
+        description: Name of the catalog being configured
+        schema:
+          type: string
+          minLength: 1
+    post:
+      tags:
+         - Configuration API
+      summary: Persist catalog specific configuration, which can be retrieved
+        for later use.
+      operationId: postConfig
+      description:
+        Persist some catalog specific configurations, which will be returned 
by \
+        calls to /v1/config in the future. This is basically all of the data \
+        that would go into the Catalog's `initialize` call.
+      # TODO - Make this into a CatalogConfiguration
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/Catalog'
+        required: true
+      responses:
+        '200':
+          description: OK
+        '401':
+          description: Unauthorized / Invalid Credentials Provided
+
+  # Could also consider /v1/tables/{identifier}
+  /v1/namespaces/{namespace}/tables/{table}:
+    parameters:
+      # Consider moving this to query parameters,so it can be more easily URL 
encoded
+      # in case of dots or special characters
+      - name: namespace
+        in: path
+        description: Namespace the table is in
+        required: true
+        schema:
+          type: string
+        examples:
+          singlepart_namespace:
+            value: "prod"
+          multipart_namespace:
+            value: "prod.accounting"
+      - name: table
+        in: path
+        description: Name of the table to load
+        required: true
+        schema:
+          type: string
+        example: "sales"
+    get:
+      tags:
+        - Catalog API
+      summary: Load a given table from a given namespace
+      operationId: loadTable
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/GetTableResponse'
+        '401':
+          description: Unauthorized
+        # Using 412, `Precondition Failed`, instead of 404, as 404 makes 
monitoring response codes from ELBs
+        #  very difficult - Hard to tell if clients or servers are 
misconfigured and calling non-existent routes
+        #  or missing routes versus expected error cases such as 
NoSuchTableException (expected meaning that
+        #  a person who is on call shouldn't be paged for this but 404 they 
might need to be).
+        '412':
+          description: NoSuchTableException
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/NoSuchTableError'
+    put:
+      tags:
+        - Catalog API
+      summary: Commit an in progress create (or replace) table transaction
+      operationId: commitTable
+      description: Commit a pending create (or replace) table transaction, 
e.g. for doCommit.
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CommitTableRequest'
+        required: true
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/CommitTableResponse'
+        '401':
+          description: Unauthorized / Invalid Credentials
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/IcebergResponseObject'
+    delete:
+      tags:
+        - Catalog API
+      summary: Drop a table from the catalog, optionally purging the 
underlying data
+      operationId: dropTable
+      description: Remove a table from the catalog, optionally dropping the 
underlying data
+      parameters:
+        - name: purge
+          in: query
+          required: false
+          schema:
+            type: boolean
+            default: false
+      responses:
+        '200':
+          description: OK
+          content:
+            'application/json':
+              schema:
+                type: boolean
+    head:
+      tags:
+        - Catalog API
+      summary: Check if a table with a given identifier exists
+      operationId: tableExists
+      description:
+        Check if a table exists within a given namespace. Returns the standard 
response with `true` when found. Will return a TableNotFound error if not 
present. Can change to returning a 200 with a body of `false` if not found, but 
that does add more wok on the client.
+      parameters:
+        - name: namespace
+          in: path
+          required: true
+          schema:
+            type: string
+        - name: table
+          in: path
+          required: true
+          schema:
+            type: string
+      responses:
+        '200':
+          description: OK
+        '412':
+          description: Table Not Found
+  /v1/tables:
+    get:
+      tags:
+        - Catalog API
+      summary: List all table identifiers underneath a given namespace
+      description: Return all table identifiers under this namespace
+      operationId: listTables
+      parameters:
+        - name: namespace
+          description: Namespace under which to get identifiers. Can be one or 
more levels.
+          in: query
+          required: false
+          schema:
+            type: string
+          examples:
+            singlepart_namespace:
+              value: "prod"
+            # Note that this one would need to be normalized due to the dots. 
Maybe the route should change.
+            multipart_namespace:
+              value: "prod.accounting"
+        # TODO - There's a much more native way to handle pagination
+        - name: limit
+          description: number of values to return in one request
+          in: query
+          required: false
+          schema:
+            type: integer
+          example: 10
+        - name: offset
+          description: Place in the response to continue from if paginating
+          in: query
+          schema:
+            type: integer
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ListTablesResponse'
+    post:
+      tags:
+        - Catalog API
+      summary: Create a table with the identifier given in the body
+      operationId: createTable
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateTableRequest'
+        required: true
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/CreateTableResponse'
+  /v1/tables/renameTable:

Review comment:
       I would be ok with that. I believe I was trying to balance not 
overloading the same route with too many verbs, but that's not necessarily an 
issue.
   
   Let me see what I can do. 🙂 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to