Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

5.4 KB
Raw Blame
# 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.

---

paths:

  /metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/credentials:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "./openapi.yaml#/components/parameters/metadataObjectType"
      - $ref: "./openapi.yaml#/components/parameters/metadataObjectFullName"
    get:
      tags:
        - credentials
      summary: Get credentials
      operationId: getCredentials
      description: >
        Retrieves credentials for a catalog or fileset. When authorization is enabled,
        requests require metadata access (filesets use path-based read/write checks).
        That check alone is enough for SupportsDynamicCredential (token) providers.
        Static providers are included only when the caller also holds USE_SECRETS and
        INCLUDE_CREDENTIAL_SECRETS, or owns the metalake; otherwise only dynamic providers
        are invoked (static credentials omitted with HTTP 200, not 403). Unmarked custom
        providers are treated as static. Catalog requests do not provide a storage path:
        built-in path-only token providers return no catalog credentials, so a token-only
        catalog probe succeeds with an empty credential list. Static credentials carry the
        source account's permissions and are not scoped to individual Gravitino tables or
        fileset paths. Fileset requests supply the paths required to generate path-scoped
        tokens.
      responses:
        "200":
          description: >
            Returns the credential list (possibly empty). Missing static-secret privileges
            soft-filter to token-only or empty results rather than 403.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/responses/CredentialResponse"
              examples:
                CredentialResponse:
                  $ref: "#/components/examples/CredentialResponse"
        "400":
          $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
        "403":
          description: >
            Forbidden - The caller lacks metadata access (for example USE_CATALOG or
            READ_FILESET / WRITE_FILESET), not merely USE_SECRETS / INCLUDE_CREDENTIAL_SECRETS.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: Not Found - The specified metalake does not exist
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
              examples:
                NoSuchMetalakeException:
                  $ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
        "5xx":
          $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"


components:
  schemas:
    Credential:
      type: object
      description: A credential
      required:
        - credentialType
        - expireTimeInMs
        - credentialInfo
      properties:
        credentialType:
          type: string
          description: The type of the credential, for example, s3-token, s3-secret-key, oss-token, oss-secret-key, gcs-token, adls-token, azure-account-key, etc.
        expireTimeInMs:
          type: integer
          description: The expiration time of the credential in milliseconds since the epoch, 0 means not expire.
        credentialInfo:
          type: object
          description: The specific information of the credential.
          default: { }
          additionalProperties:
            type: string

  responses:
    CredentialResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description: Status code of the response
          enum:
            - 0
        credentials:
          type: array
          description: A list of credential objects
          items:
            $ref: "#/components/schemas/Credential"

  examples:
    CredentialResponse:
      value: {
        "code": 0,
        "credentials": [
          {
            "credentialType": "s3-token",
            "expireTimeInMs": 1735891948411,
            "credentialInfo": {
              "s3-access-key-id": "value1",
              "s3-secret-access-key": "value2",
              "s3-session-token": "value3"
            }
          },
          {
            "credentialType": "s3-secret-key",
            "expireTimeInMs": 0,
            "credentialInfo": {
              "s3-access-key-id": "value1",
              "s3-secret-access-key": "value2"
            }
          },
        ]
      }