flyrain commented on code in PR #808:
URL: https://github.com/apache/polaris/pull/808#discussion_r1931307464


##########
spec/rest-catalog-open-api.yaml:
##########
@@ -1595,6 +1595,261 @@ paths:
           $ref: '#/components/responses/ServiceUnavailableResponse'
         5XX:
           $ref: '#/components/responses/ServerErrorResponse'
+  
+  /v1/{prefix}/namespaces/{namespace}/policies:
+    parameters:
+      - $ref: '#/components/parameters/prefix'
+      - $ref: '#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Catalog API
+      summary: 'Create a policy in the given namespace'
+      operationId: createPolicy
+      description:
+        Create a policy in the given namespace

Review Comment:
   Nit: put them in the same line?



##########
spec/rest-catalog-open-api.yaml:
##########
@@ -3977,6 +4241,151 @@ components:
           items:
             type: integer
           description: "List of equality field IDs"
+    
+    Policy:
+      type: object
+      required:
+        - owner_id

Review Comment:
   There was a discussion around the name `owner_id` in the design doc. The 
concern is that people may confuse `owner` with a user or a principal. How 
about something like `owner_entity_id`?



##########
spec/rest-catalog-open-api.yaml:
##########
@@ -3977,6 +4241,151 @@ components:
           items:
             type: integer
           description: "List of equality field IDs"
+    
+    Policy:
+      type: object
+      required:
+        - owner_id
+        - policy-id
+        - policy-type
+        - name
+        - content
+        - version
+      properties:
+        owner-id:
+          type: string
+        policy-id:
+          type: string
+        policy-type:
+          type: string
+        name:
+          type: string
+        description: 
+          type: string
+        content:
+          $ref: '#/components/schemas/PolicyContent'
+        version:
+          type: integer
+        created-at-ms:
+          type: integer
+          format: int64
+        updated-at-ms: 
+          type: integer
+          format: int64
+
+    PolicyContent: {}

Review Comment:
   I think `PolicyContent` is a string type.



##########
spec/rest-catalog-open-api.yaml:
##########
@@ -3977,6 +4241,151 @@ components:
           items:
             type: integer
           description: "List of equality field IDs"
+    
+    Policy:
+      type: object
+      required:
+        - owner_id
+        - policy-id
+        - policy-type
+        - name
+        - content
+        - version
+      properties:
+        owner-id:
+          type: string
+        policy-id:
+          type: string
+        policy-type:
+          type: string
+        name:
+          type: string
+        description: 
+          type: string
+        content:
+          $ref: '#/components/schemas/PolicyContent'
+        version:
+          type: integer
+        created-at-ms:
+          type: integer
+          format: int64
+        updated-at-ms: 
+          type: integer
+          format: int64
+
+    PolicyContent: {}
+
+    CreatePolicyRequest:
+      type: object
+      required:
+        - name
+        - type
+        - content

Review Comment:
   Are we going to allow users to create a policy without any content? I think 
we should allow that, users can update the content later. WDYT?



##########
spec/rest-catalog-open-api.yaml:
##########
@@ -1595,6 +1595,261 @@ paths:
           $ref: '#/components/responses/ServiceUnavailableResponse'
         5XX:
           $ref: '#/components/responses/ServerErrorResponse'
+  
+  /v1/{prefix}/namespaces/{namespace}/policies:
+    parameters:
+      - $ref: '#/components/parameters/prefix'
+      - $ref: '#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Catalog API
+      summary: 'Create a policy in the given namespace'
+      operationId: createPolicy
+      description:
+        Create a policy in the given namespace
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreatePolicyRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreatePolicyResponse'
+        400:
+          $ref: '#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '#/components/responses/ForbiddenResponse'
+        419:
+          $ref: '#/components/responses/AuthenticationTimeoutResponse'
+        503:
+          $ref: '#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '#/components/responses/ServerErrorResponse'
+
+  /v1/{prefix}/namespaces/{namespace}/policies/{policy}:
+    parameters:
+      - $ref: '#/components/parameters/prefix'
+      - $ref: '#/components/parameters/namespace'
+      - $ref: '#/components/parameters/policy'
+
+    get:
+      tags:
+        - Catalog API
+      summary: 'Get a policy'
+      operationId: getPolicy
+      description:
+        Get a policy from the catalog
+        
+        
+        The response contains the policy's metadata and content
+      responses:
+        200:
+          $ref: '#/components/responses/LoadPolicyResponse'
+        400:
+          $ref: '#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '#/components/responses/ForbiddenResponse'
+        404:
+          description:
+            Not Found - NoSuchPolicyException, policy to get does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/IcebergErrorResponse'
+              examples:
+                PolicyToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchPolicyError'
+        419:
+          $ref: '#/components/responses/AuthenticationTimeoutResponse'
+        503:
+          $ref: '#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Catalog API
+      summary: Update a policy
+      operationId: updatePolicy
+      description:
+        Update a policy

Review Comment:
   same line as well?



-- 
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...@polaris.apache.org

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

Reply via email to