Skip to content

Commit 785f6c1

Browse files
committed
Make storage_credentials a list
1 parent 46887ce commit 785f6c1

2 files changed

Lines changed: 71 additions & 46 deletions

File tree

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

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,8 +1168,8 @@ class ViewUpdate(BaseModel):
11681168
]
11691169

11701170

1171-
class Credentials(BaseModel):
1172-
__root__: Union[ADLSCredentials, GCSCredentials, S3Credentials] = Field(
1171+
class Credential(BaseModel):
1172+
__root__: Union[ADLSCredential, GCSCredential, S3Credential] = Field(
11731173
..., discriminator='type'
11741174
)
11751175

@@ -1201,10 +1201,11 @@ class LoadTableResult(BaseModel):
12011201
- `s3.session-token`: if present, this value should be used for as the session token
12021202
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
12031203
1204-
## Credentials
1204+
## Storage Credentials
12051205
1206-
Credentials for ADLS / GCS / S3 are provided through the `credentials` field. Clients should first check whether the
1207-
respective credentials exist in the `credentials` field before checking the `config` for credentials.
1206+
Credentials for ADLS / GCS / S3 are provided through the `storage-credentials` field.
1207+
In order to avoid leaking non-expiring credentials, all credentials are required to have an expiration.
1208+
Clients should first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
12081209
12091210
"""
12101211

@@ -1214,7 +1215,9 @@ class LoadTableResult(BaseModel):
12141215
description='May be null if the table is staged as part of a transaction',
12151216
)
12161217
metadata: TableMetadata
1217-
credentials: Optional[Credentials] = None
1218+
storage_credentials: Optional[List[Credential]] = Field(
1219+
None, alias='storage-credentials'
1220+
)
12181221
config: Optional[Dict[str, str]] = None
12191222

12201223

@@ -1323,16 +1326,19 @@ class LoadViewResult(BaseModel):
13231326
13241327
- `token`: Authorization bearer token to use for view requests if OAuth2 security is enabled
13251328
1326-
## Credentials
1329+
## Storage Credentials
13271330
1328-
Credentials for ADLS / GCS / S3 are provided through the `credentials` field. Clients should first check whether the
1329-
respective credentials exist in the `credentials` field before checking the `config` for credentials.
1331+
Credentials for ADLS / GCS / S3 are provided through the `storage-credentials` field.
1332+
In order to avoid leaking non-expiring credentials, all credentials are required to have an expiration.
1333+
Clients should first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
13301334
13311335
"""
13321336

13331337
metadata_location: str = Field(..., alias='metadata-location')
13341338
metadata: ViewMetadata
1335-
credentials: Optional[Credentials] = None
1339+
storage_credentials: Optional[List[Credential]] = Field(
1340+
None, alias='storage-credentials'
1341+
)
13361342
config: Optional[Dict[str, str]] = None
13371343

13381344

@@ -1416,35 +1422,38 @@ class Schema(StructType):
14161422
)
14171423

14181424

1419-
class ADLSCredentials(BaseModel):
1425+
class ADLSCredential(BaseModel):
14201426
type: Literal['adls']
1427+
scheme: str
14211428
sas_token: str = Field(..., alias='sas-token')
14221429
expires_at_ms: int = Field(
14231430
...,
14241431
alias='expires-at-ms',
1425-
description='The epoch millis at which the given token expires',
1432+
description='The epoch millis since 1970-01-01T00:00:00Z at which the given token expires',
14261433
)
14271434

14281435

1429-
class GCSCredentials(BaseModel):
1436+
class GCSCredential(BaseModel):
14301437
type: Literal['gcs']
1438+
scheme: str
14311439
token: str
14321440
expires_at_ms: int = Field(
14331441
...,
14341442
alias='expires-at-ms',
1435-
description='The epoch millis at which the given token expires',
1443+
description='The epoch millis since 1970-01-01T00:00:00Z at which the given token expires',
14361444
)
14371445

14381446

1439-
class S3Credentials(BaseModel):
1447+
class S3Credential(BaseModel):
14401448
type: Literal['s3']
1449+
scheme: str
14411450
access_key_id: str = Field(..., alias='access-key-id')
14421451
secret_access_key: str = Field(..., alias='secret-access-key')
14431452
session_token: str = Field(..., alias='session-token')
14441453
expires_at_ms: int = Field(
14451454
...,
14461455
alias='expires-at-ms',
1447-
description='The epoch millis at which the given token expires',
1456+
description='The epoch millis since 1970-01-01T00:00:00Z at which the given token expires',
14481457
)
14491458

14501459

@@ -1480,16 +1489,16 @@ class CompletedPlanningWithIDResult(CompletedPlanningResult):
14801489
TableMetadata.update_forward_refs()
14811490
ViewMetadata.update_forward_refs()
14821491
AddSchemaUpdate.update_forward_refs()
1483-
Credentials.update_forward_refs()
1492+
Credential.update_forward_refs()
14841493
ScanTasks.update_forward_refs()
14851494
FetchPlanningResult.update_forward_refs()
14861495
PlanTableScanResult.update_forward_refs()
14871496
CreateTableRequest.update_forward_refs()
14881497
CreateViewRequest.update_forward_refs()
14891498
ReportMetricsRequest.update_forward_refs()
1490-
ADLSCredentials.update_forward_refs()
1491-
GCSCredentials.update_forward_refs()
1492-
S3Credentials.update_forward_refs()
1499+
ADLSCredential.update_forward_refs()
1500+
GCSCredential.update_forward_refs()
1501+
S3Credential.update_forward_refs()
14931502
CompletedPlanningResult.update_forward_refs()
14941503
FetchScanTasksResult.update_forward_refs()
14951504
CompletedPlanningWithIDResult.update_forward_refs()

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

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,50 +3103,58 @@ components:
31033103
uuid:
31043104
type: string
31053105

3106-
ADLSCredentials:
3106+
ADLSCredential:
31073107
type: object
31083108
allOf:
3109-
- $ref: '#/components/schemas/Credentials'
3109+
- $ref: '#/components/schemas/Credential'
31103110
required:
31113111
- type
3112+
- scheme
31123113
- sas-token
31133114
- expires-at-ms
31143115
properties:
31153116
type:
31163117
type: string
31173118
enum: [ "adls" ]
3119+
scheme:
3120+
type: string
31183121
sas-token:
31193122
type: string
31203123
expires-at-ms:
31213124
type: integer
31223125
format: int64
3123-
description: The epoch millis at which the given token expires
3126+
description: The epoch millis since 1970-01-01T00:00:00Z at which the given token expires
3127+
31243128

3125-
GCSCredentials:
3129+
GCSCredential:
31263130
type: object
31273131
allOf:
3128-
- $ref: '#/components/schemas/Credentials'
3132+
- $ref: '#/components/schemas/Credential'
31293133
required:
31303134
- type
3135+
- scheme
31313136
- token
31323137
- expires-at-ms
31333138
properties:
31343139
type:
31353140
type: string
31363141
enum: [ "gcs" ]
3142+
scheme:
3143+
type: string
31373144
token:
31383145
type: string
31393146
expires-at-ms:
31403147
type: integer
31413148
format: int64
3142-
description: The epoch millis at which the given token expires
3149+
description: The epoch millis since 1970-01-01T00:00:00Z at which the given token expires
31433150

