Skip to content

Commit c00f5ac

Browse files
committed
OpenAPI: Standardize credentials in loadTable/loadView responses
1 parent cb6540c commit c00f5ac

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

open-api/rest-catalog-open-api.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,19 @@ class AssertViewUUID(BaseModel):
441441
uuid: str
442442

443443

444+
class AzureCredentials(BaseModel):
445+
account_name: Optional[str] = Field(None, alias='account-name')
446+
account_key: Optional[str] = Field(None, alias='account-key')
447+
token: Optional[str] = None
448+
449+
450+
class AwsCredentials(BaseModel):
451+
access_key_id: str = Field(..., alias='access-key-id')
452+
secret_access_key: str = Field(..., alias='secret-access-key')
453+
token: Optional[str] = None
454+
expires_at_ms: Optional[int] = Field(None, alias='expires-at-ms')
455+
456+
444457
class RegisterTableRequest(BaseModel):
445458
name: str
446459
metadata_location: str = Field(..., alias='metadata-location')
@@ -823,6 +836,10 @@ class EqualityDeleteFile(ContentFile):
823836
)
824837

825838

839+
class GcsCredentials(BaseModel):
840+
__root__: Any
841+
842+
826843
class CreateNamespaceRequest(BaseModel):
827844
namespace: Namespace
828845
properties: Optional[Dict[str, str]] = Field(
@@ -867,6 +884,12 @@ class ViewRequirement(BaseModel):
867884
__root__: AssertViewUUID = Field(..., discriminator='type')
868885

869886

887+
class Credentials(BaseModel):
888+
aws: Optional[AwsCredentials] = None
889+
azure: Optional[AzureCredentials] = None
890+
gcs: Optional[GcsCredentials] = None
891+
892+
870893
class ReportMetricsRequest2(CommitReport):
871894
report_type: str = Field(..., alias='report-type')
872895

@@ -1113,6 +1136,11 @@ class LoadTableResult(BaseModel):
11131136
- `s3.session-token`: if present, this value should be used for as the session token
11141137
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
11151138
1139+
## Credentials
1140+
1141+
Credentials for Azure / AWS / GCS are provided through the `credentials` field. Clients should first check whether the
1142+
respective credentials exist in the `credentials` field before checking the `config` for credentials.
1143+
11161144
"""
11171145

11181146
metadata_location: Optional[str] = Field(
@@ -1121,6 +1149,7 @@ class LoadTableResult(BaseModel):
11211149
description='May be null if the table is staged as part of a transaction',
11221150
)
11231151
metadata: TableMetadata
1152+
credentials: Optional[Credentials] = None
11241153
config: Optional[Dict[str, str]] = None
11251154

11261155

@@ -1183,10 +1212,16 @@ class LoadViewResult(BaseModel):
11831212
11841213
- `token`: Authorization bearer token to use for view requests if OAuth2 security is enabled
11851214
1215+
## Credentials
1216+
1217+
Credentials for Azure / AWS / GCS are provided through the `credentials` field. Clients should first check whether the
1218+
respective credentials exist in the `credentials` field before checking the `config` for credentials.
1219+
11861220
"""
11871221

11881222
metadata_location: str = Field(..., alias='metadata-location')
11891223
metadata: ViewMetadata
1224+
credentials: Optional[Credentials] = None
11901225
config: Optional[Dict[str, str]] = None
11911226

11921227

open-api/rest-catalog-open-api.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,6 +2747,54 @@ components:
27472747
uuid:
27482748
type: string
27492749

2750+
AzureCredentials:
2751+
type: object
2752+
properties:
2753+
account-name:
2754+
type: string
2755+
account-key:
2756+
type: string
2757+
token:
2758+
type: string
2759+
2760+
AwsCredentials:
2761+
type: object
2762+
required:
2763+
- access-key-id
2764+
- secret-access-key
2765+
properties:
2766+
access-key-id:
2767+
type: string
2768+
secret-access-key:
2769+
type: string
2770+
token:
2771+
type: string
2772+
expires-at-ms:
2773+
type: integer
2774+
format: int64
2775+
2776+
GcsCredentials:
2777+
type: object
2778+
required:
2779+
- token
2780+
- expires-at
2781+
properties:
2782+
token:
2783+
type: string
2784+
expires-at-ms:
2785+
type: integer
2786+
format: int64
2787+
2788+
Credentials:
2789+
type: object
2790+
properties:
2791+
aws:
2792+
$ref: '#/components/schemas/AwsCredentials'
2793+
azure:
2794+
$ref: '#/components/schemas/AzureCredentials'
2795+
gcs:
2796+
$ref: '#/components/schemas/GcsCredentials'
2797+
27502798
LoadTableResult:
27512799
description: |
27522800
Result used when a table is successfully loaded.
@@ -2773,6 +2821,11 @@ components:
27732821
- `s3.secret-access-key`: secret for credentials that provide access to data in S3
27742822
- `s3.session-token`: if present, this value should be used for as the session token
27752823
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
2824+
2825+
## Credentials
2826+
2827+
Credentials for Azure / AWS / GCS are provided through the `credentials` field. Clients should first check whether the
2828+
respective credentials exist in the `credentials` field before checking the `config` for credentials.
27762829
type: object
27772830
required:
27782831
- metadata
@@ -2782,6 +2835,8 @@ components:
27822835
description: May be null if the table is staged as part of a transaction
27832836
metadata:
27842837
$ref: '#/components/schemas/TableMetadata'
2838+
credentials:
2839+
$ref: '#/components/schemas/Credentials'
27852840
config:
27862841
type: object
27872842
additionalProperties:
@@ -2905,6 +2960,10 @@ components:
29052960
29062961
- `token`: Authorization bearer token to use for view requests if OAuth2 security is enabled
29072962
2963+
## Credentials
2964+
2965+
Credentials for Azure / AWS / GCS are provided through the `credentials` field. Clients should first check whether the
2966+
respective credentials exist in the `credentials` field before checking the `config` for credentials.
29082967
type: object
29092968
required:
29102969
- metadata-location
@@ -2914,6 +2973,8 @@ components:
29142973
type: string
29152974
metadata:
29162975
$ref: '#/components/schemas/ViewMetadata'
2976+
credentials:
2977+
$ref: '#/components/schemas/Credentials'
29172978
config:
29182979
type: object
29192980
additionalProperties:

0 commit comments

Comments
 (0)