You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "dennishuo (via GitHub)" <gi...@apache.org> on 2026/10/12 00:54:38 UTC

Re: [PR] Add an OpenAPI specification for a Shares API (beta) [polaris]

dennishuo commented on code in PR #5446:
URL: https://github.com/apache/polaris/pull/5446#discussion_r4243946683


##########
spec/polaris-shares-api.yaml:
##########
@@ -0,0 +1,1048 @@
+#
+# 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: Polaris Shares API
+  version: 0.0.3
+  description:
+    Defines the management APIs for sharing catalog content with consumers outside the
+    catalog's identity domain. A share enumerates what is shared; an external consumer is
+    a restricted, first-class identity; a listing is the only binding between a consumer
+    and a share and is the unit of audit. Consumers read shared data through the standard
+    Iceberg REST Catalog protocol using the connection material from their listing's
+    endpoint configuration. Shares are realm-level objects, addressed by name across the
+    service, and each share is bound to one catalog whose objects it can contain. This API
+    is served under the management root, next to the management API, and is in a beta
+    state and may change in a backward-incompatible way; it is served only when the
+    shares feature flag is enabled, and it is disabled by default.
+servers:
+  - url: "{scheme}://{host}/api/management/v1"
+    description: Server URL when the port can be inferred from the scheme
+    variables:
+      scheme:
+        description: The scheme of the URI, either http or https.
+        default: https
+      host:
+        description: The host address for the specified server
+        default: localhost
+security:
+  - OAuth2: []
+
+paths:
+  /shares:
+    get:
+      operationId: listShares
+      summary: List shares
+      parameters:
+        - name: pageToken
+          in: query
+          required: false
+          schema:
+            type: string
+        - name: pageSize
+          in: query
+          required: false
+          schema:
+            type: integer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. List all shares in this Polaris service."
+      responses:
+        200:
+          description: List of shares
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Shares"
+        403:
+          description: "The caller does not have permission to list shares"
+    post:
+      operationId: createShare
+      summary: Create a share
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Create a new share bound to the catalog named in the
+        request. A new share contains no members and is bound to no consumer until
+        members are added and a listing is created."
+      requestBody:
+        description: The share to create
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/CreateShareRequest"
+      responses:
+        201:
+          description: "Successful response"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Share"
+        403:
+          description: "The caller does not have permission to create a share, or to create a catalog role in the bound catalog"
+        404:
+          description: "The bound catalog does not exist"
+        409:
+          description: "A share with the specified name already exists"
+
+  /shares/{shareName}:
+    parameters:
+      - name: shareName
+        in: path
+        description: The name of the share
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: getShare
+      summary: Get a share
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Get a share by name."
+      responses:
+        200:
+          description: The share
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Share"
+        403:
+          description: "The caller does not have permission to read this share"
+        404:
+          description: "The share does not exist"
+    put:
+      operationId: updateShare
+      summary: Update a share
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Update a share's description or properties. Share
+        membership is updated through the members resource, not through this operation."
+      requestBody:
+        description: The update to apply
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/UpdateShareRequest"
+      responses:
+        200:
+          description: The updated share
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Share"
+        403:
+          description: "The caller does not have permission to update this share"
+        404:
+          description: "The share does not exist"
+        409:
+          description: "The share was concurrently modified; fetch and retry"
+    delete:
+      operationId: deleteShare
+      summary: Delete a share
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Delete a share. Every listing of this share is
+        revoked immediately; consumer access through those listings ends with them."
+      responses:
+        204:
+          description: "Success, no content"
+        403:
+          description: "The caller does not have permission to delete this share"
+        404:
+          description: "The share does not exist"
+
+  /shares/{shareName}/members:
+    parameters:
+      - name: shareName
+        in: path
+        description: The name of the share
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: listShareMembers
+      summary: List share members
+      parameters:
+        - name: pageToken
+          in: query
+          required: false
+          schema:
+            type: string
+        - name: pageSize
+          in: query
+          required: false
+          schema:
+            type: integer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. List the members of a share."
+      responses:
+        200:
+          description: The members of the share
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ShareMembers"
+        403:
+          description: "The caller does not have permission to read this share"
+        404:
+          description: "The share does not exist"
+    post:
+      operationId: updateShareMembers
+      summary: Update share members
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Apply an ordered list of member additions and
+        removals to the share's membership record atomically: either every update is
+        recorded or none is. The read grants implied by membership converge with the
+        record immediately after the commit; a service documents its behavior when
+        grant materialization fails partway. Every member must belong to the share's
+        bound catalog. Removing a member immediately removes it from every consumer's
+        view of the share."
+      requestBody:
+        description: The membership updates to apply
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/UpdateShareMembersRequest"
+      responses:
+        200:
+          description: The resulting members of the share
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ShareMembers"
+        400:
+          description: "An update in the list is invalid, or a member is outside the share's bound catalog"
+        403:
+          description: "The caller does not have permission to update this share's members"
+        404:
+          description: "The share, or a referenced member object, does not exist"
+        409:
+          description: "The share was concurrently modified; fetch and retry"
+
+  /shares/{shareName}/listings:
+    parameters:
+      - name: shareName
+        in: path
+        description: The name of the share
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: listListingsForShare
+      summary: List listings of a share
+      parameters:
+        - name: pageToken
+          in: query
+          required: false
+          schema:
+            type: string
+        - name: pageSize
+          in: query
+          required: false
+          schema:
+            type: integer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. List the listings of a share."
+      responses:
+        200:
+          description: The listings of the share
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Listings"
+        403:
+          description: "The caller does not have permission to read this share's listings"
+        404:
+          description: "The share does not exist"
+    post:
+      operationId: createListing
+      summary: Create a listing
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Create a listing, binding an external consumer to
+        this share. The listing is the only path that connects a consumer to a share,
+        and it is the unit of audit: every consumer read is attributable to its listing."
+      requestBody:
+        description: The listing to create
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/CreateListingRequest"
+      responses:
+        201:
+          description: "Successful response"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Listing"
+        403:
+          description: "The caller does not have permission to create a listing on this share"
+        404:
+          description: "The share or the external consumer does not exist"
+        409:
+          description: "A listing with the specified name already exists on this share, or a listing already binds this consumer to this share (at most one listing binds a given consumer to a given share)"
+
+  /shares/{shareName}/listings/{listingName}:
+    parameters:
+      - name: shareName
+        in: path
+        description: The name of the share
+        required: true
+        schema:
+          type: string
+      - name: listingName
+        in: path
+        description: The name of the listing
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: getListing
+      summary: Get a listing
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Get a listing by name."
+      responses:
+        200:
+          description: The listing
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Listing"
+        403:
+          description: "The caller does not have permission to read this listing"
+        404:
+          description: "The share or listing does not exist"
+    delete:
+      operationId: deleteListing
+      summary: Delete a listing
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Delete a listing. The bound consumer's access to
+        this share through this listing is revoked immediately."
+      responses:
+        204:
+          description: "Success, no content"
+        403:
+          description: "The caller does not have permission to delete this listing"
+        404:
+          description: "The share or listing does not exist"
+
+  /shares/{shareName}/listings/{listingName}/endpoint-config:
+    parameters:
+      - name: shareName
+        in: path
+        description: The name of the share
+        required: true
+        schema:
+          type: string
+      - name: listingName
+        in: path
+        description: The name of the listing
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: getListingEndpointConfig
+      summary: Get a listing's endpoint configuration
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Get the connection material for a listing: the
+        Iceberg REST Catalog endpoint, prefix, and authentication configuration the
+        external consumer uses to read the share with any standard Iceberg REST client.
+        The provider transmits this material to the consumer out of band."
+      responses:
+        200:
+          description: The endpoint configuration for the listing
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/EndpointConfig"
+        403:
+          description: "The caller does not have permission to read this listing"
+        404:
+          description: "The share or listing does not exist"
+
+  /external-consumers:
+    get:
+      operationId: listExternalConsumers
+      summary: List external consumers
+      parameters:
+        - name: pageToken
+          in: query
+          required: false
+          schema:
+            type: string
+        - name: pageSize
+          in: query
+          required: false
+          schema:
+            type: integer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. List all external consumers in this Polaris service."
+      responses:
+        200:
+          description: List of external consumers
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ExternalConsumers"
+        403:
+          description: "The caller does not have permission to list external consumers"
+    post:
+      operationId: createExternalConsumer
+      summary: Create an external consumer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Create an external consumer: a restricted,
+        first-class identity representing a data consumer outside this catalog's
+        identity domain. An external consumer can be bound to shares through listings
+        and can hold consumer credentials; it cannot be granted any other role, right,
+        or privilege."
+      requestBody:
+        description: The external consumer to create
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: "#/components/schemas/CreateExternalConsumerRequest"
+      responses:
+        201:
+          description: "Successful response"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ExternalConsumer"
+        403:
+          description: "The caller does not have permission to create an external consumer"
+        409:
+          description: "An external consumer with the specified name already exists"
+
+  /external-consumers/{consumerName}:
+    parameters:
+      - name: consumerName
+        in: path
+        description: The name of the external consumer
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: getExternalConsumer
+      summary: Get an external consumer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Get an external consumer by name."
+      responses:
+        200:
+          description: The external consumer
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ExternalConsumer"
+        403:
+          description: "The caller does not have permission to read this external consumer"
+        404:
+          description: "The external consumer does not exist"
+    delete:
+      operationId: deleteExternalConsumer
+      summary: Delete an external consumer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Delete an external consumer. Every listing bound to
+        this consumer is revoked and every credential of this consumer is invalidated,
+        immediately and irreversibly."
+      responses:
+        204:
+          description: "Success, no content"
+        403:
+          description: "The caller does not have permission to delete this external consumer"
+        404:
+          description: "The external consumer does not exist"
+
+  /external-consumers/{consumerName}/listings:
+    parameters:
+      - name: consumerName
+        in: path
+        description: The name of the external consumer
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: listListingsForConsumer
+      summary: List listings for a consumer
+      parameters:
+        - name: pageToken
+          in: query
+          required: false
+          schema:
+            type: string
+        - name: pageSize
+          in: query
+          required: false
+          schema:
+            type: integer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. List every listing bound to this external consumer,
+        across all shares."
+      responses:
+        200:
+          description: The listings bound to this consumer
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Listings"
+        403:
+          description: "The caller does not have permission to read this external consumer"
+        404:
+          description: "The external consumer does not exist"
+
+  /external-consumers/{consumerName}/credentials:
+    parameters:
+      - name: consumerName
+        in: path
+        description: The name of the external consumer
+        required: true
+        schema:
+          type: string
+    get:
+      operationId: listExternalConsumerCredentials
+      summary: List a consumer's credentials
+      parameters:
+        - name: pageToken
+          in: query
+          required: false
+          schema:
+            type: string
+        - name: pageSize
+          in: query
+          required: false
+          schema:
+            type: integer
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. List this consumer's credentials. Secrets are never
+        returned by this operation."
+      responses:
+        200:
+          description: The consumer's credentials, without secrets
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ConsumerCredentials"
+        403:
+          description: "The caller does not have permission to read this external consumer"
+        404:
+          description: "The external consumer does not exist"
+    post:
+      operationId: createExternalConsumerCredential
+      summary: Create a consumer credential
+      description:
+        "**Beta:** this API is under active development and may change in a
+        backward-incompatible way. Create an OAuth2 client-credentials pair for this
+        consumer. The client secret is returned exactly once, in this response, and
+        cannot be retrieved later. A service MAY limit a consumer to one active

Review Comment:
   Clarifying this per the latest revision - for now, we'll only allow one credential per consumer; creating one while one is active will 409. Providers wanting to mint multiple independent credentials can do so by creating multiple ExternalConsumers.



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

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