diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index 6c9cf9d5c17e..20674f4564bf 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -194,6 +194,13 @@ class SortOrder(BaseModel): fields: List[SortField] +class EncryptedKey(BaseModel): + key_id: str = Field(..., alias='key-id') + encrypted_key_metadata: str = Field(..., alias='encrypted-key-metadata') + encrypted_by_id: Optional[str] = Field(None, alias='encrypted-by-id') + properties: Optional[Dict[str, str]] = None + + class Summary(BaseModel): operation: Literal['append', 'replace', 'overwrite', 'delete'] @@ -395,6 +402,16 @@ class RemoveSchemasUpdate(BaseUpdate): schema_ids: List[int] = Field(..., alias='schema-ids') +class AddEncryptionKeyUpdate(BaseUpdate): + action: str = Field('add-encryption-key', const=True) + encryption_key: EncryptedKey = Field(..., alias='encryption-key') + + +class RemoveEncryptionKeyUpdate(BaseUpdate): + action: str = Field('remove-encryption-key', const=True) + key_id: str = Field(..., alias='key-id') + + class TableRequirement(BaseModel): type: str @@ -1135,6 +1152,7 @@ class TableMetadata(BaseModel): last_partition_id: Optional[int] = Field(None, alias='last-partition-id') sort_orders: Optional[List[SortOrder]] = Field(None, alias='sort-orders') default_sort_order_id: Optional[int] = Field(None, alias='default-sort-order-id') + encryption_keys: Optional[List[EncryptedKey]] = Field(None, alias='encryption-keys') snapshots: Optional[List[Snapshot]] = None refs: Optional[SnapshotReferences] = None current_snapshot_id: Optional[int] = Field(None, alias='current-snapshot-id') @@ -1189,6 +1207,8 @@ class TableUpdate(BaseModel): RemoveStatisticsUpdate, RemovePartitionSpecsUpdate, RemoveSchemasUpdate, + AddEncryptionKeyUpdate, + RemoveEncryptionKeyUpdate, ] diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index 2bd6fdfad13a..ebabf5671844 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -2388,6 +2388,25 @@ components: items: $ref: '#/components/schemas/SortField' + EncryptedKey: + type: object + required: + - key-id + - encrypted-key-metadata + properties: + key-id: + type: string + encrypted-key-metadata: + type: string + format: byte # for compatibility + contentEncoding: base64 + encrypted-by-id: + type: string + properties: + type: object + additionalProperties: + type: string + Snapshot: type: object required: @@ -2525,6 +2544,11 @@ components: $ref: '#/components/schemas/SortOrder' default-sort-order-id: type: integer + # encryption + encryption-keys: + type: list + items: + $ref: '#/components/schemas/EncryptedKey' # snapshot tracking snapshots: type: array @@ -2679,6 +2703,8 @@ components: remove-partition-statistics: '#/components/schemas/RemovePartitionStatisticsUpdate' remove-partition-specs: '#/components/schemas/RemovePartitionSpecsUpdate' remove-schemas: '#/components/schemas/RemoveSchemasUpdate' + add-encryption-key: '#/components/schemas/AddEncryptionKeyUpdate' + remove-encryption-key: '#/components/schemas/RemoveEncryptionKeyUpdate' type: object required: - action @@ -2997,6 +3023,30 @@ components: items: type: integer + AddEncryptionKeyUpdate: + allOf: + - $ref: '#/components/schemas/BaseUpdate' + required: + - encryption-key + properties: + action: + type: string + const: "add-encryption-key" + encryption-key: + $ref: '#/components/schemas/EncryptedKey' + + RemoveEncryptionKeyUpdate: + allOf: + - $ref: '#/components/schemas/BaseUpdate' + required: + - key-id + properties: + action: + type: string + const: "remove-encryption-key" + key-id: + type: string + TableUpdate: anyOf: - $ref: '#/components/schemas/AssignUUIDUpdate' @@ -3018,6 +3068,8 @@ components: - $ref: '#/components/schemas/RemoveStatisticsUpdate' - $ref: '#/components/schemas/RemovePartitionSpecsUpdate' - $ref: '#/components/schemas/RemoveSchemasUpdate' + - $ref: '#/components/schemas/AddEncryptionKeyUpdate' + - $ref: '#/components/schemas/RemoveEncryptionKeyUpdate' ViewUpdate: anyOf: