World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
# 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}/policies:
parameters:
- $ref: "./openapi.yaml#/components/parameters/metalake"
get:
tags:
- policy
summary: List policies (names)
operationId: listPolicies
parameters:
- $ref: "#/components/parameters/details"
responses:
"200":
description: Returns the list of policy objects if {details} is true, otherwise returns the list of policy names
content:
application/vnd.gravitino.v1+json:
schema:
oneOf:
- $ref: "./openapi.yaml#/components/schemas/NameListResponse"
- $ref: "#/components/schemas/PolicyListResponse"
examples:
NameListResponse:
$ref: "#/components/examples/NameListResponse"
PolicyListResponse:
$ref: "#/components/examples/PolicyListResponse"
"400":
$ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
"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"
post:
tags:
- policy
summary: Create policy
operationId: createPolicy
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PolicyCreateRequest"
examples:
PolicyCreate:
$ref: "#/components/examples/PolicyCreate"
PolicyCreateLowercaseType:
$ref: "#/components/examples/PolicyCreateLowercaseType"
PolicyCreateUppercaseType:
$ref: "#/components/examples/PolicyCreateUppercaseType"
PolicyCreateMixedCaseType:
$ref: "#/components/examples/PolicyCreateMixedCaseType"
responses:
"200":
description: Returns the created policy object
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "#/components/schemas/PolicyResponse"
examples:
PolicyResponse:
$ref: "#/components/examples/PolicyResponse"
"409":
description: Conflict - The target policy already exists in the specified metalake
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "./openapi.yaml#/components/schemas/ErrorModel"
examples:
PolicyAlreadyExistsException:
$ref: "#/components/examples/PolicyAlreadyExistsException"
"5xx":
$ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
/metalakes/{metalake}/policies/{policy}:
parameters:
- $ref: "./openapi.yaml#/components/parameters/metalake"
- $ref: "./openapi.yaml#/components/parameters/policy"
get:
tags:
- policy
summary: Get policy
operationId: getPolicy
description: Returns the specified policy information in the specified metalake
responses:
"200":
description: Returns the policy object
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "#/components/schemas/PolicyResponse"
examples:
PolicyResponse:
$ref: "#/components/examples/PolicyResponse"
"404":
description: Not Found - The specified policy does not exist in the specified metalake
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "./openapi.yaml#/components/schemas/ErrorModel"
examples:
NoSuchMetalakeException:
$ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
NoSuchPolicyException:
$ref: "#/components/examples/NoSuchPolicyException"
"5xx":
$ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
put:
tags:
- policy
summary: Update policy
operationId: alterPolicy
description: Alters the specified policy information in the specified metalake
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PolicyUpdatesRequest"
examples:
PolicyUpdateContentLowercaseType:
$ref: "#/components/examples/PolicyUpdateContentLowercaseType"
PolicyUpdateContentUppercaseType:
$ref: "#/components/examples/PolicyUpdateContentUppercaseType"
PolicyUpdateContentMixedCaseType:
$ref: "#/components/examples/PolicyUpdateContentMixedCaseType"
responses:
"200":
description: Returns the updated policy object
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "#/components/schemas/PolicyResponse"
examples:
PolicyResponse:
$ref: "#/components/examples/PolicyResponse"
"404":
description: Not Found - The specified policy does not exist in the specified metalake
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "./openapi.yaml#/components/schemas/ErrorModel"
examples:
NoSuchMetalakeException:
$ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
NoSuchPolicyException:
$ref: "#/components/examples/NoSuchPolicyException"
"409":
description: Conflict - The target policy already exists
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "./openapi.yaml#/components/schemas/ErrorModel"
examples:
PolicyAlreadyExistsErrorResponse:
$ref: "#/components/examples/PolicyAlreadyExistsException"
"5xx":
$ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
patch:
tags:
- policy
summary: Enable or disable a policy
operationId: setPolicy
description: Enable or disable a policy in the specified metalake
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PolicySetRequest"
responses:
"200":
$ref: "./openapi.yaml#/components/responses/BaseResponse"
"404":
description: Not Found - The specified policy does not exist in the specified metalake
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "./openapi.yaml#/components/schemas/ErrorModel"
examples:
NoSuchMetalakeException:
$ref: "./metalakes.yaml#/components/examples/NoSuchMetalakeException"
NoSuchPolicyException:
$ref: "#/components/examples/NoSuchPolicyException"
"5xx":
$ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
delete:
tags:
- policy
summary: Delete policy
operationId: deletePolicy
responses:
"200":
$ref: "./openapi.yaml#/components/responses/DropResponse"
"400":
$ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
"5xx":
$ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
/metalakes/{metalake}/objects/{metadataObjectType}/{metadataObjectFullName}/policies:
parameters:
- $ref: "./openapi.yaml#/components/parameters/metalake"
- $ref: "./openapi.yaml#/components/parameters/metadataObjectType"
- $ref: "./openapi.yaml#/components/parameters/metadataObjectFullName"
get:
tags:
- policy
summary: List policies (names) for metadata object
operationId: listPoliciesForMetadataObject
parameters:
- $ref: "#/components/parameters/details"
responses:
"200":
description: Returns policies derived from the effective tags of the specified metadata object; details=true returns policy objects, otherwise policy names
content:
application/vnd.gravitino.v1+json:
schema:
oneOf:
- $ref: "#/components/schemas/PolicyNameListResponse"
- $ref: "#/components/schemas/MetadataObjectPolicyListResponse"
examples:
PolicyNameListResponse:
$ref: "#/components/examples/PolicyNameListResponse"
MetadataObjectPolicyListResponse:
$ref: "#/components/examples/MetadataObjectPolicyListResponse"
"400":
$ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
"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"
/metalakes/{metalake}/policies/{policy}/tags:
parameters:
- $ref: "./openapi.yaml#/components/parameters/metalake"
- $ref: "./openapi.yaml#/components/parameters/policy"
get:
tags:
- policy
summary: List tags associated with a policy
operationId: listTagsForPolicy
parameters:
- $ref: "#/components/parameters/details"
responses:
"200":
description: Returns tag names or detailed policy-tag associations
content:
application/vnd.gravitino.v1+json:
schema:
oneOf:
- $ref: "./openapi.yaml#/components/schemas/NameListResponse"
- $ref: "#/components/schemas/TagForPolicyAssociationListResponse"
"400":
$ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse"
"404":
description: Not Found - The specified metalake or policy does not exist
content:
application/vnd.gravitino.v1+json:
schema:
$ref: "./openapi.yaml#/components/schemas/ErrorModel"
"5xx":
$ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
components:
# YAML-only merge source for TMS execution peers. Not a public schema: each maintenance
# content object inlines these properties so additionalProperties: false still accepts them.
x-gravitino-policy-execution-peer-properties: &policy-execution-peer-properties
timeTrigger:
type: string
nullable: true
description: >
Optional six-field Quartz cron (`second minute hour day-of-month month day-of-week`).
When due, PolicyExpand schedules cron maintenance for matching tables.
commitTrigger:
type: boolean
nullable: true
description: >
When true, a successful Iceberg REST table update can enqueue commit-triggered
maintenance.
minIntervalMs:
type: integer
format: int64
minimum: 0
nullable: true
description: >
Optional cooldown in milliseconds after a finished run of this policy on a table.
When omitted, the server uses the per-type default.
jobOptions:
type: object
nullable: true
additionalProperties:
type: string
minLength: 1
pattern: '[\s\S]*\S[\s\S]*'
description: Optional Spark/job option bag. Keys and values must be non-blank.
updaterOptions:
type: object
nullable: true
additionalProperties:
type: string
minLength: 1
pattern: '[\s\S]*\S[\s\S]*'
description: >
Optional updater option bag (for example `gravitino_uri`). Keys and values must be
non-blank.
parameters:
details:
name: details
in: query
description: Include detailed information about the policy
required: false
schema:
type: boolean
default: false
schemas:
PolicyAssociationSelector:
type: object
required:
- type
properties:
type:
type: string
description: The selector type used to match tag assignments
enum: ["ALL_VALUES", "TAG_VALUE"]
value:
type: string
description: The assignment value required by a TAG_VALUE selector
nullable: true
maxLength: 256
TagForPolicyAssociation:
type: object
required:
- tag
- selector
properties:
tag:
$ref: "./tags.yaml#/components/schemas/Tag"
selector:
$ref: "#/components/schemas/PolicyAssociationSelector"
TagForPolicyAssociationListResponse:
type: object
required:
- code
- associations
properties:
code:
type: integer
format: int32
enum: [0]
associations:
type: array
items:
$ref: "#/components/schemas/TagForPolicyAssociation"
IcebergCompactionContent:
type: object
description: >
Built-in Iceberg compaction thresholds, scoring weights, rewrite options, and TMS
execution peers such as `timeTrigger` and `jobOptions`. On updateContent, newContent
fully replaces the previous content; omitting a peer clears it.
additionalProperties: false
properties:
<<: *policy-execution-peer-properties
minDataFileMse:
type: integer
format: int64
minimum: 0
default: 405323966463344
minDeleteFileNumber:
type: integer
format: int64
minimum: 0
default: 1
dataFileMseWeight:
type: integer
format: int64
minimum: 0
default: 1
deleteFileNumberWeight:
type: integer
format: int64
minimum: 0
default: 100
maxPartitionNum:
type: integer
format: int64
minimum: 1
default: 50
rewriteStrategy:
type: string
enum: [binpack, sort]
default: binpack
description: Iceberg rewrite_data_files top-level strategy.
sortOrder:
type: string
default: ""
description: Iceberg rewrite_data_files top-level sort_order. Required when rewriteStrategy is sort; must be empty for binpack.
rewriteOptions:
type: object
default: {}
description: Rewrite options with nonempty values and keys matching [A-Za-z0-9._-]+, without the job.options. prefix.
additionalProperties:
type: string
minLength: 1
IcebergCompactionPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_iceberg_compaction]
content:
$ref: '#/components/schemas/IcebergCompactionContent'
IcebergCompactionPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/IcebergCompactionRequestPolicyType'
content:
$ref: '#/components/schemas/IcebergCompactionContent'
IcebergOrphanFileRemovalContent:
type: object
description: >
Table-level orphan cleanup options with TMS execution peers such as `timeTrigger`.
`commitTrigger=true` is rejected for this policy type. On updateContent, newContent
fully replaces the previous content; omitting a peer clears it.
additionalProperties: false
properties:
<<: *policy-execution-peer-properties
# Explicit key wins over the YAML merge: orphan cleanup never accepts commitTrigger=true.
# Put null in enum (same as domains.yaml parent): OAS 3.0 nullable does not extend enum.
commitTrigger:
type: boolean
nullable: true
enum: [false, null]
description: >
Must be false, null, or omitted. Orphan file removal rejects commit-triggered runs.
olderThanDays:
type: integer
format: int64
minimum: 1
maximum: 36500
default: 3
description: Minimum age of orphan files in days, including for dry runs.
location:
type: string
nullable: true
description: Optional scan location within the target table's storage root.
dryRun:
type: boolean
default: false
description: List candidates without deleting them.
IcebergOrphanFileRemovalPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_iceberg_orphan_file_removal]
content:
$ref: '#/components/schemas/IcebergOrphanFileRemovalContent'
IcebergOrphanFileRemovalPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/IcebergOrphanFileRemovalRequestPolicyType'
content:
$ref: '#/components/schemas/IcebergOrphanFileRemovalContent'
IcebergRewriteManifestsContent:
type: object
description: >
Thresholds for one resolved Iceberg partition spec. Supports catalog, schema, and table
policies, plus TMS execution peers such as `timeTrigger` and `jobOptions`. On
updateContent, newContent fully replaces the previous content; omitting a peer clears it.
additionalProperties: false
properties:
<<: *policy-execution-peer-properties
manifest_count_threshold:
type: integer
format: int64
minimum: 1
default: 100
description: Inclusive manifest count trigger. Aligns with Iceberg commit.manifest.min-count-to-merge.
spec_id:
type: integer
format: int32
minimum: 0
nullable: true
description: Existing partition spec. Omission uses Iceberg's current default at evaluation (optimizer retains the resolved ID through submit) or at TMS job runtime.
use_caching:
type: boolean
nullable: true
description: Optional caching setting. Omission preserves the Iceberg runtime default.
IcebergRewriteManifestsPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_iceberg_rewrite_manifests]
content:
$ref: '#/components/schemas/IcebergRewriteManifestsContent'
IcebergRewriteManifestsPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/IcebergRewriteManifestsRequestPolicyType'
content:
$ref: '#/components/schemas/IcebergRewriteManifestsContent'
IcebergSnapshotExpirationContent:
type: object
description: >
Snapshot expiration options for system_iceberg_snapshot_expiration, including TMS
execution peers such as `timeTrigger` and `jobOptions`. On updateContent, newContent
fully replaces the previous content; omitted fields use these defaults rather than
merging with stored values (omitting a peer clears it). Integer fields must be JSON
integers (not strings or floats); streamResults must be a JSON boolean.
additionalProperties: false
properties:
<<: *policy-execution-peer-properties
olderThanDays:
type: integer
format: int64
minimum: 1
maximum: 36500
default: 5
description: Minimum age of snapshots eligible for expiration, in days (Iceberg default).
retainLast:
type: integer
format: int64
minimum: 1
default: 1
description: Minimum number of recent snapshots to keep regardless of age.
streamResults:
type: boolean
default: false
description: Whether the expire job should stream intermediate delete results.
IcebergSnapshotExpirationPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_iceberg_snapshot_expiration]
content:
$ref: '#/components/schemas/IcebergSnapshotExpirationContent'
IcebergSnapshotExpirationPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/IcebergSnapshotExpirationRequestPolicyType'
content:
$ref: '#/components/schemas/IcebergSnapshotExpirationContent'
RowFilterContent:
type: object
description: Expression content for a built-in row-filter policy.
required:
- expression
properties:
expression:
type: string
minLength: 1
pattern: '[\s\S]*\S[\s\S]*'
description: >-
A complete restricted-sql-v1 definition such as
`(region STRING) RETURNS BOOLEAN -> region = 'US'`.
Parameters must be declared and the body must return BOOLEAN. SQL CASE, predicates,
and allowlisted context and scalar functions are supported. The UTF-8 source must
not exceed 16 KiB; see the Policies documentation for grammar, types and limits.
ColumnMaskContent:
type: object
description: Expression content for a built-in column-mask policy.
required:
- expression
properties:
expression:
type: string
minLength: 1
pattern: '[\s\S]*\S[\s\S]*'
description: >-
A complete restricted-sql-v1 definition such as
`(value STRING) RETURNS STRING -> show_last_4(value)`.
Exactly one parameter is required; its type must equal the return type. Its local
name is independent of the selected column name. The body may use SQL CASE,
literals, NULL, and allowlisted functions. The UTF-8 source must not exceed 16 KiB;
see the Policies documentation for grammar, types and limits.
AccessControlContent:
type: object
description: Rule content for a built-in access-control policy.
required:
- privileges
- applicableRoles
properties:
privileges:
type: array
minItems: 1
description: >-
The privileges granted when the rule matches. Limited to privileges that apply to a
whole securable object; column-scoped privileges are not permitted. This enum mirrors
AccessControlContent.PERMITTED_PRIVILEGES; change both together.
items:
type: string
enum:
- SELECT_TABLE
- MODIFY_TABLE
- PROBE_TABLE_LIKE
- SELECT_VIEW
- READ_FILESET
- WRITE_FILESET
- CONSUME_TOPIC
- PRODUCE_TOPIC
- USE_MODEL
- EXECUTE_FUNCTION
- USE_SEMANTIC_MODEL
applicableRoles:
type: array
minItems: 1
description: The names of the roles the rule applies to.
items:
type: string
RowFilterPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_row_filter]
content:
$ref: '#/components/schemas/RowFilterContent'
RowFilterPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/RowFilterRequestPolicyType'
content:
$ref: '#/components/schemas/RowFilterContent'
ColumnMaskPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_column_mask]
content:
$ref: '#/components/schemas/ColumnMaskContent'
ColumnMaskPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/ColumnMaskRequestPolicyType'
content:
$ref: '#/components/schemas/ColumnMaskContent'
AccessControlPolicy:
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required: [content]
properties:
policyType:
type: string
enum: [system_access_control]
content:
$ref: '#/components/schemas/AccessControlContent'
AccessControlPolicyCreateRequest:
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required: [content]
properties:
policyType:
$ref: '#/components/schemas/AccessControlRequestPolicyType'
content:
$ref: '#/components/schemas/AccessControlContent'
PolicyContentBase:
type: object
description: A base content structure for policies
required:
- supportedObjectTypes
properties:
supportedObjectTypes:
type: array
description: >-
Declares the metadata object types the policy's rules are intended for. The field
is not enforced: associating a policy does not check it, and object policy lookup
does not filter by it. Consumers decide whether a policy type applies to the
object they are processing.
minItems: 1
items:
type: string
enum: [ "CATALOG", "SCHEMA", "TABLE", "FILESET", "TOPIC", "MODEL", "SEMANTIC_MODEL", "VIEW", "FUNCTION" ]
properties:
type: object
description: A map of string-to-string properties for the policy content.
additionalProperties:
type: string
example:
"key1": "value1"
"key2": "value2"
CustomPolicyContent:
type: object
description: Content for a custom policy type.
allOf:
- $ref: '#/components/schemas/PolicyContentBase'
- type: object
properties:
customRules:
type: object
description: A map of custom rules where the key is the rule name and the value can be of any type.
additionalProperties: { }
example:
rule1: "rule1"
rule2: 123
PolicyBase:
type: object
description: A basic policy without content
required:
- name
- policyType
- enabled
- audit
properties:
name:
type: string
description: The name of the policy
comment:
type: string
description: A comment about the policy
nullable: true
policyType:
type: string
description: The type of the policy
enabled:
type: boolean
description: Whether the policy is enabled
audit:
$ref: "./openapi.yaml#/components/schemas/Audit"
inherited:
type: boolean
description: Whether the policy is selected only from ancestor metadata objects, either
through inherited tags or legacy direct policy associations
nullable: true
CustomPolicy:
description: A policy with custom content
allOf:
- $ref: '#/components/schemas/PolicyBase'
- type: object
required:
- content
properties:
policyType:
type: string
not:
enum: [system_iceberg_compaction, system_iceberg_orphan_file_removal, system_iceberg_rewrite_manifests, system_iceberg_snapshot_expiration, system_row_filter, system_column_mask, system_access_control]
content:
$ref: '#/components/schemas/CustomPolicyContent'
Policy:
type: object
description: A basic policy without content
oneOf:
- $ref: '#/components/schemas/CustomPolicy'
- $ref: '#/components/schemas/IcebergOrphanFileRemovalPolicy'
- $ref: '#/components/schemas/IcebergCompactionPolicy'
- $ref: '#/components/schemas/IcebergRewriteManifestsPolicy'
- $ref: '#/components/schemas/IcebergSnapshotExpirationPolicy'
- $ref: '#/components/schemas/RowFilterPolicy'
- $ref: '#/components/schemas/ColumnMaskPolicy'
- $ref: '#/components/schemas/AccessControlPolicy'
discriminator:
propertyName: policyType
mapping:
custom: '#/components/schemas/CustomPolicy'
system_iceberg_orphan_file_removal: '#/components/schemas/IcebergOrphanFileRemovalPolicy'
system_iceberg_compaction: '#/components/schemas/IcebergCompactionPolicy'
system_iceberg_rewrite_manifests: '#/components/schemas/IcebergRewriteManifestsPolicy'
system_iceberg_snapshot_expiration: '#/components/schemas/IcebergSnapshotExpirationPolicy'
system_row_filter: '#/components/schemas/RowFilterPolicy'
system_column_mask: '#/components/schemas/ColumnMaskPolicy'
system_access_control: '#/components/schemas/AccessControlPolicy'
PolicyListResponse:
type: object
properties:
code:
type: integer
format: int32
description: Status code of the response
enum:
- 0
policies:
type: array
description: A list of policy objects
items:
$ref: "#/components/schemas/Policy"
PolicyNameListResponse:
allOf:
- $ref: "./openapi.yaml#/components/schemas/NameListResponse"
- type: object
required:
- names
- hasInaccessiblePolicies
properties:
hasInaccessiblePolicies:
type: boolean
description: Whether one or more inaccessible policies were omitted from the response
MetadataObjectPolicyListResponse:
allOf:
- $ref: "#/components/schemas/PolicyListResponse"
- type: object
required:
- policies
- hasInaccessiblePolicies
properties:
hasInaccessiblePolicies:
type: boolean
description: Whether one or more inaccessible policies were omitted from the response
MetadataObject:
type: object
description: A metadata object
properties:
fullName:
type: string
description: The name of the metadata object, separated by dots
type:
type: string
description: The type of the metadata object
enum:
- "CATALOG"
- "SCHEMA"
- "TABLE"
- "FILESET"
- "TOPIC"
- "MODEL"
- "VIEW"
- "FUNCTION"
- "COLUMN"
CustomRequestPolicyType:
type: string
description: Request value `custom`, matched case-insensitively.
pattern: '^[cC][uU][sS][tT][oO][mM]$'
IcebergCompactionRequestPolicyType:
type: string
description: Request value `system_iceberg_compaction`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[iI][cC][eE][bB][eE][rR][gG]_[cC][oO][mM][pP][aA][cC][tT][iI][oO][nN]$'
IcebergOrphanFileRemovalRequestPolicyType:
type: string
description: Request value `system_iceberg_orphan_file_removal`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[iI][cC][eE][bB][eE][rR][gG]_[oO][rR][pP][hH][aA][nN]_[fF][iI][lL][eE]_[rR][eE][mM][oO][vV][aA][lL]$'
IcebergRewriteManifestsRequestPolicyType:
type: string
description: Request value `system_iceberg_rewrite_manifests`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[iI][cC][eE][bB][eE][rR][gG]_[rR][eE][wW][rR][iI][tT][eE]_[mM][aA][nN][iI][fF][eE][sS][tT][sS]$'
IcebergSnapshotExpirationRequestPolicyType:
type: string
description: Request value `system_iceberg_snapshot_expiration`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[iI][cC][eE][bB][eE][rR][gG]_[sS][nN][aA][pP][sS][hH][oO][tT]_[eE][xX][pP][iI][rR][aA][tT][iI][oO][nN]$'
RowFilterRequestPolicyType:
type: string
description: Request value `system_row_filter`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[rR][oO][wW]_[fF][iI][lL][tT][eE][rR]$'
ColumnMaskRequestPolicyType:
type: string
description: Request value `system_column_mask`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[cC][oO][lL][uU][mM][nN]_[mM][aA][sS][kK]$'
AccessControlRequestPolicyType:
type: string
description: Request value `system_access_control`, matched case-insensitively.
pattern: '^[sS][yY][sS][tT][eE][mM]_[aA][cC][cC][eE][sS][sS]_[cC][oO][nN][tT][rR][oO][lL]$'
PolicyCreateRequestBase:
type: object
description: A base policy create request without content
required:
- name
- policyType
properties:
name:
type: string
description: The name of the policy
comment:
type: string
description: A comment for the policy
nullable: true
policyType:
type: string
description: >-
The type of the policy, either `custom` or a built-in `system_*` type. Known
values are matched case-insensitively, so request schemas select the content by a
case-insensitive pattern; the server stores and returns the canonical lowercase
form. An unknown value is rejected with HTTP 400 naming the type.
enabled:
type: boolean
description: Whether the policy is enabled
default: true
CustomPolicyCreateRequest:
description: A request to create a policy with a custom content structure.
allOf:
- $ref: '#/components/schemas/PolicyCreateRequestBase'
- type: object
required:
- content
properties:
policyType:
$ref: '#/components/schemas/CustomRequestPolicyType'
content:
$ref: '#/components/schemas/CustomPolicyContent'
PolicyCreateRequest:
description: A request to create a policy.
type: object
oneOf:
- $ref: '#/components/schemas/CustomPolicyCreateRequest'
- $ref: '#/components/schemas/IcebergOrphanFileRemovalPolicyCreateRequest'
- $ref: '#/components/schemas/IcebergRewriteManifestsPolicyCreateRequest'
- $ref: '#/components/schemas/IcebergSnapshotExpirationPolicyCreateRequest'
- $ref: '#/components/schemas/IcebergCompactionPolicyCreateRequest'
- $ref: '#/components/schemas/RowFilterPolicyCreateRequest'
- $ref: '#/components/schemas/ColumnMaskPolicyCreateRequest'
- $ref: '#/components/schemas/AccessControlPolicyCreateRequest'
example: {
"name": "compaction_upper",
"policyType": "SYSTEM_ICEBERG_COMPACTION",
"enabled": true,
"content": {
"maxPartitionNum": 5
}
}
PolicyUpdatesRequest:
type: object
required:
- updates
properties:
updates:
type: array
items:
$ref: "#/components/schemas/PolicyUpdateRequest"
PolicyUpdateRequest:
oneOf:
- $ref: "#/components/schemas/RenamePolicyRequest"
- $ref: "#/components/schemas/UpdatePolicyCommentRequest"
- $ref: "#/components/schemas/UpdatePolicyContentRequest"
discriminator:
propertyName: "@type"
mapping:
rename: "#/components/schemas/RenamePolicyRequest"
updateComment: "#/components/schemas/UpdatePolicyCommentRequest"
updateContent: "#/components/schemas/UpdatePolicyContentRequest"
RenamePolicyRequest:
type: object
required:
- "@type"
- newName
properties:
"@type":
type: string
enum:
- rename
newName:
type: string
description: The new name of the policy
example: {
"@type": "rename",
"newName": "my_policy_new"
}
PolicySetRequest:
type: object
properties:
enable:
type: boolean
description: Whether to enable or disable the policy
UpdatePolicyCommentRequest:
type: object
required:
- "@type"
- newComment
properties:
"@type":
type: string
enum:
- updateComment
newComment:
type: string
description: The new comment of the policy
example: {
"@type": "updateComment",
"newComment": "This is my new policy comment"
}
UpdatePolicyContentRequestBase:
type: object
required:
- "@type"
- policyType
- newContent
properties:
"@type":
type: string
enum: [updateContent]
policyType:
type: string
description: >-
The type of the policy, either `custom` or a built-in `system_*` type. Known
values are matched case-insensitively, so request schemas select the content by a
case-insensitive pattern; the server stores and returns the canonical lowercase
form. An unknown value is rejected with HTTP 400 naming the type.
UpdateCustomPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/CustomRequestPolicyType'
newContent:
$ref: '#/components/schemas/CustomPolicyContent'
UpdateIcebergCompactionPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/IcebergCompactionRequestPolicyType'
newContent:
$ref: '#/components/schemas/IcebergCompactionContent'
UpdateIcebergOrphanFileRemovalPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/IcebergOrphanFileRemovalRequestPolicyType'
newContent:
$ref: '#/components/schemas/IcebergOrphanFileRemovalContent'
UpdateIcebergRewriteManifestsPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/IcebergRewriteManifestsRequestPolicyType'
newContent:
$ref: '#/components/schemas/IcebergRewriteManifestsContent'
UpdateIcebergSnapshotExpirationPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/IcebergSnapshotExpirationRequestPolicyType'
newContent:
$ref: '#/components/schemas/IcebergSnapshotExpirationContent'
UpdateRowFilterPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/RowFilterRequestPolicyType'
newContent:
$ref: '#/components/schemas/RowFilterContent'
UpdateColumnMaskPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/ColumnMaskRequestPolicyType'
newContent:
$ref: '#/components/schemas/ColumnMaskContent'
UpdateAccessControlPolicyContentRequest:
allOf:
- $ref: '#/components/schemas/UpdatePolicyContentRequestBase'
- type: object
properties:
policyType:
$ref: '#/components/schemas/AccessControlRequestPolicyType'
newContent:
$ref: '#/components/schemas/AccessControlContent'
UpdatePolicyContentRequest:
description: Selects typed content using the sibling policyType field, matching REST deserialization.
oneOf:
- $ref: '#/components/schemas/UpdateCustomPolicyContentRequest'
- $ref: '#/components/schemas/UpdateIcebergCompactionPolicyContentRequest'
- $ref: '#/components/schemas/UpdateIcebergOrphanFileRemovalPolicyContentRequest'
- $ref: '#/components/schemas/UpdateIcebergRewriteManifestsPolicyContentRequest'
- $ref: '#/components/schemas/UpdateIcebergSnapshotExpirationPolicyContentRequest'
- $ref: '#/components/schemas/UpdateRowFilterPolicyContentRequest'
- $ref: '#/components/schemas/UpdateColumnMaskPolicyContentRequest'
- $ref: '#/components/schemas/UpdateAccessControlPolicyContentRequest'
example: {
"@type": "updateContent",
"policyType": "custom",
"newContent": {
"policyType": "custom",
"customRules": {
"rule1": 456
},
"supportedObjectTypes": [
"CATALOG",
"SCHEMA",
"TABLE",
"FILESET",
"TOPIC",
"MODEL"
],
"properties": {
"key1": "new_value1",
"key2": "new_value2"
}
}
}
PolicyResponse:
type: object
properties:
code:
type: integer
format: int32
description: Status code of the response
enum:
- 0
policy:
$ref: "#/components/schemas/Policy"
examples:
PolicyNameListResponse:
value: {
"code": 0,
"names": ["my_policy1"],
"hasInaccessiblePolicies": true
}
NameListResponse:
value: {
"code": 0,
"names": ["my_policy1", "my_policy2"]
}
PolicyListResponse:
value: {
"code": 0,
"policies": [
{
"name": "my_policy1",
"comment": "This is a test policy",
"policyType": "custom",
"enabled": false,
"content": {
"customRules": {
"rule1": 123
},
"supportedObjectTypes": [
"CATALOG",
"SCHEMA",
"TABLE",
"FILESET",
"TOPIC",
"MODEL"
],
"properties": {
"key1": "value1"
}
},
"inherited": null,
"audit": {
"creator": "anonymous",
"createTime": "2025-08-04T10:29:23.463Z"
}
}
]
}
MetadataObjectPolicyListResponse:
value: {
"code": 0,
"policies": [],
"hasInaccessiblePolicies": true
}
PolicyCreate:
value: {
"name": "my_policy1",
"comment": "This is a test policy",
"policyType": "custom",
"enabled": false,
"content": {
"customRules": {
"rule1": 123
},
"supportedObjectTypes": [
"CATALOG",
"SCHEMA",
"TABLE",
"FILESET",
"TOPIC",
"MODEL"
],
"properties": {
"key1": "value1"
}
}
}
PolicyCreateLowercaseType:
summary: Create a compaction policy with the canonical lowercase policyType
value: {
"name": "compaction_policy",
"policyType": "system_iceberg_compaction",
"content": {
"maxPartitionNum": 5
}
}
PolicyCreateUppercaseType:
summary: Create a compaction policy with an uppercase policyType
value: {
"name": "compaction_policy",
"policyType": "SYSTEM_ICEBERG_COMPACTION",
"content": {
"maxPartitionNum": 5
}
}
PolicyCreateMixedCaseType:
summary: Create a compaction policy with a mixed-case policyType
value: {
"name": "compaction_policy",
"policyType": "System_Iceberg_Compaction",
"content": {
"maxPartitionNum": 5
}
}
PolicyUpdateContentLowercaseType:
summary: Update compaction content with the canonical lowercase policyType
value: {
"updates": [
{
"@type": "updateContent",
"policyType": "system_iceberg_compaction",
"newContent": {
"maxPartitionNum": 5
}
}
]
}
PolicyUpdateContentUppercaseType:
summary: Update compaction content with an uppercase policyType
value: {
"updates": [
{
"@type": "updateContent",
"policyType": "SYSTEM_ICEBERG_COMPACTION",
"newContent": {
"maxPartitionNum": 5
}
}
]
}
PolicyUpdateContentMixedCaseType:
summary: Update compaction content with a mixed-case policyType
value: {
"updates": [
{
"@type": "updateContent",
"policyType": "System_Iceberg_Compaction",
"newContent": {
"maxPartitionNum": 5
}
}
]
}
PolicyResponse:
value: {
"code": 0,
"policy": {
"name": "my_policy1",
"comment": "This is a test policy",
"policyType": "custom",
"enabled": false,
"content": {
"customRules": {
"rule1": 123
},
"supportedObjectTypes": [
"SCHEMA",
"TABLE",
"MODEL",
"TOPIC",
"FILESET",
"CATALOG"
],
"properties": {
"key1": "value1"
}
},
"inherited": null,
"audit": {
"creator": "anonymous",
"createTime": "2025-08-04T10:29:23.463Z"
}
}
}
PolicyAlreadyExistsException:
value: {
"code": 1004,
"type": "PolicyAlreadyExistsException",
"message": "Failed to operate policy(s) [my_policy] operation [CREATE], reason [PolicyAlreadyExistsException]",
"stack": [
"org.apache.gravitino.exceptions.PolicyAlreadyExistsException: Gag my_policy already exists",
"..."
]
}
NoSuchPolicyException:
value: {
"code": 1003,
"type": "NoSuchPolicyException",
"message": "Failed to operate policy(s) [my_policy] operation [LOAD] under metalake [my_test_metalake], reason [NoSuchPolicyException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchPolicyException: Policy my_policy does not exist",
"..."
]
}