3144-
S3Credentials:
3151+
S3Credential:
31453152
type: object
31463153
allOf:
3147-
- $ref: '#/components/schemas/Credentials'
3154+
- $ref: '#/components/schemas/Credential'
31483155
required:
31493156
- type
3157+
- scheme
31503158
- access-key-id
31513159
- secret-access-key
31523160
- session-token
@@ -3155,6 +3163,8 @@ components:
31553163
type:
31563164
type: string
31573165
enum: [ "s3" ]
3166+
scheme:
3167+
type: string
31583168
access-key-id:
31593169
type: string
31603170
secret-access-key:
@@ -3164,20 +3174,20 @@ components:
31643174
expires-at-ms:
31653175
type: integer
31663176
format: int64
3167-
description: The epoch millis at which the given token expires
3177+
description: The epoch millis since 1970-01-01T00:00:00Z at which the given token expires
31683178

3169-
Credentials:
3179+
Credential:
31703180
type: object
31713181
discriminator:
31723182
propertyName: type
31733183
mapping:
3174-
adls: '#/components/schemas/ADLSCredentials'
3175-
gcs: '#/components/schemas/GCSCredentials'
3176-
s3: '#/components/schemas/S3Credentials'
3184+
adls: '#/components/schemas/ADLSCredential'
3185+
gcs: '#/components/schemas/GCSCredential'
3186+
s3: '#/components/schemas/S3Credential'
31773187
oneOf:
3178-
- $ref: '#/components/schemas/ADLSCredentials'
3179-
- $ref: '#/components/schemas/GCSCredentials'
3180-
- $ref: '#/components/schemas/S3Credentials'
3188+
- $ref: '#/components/schemas/ADLSCredential'
3189+
- $ref: '#/components/schemas/GCSCredential'
3190+
- $ref: '#/components/schemas/S3Credential'
31813191

31823192
LoadTableResult:
31833193
description: |
@@ -3206,10 +3216,11 @@ components:
32063216
- `s3.session-token`: if present, this value should be used for as the session token
32073217
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
32083218
3209-
## Credentials
3219+
## Storage Credentials
32103220
3211-
Credentials for ADLS / GCS / S3 are provided through the `credentials` field. Clients should first check whether the
3212-
respective credentials exist in the `credentials` field before checking the `config` for credentials.
3221+
Credentials for ADLS / GCS / S3 are provided through the `storage-credentials` field.
3222+
In order to avoid leaking non-expiring credentials, all credentials are required to have an expiration.
3223+
Clients should first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
32133224
type: object
32143225
required:
32153226
- metadata
@@ -3219,8 +3230,10 @@ components:
32193230
description: May be null if the table is staged as part of a transaction
32203231
metadata:
32213232
$ref: '#/components/schemas/TableMetadata'
3222-
credentials:
3223-
$ref: '#/components/schemas/Credentials'
3233+
storage-credentials:
3234+
type: array
3235+
items:
3236+
$ref: '#/components/schemas/Credential'
32243237
config:
32253238
type: object
32263239
additionalProperties:
@@ -3478,10 +3491,11 @@ components:
34783491
34793492
- `token`: Authorization bearer token to use for view requests if OAuth2 security is enabled
34803493
3481-
## Credentials
3494+
## Storage Credentials
34823495
3483-
Credentials for ADLS / GCS / S3 are provided through the `credentials` field. Clients should first check whether the
3484-
respective credentials exist in the `credentials` field before checking the `config` for credentials.
3496+
Credentials for ADLS / GCS / S3 are provided through the `storage-credentials` field.
3497+
In order to avoid leaking non-expiring credentials, all credentials are required to have an expiration.
3498+
Clients should first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
34853499
type: object
34863500
required:
34873501
- metadata-location
@@ -3491,8 +3505,10 @@ components:
34913505
type: string
34923506
metadata:
34933507
$ref: '#/components/schemas/ViewMetadata'
3494-
credentials:
3495-
$ref: '#/components/schemas/Credentials'
3508+
storage-credentials:
3509+
type: array
3510+
items:
3511+
$ref: '#/components/schemas/Credential'
34963512
config:
34973513
type: object
34983514
additionalProperties:

0 commit comments

Comments
 (0)