Skip to content

Commit 8284ee3

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

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,30 @@ 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+
457+
class GcsCredentials(BaseModel):
458+
token: str
459+
expires_at_ms: Optional[int] = Field(None, alias='expires-at-ms')
460+
461+
462+
class Credentials(BaseModel):
463+
aws: Optional[AwsCredentials] = None
464+
azure: Optional[AzureCredentials] = None
465+
gcs: Optional[GcsCredentials] = None
466+
467+
444468
class RegisterTableRequest(BaseModel):
445469
name: str
446470
metadata_location: str = Field(..., alias='metadata-location')
@@ -1113,6 +1137,11 @@ class LoadTableResult(BaseModel):
11131137
- `s3.session-token`: if present, this value should be used for as the session token
11141138
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
11151139
1140+
## Credentials
1141+
1142+
Credentials for Azure / AWS / GCS are provided through the `credentials` field. Clients should first check whether the
1143+
respective credentials exist in the `credentials` field before checking the `config` for credentials.
1144+
11161145
"""
11171146

11181147
metadata_location: Optional[str] = Field(
@@ -1121,6 +1150,7 @@ class LoadTableResult(BaseModel):
11211150
description='May be null if the table is staged as part of a transaction',
11221151
)
11231152
metadata: TableMetadata
1153+
credentials: Optional[Credentials] = None
11241154
config: Optional[Dict[str, str]] = None
11251155

11261156

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

11881223
metadata_location: str = Field(..., alias='metadata-location')
11891224
metadata: ViewMetadata
1225+
credentials: Optional[Credentials] = None
11901226
config: Optional[Dict[str, str]] = None
11911227

11921228

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)