Skip to content

Commit f1005bc

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

2 files changed

Lines changed: 63 additions & 42 deletions

File tree

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

Lines changed: 25 additions & 18 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

@@ -1203,8 +1203,8 @@ class LoadTableResult(BaseModel):
12031203
12041204
## 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. Clients should first check whether the
1207+
respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
12081208
12091209
"""
12101210

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

12201222

@@ -1325,14 +1327,16 @@ class LoadViewResult(BaseModel):
13251327
13261328
## Credentials
13271329
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.
1330+
Credentials for ADLS / GCS / S3 are provided through the `storage-credentials` field. Clients should first check whether the
1331+
respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
13301332
13311333
"""
13321334

13331335
metadata_location: str = Field(..., alias='metadata-location')
13341336
metadata: ViewMetadata
1335-
credentials: Optional[Credentials] = None
1337+
storage_credentials: Optional[List[Credential]] = Field(
1338+
None, alias='storage-credentials'
1339+
)
13361340
config: Optional[Dict[str, str]] = None
13371341

13381342

@@ -1416,35 +1420,38 @@ class Schema(StructType):
14161420
)
14171421

14181422

1419-
class ADLSCredentials(BaseModel):
1423+
class ADLSCredential(BaseModel):
14201424
type: Literal['adls']
1425+
scheme: str
14211426
sas_token: str = Field(..., alias='sas-token')
14221427
expires_at_ms: int = Field(
14231428
...,
14241429
alias='expires-at-ms',
1425-
description='The epoch millis at which the given token expires',
1430+
description='The epoch millis since 1970-01-01T00:00:00Z at which the given token expires',
14261431
)
14271432

14281433

1429-
class GCSCredentials(BaseModel):
1434+
class GCSCredential(BaseModel):
14301435
type: Literal['gcs']
1436+
scheme: str
14311437
token: str
14321438
expires_at_ms: int = Field(
14331439
...,
14341440
alias='expires-at-ms',
1435-
description='The epoch millis at which the given token expires',
1441+
description='The epoch millis since 1970-01-01T00:00:00Z at which the given token expires',
14361442
)
14371443

14381444

1439-
class S3Credentials(BaseModel):
1445+
class S3Credential(BaseModel):
14401446
type: Literal['s3']
1447+
scheme: str
14411448
access_key_id: str = Field(..., alias='access-key-id')
14421449
secret_access_key: str = Field(..., alias='secret-access-key')
14431450
session_token: str = Field(..., alias='session-token')
14441451
expires_at_ms: int = Field(
14451452
...,
14461453
alias='expires-at-ms',
1447-
description='The epoch millis at which the given token expires',
1454+
description='The epoch millis since 1970-01-01T00:00:00Z at which the given token expires',
14481455
)
14491456

14501457

@@ -1480,16 +1487,16 @@ class CompletedPlanningWithIDResult(CompletedPlanningResult):
14801487
TableMetadata.update_forward_refs()
14811488
ViewMetadata.update_forward_refs()
14821489
AddSchemaUpdate.update_forward_refs()
1483-
Credentials.update_forward_refs()
1490+
Credential.update_forward_refs()
14841491
ScanTasks.update_forward_refs()
14851492
FetchPlanningResult.update_forward_refs()
14861493
PlanTableScanResult.update_forward_refs()
14871494
CreateTableRequest.update_forward_refs()
14881495
CreateViewRequest.update_forward_refs()
14891496
ReportMetricsRequest.update_forward_refs()
1490-
ADLSCredentials.update_forward_refs()
1491-
GCSCredentials.update_forward_refs()
1492-
S3Credentials.update_forward_refs()
1497+
ADLSCredential.update_forward_refs()
1498+
GCSCredential.update_forward_refs()
1499+
S3Credential.update_forward_refs()
14931500
CompletedPlanningResult.update_forward_refs()
14941501
FetchScanTasksResult.update_forward_refs()
14951502
CompletedPlanningWithIDResult.update_forward_refs()

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

Lines changed: 38 additions & 24 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: |
@@ -3208,8 +3218,8 @@ components:
32083218
32093219
## 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. Clients should first check whether the
3222+
respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
32133223
type: object
32143224
required:
32153225
- metadata
@@ -3219,8 +3229,10 @@ components:
32193229
description: May be null if the table is staged as part of a transaction
32203230
metadata:
32213231
$ref: '#/components/schemas/TableMetadata'
3222-
credentials:
3223-
$ref: '#/components/schemas/Credentials'
3232+
storage-credentials:
3233+
type: array
3234+
items:
3235+
$ref: '#/components/schemas/Credential'
32243236
config:
32253237
type: object
32263238
additionalProperties:
@@ -3480,8 +3492,8 @@ components:
34803492
34813493
## Credentials
34823494
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.
3495+
Credentials for ADLS / GCS / S3 are provided through the `storage-credentials` field. Clients should first check whether the
3496+
respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
34853497
type: object
34863498
required:
34873499
- metadata-location
@@ -3491,8 +3503,10 @@ components:
34913503
type: string
34923504
metadata:
34933505
$ref: '#/components/schemas/ViewMetadata'
3494-
credentials:
3495-
$ref: '#/components/schemas/Credentials'
3506+
storage-credentials:
3507+
type: array
3508+
items:
3509+
$ref: '#/components/schemas/Credential'
34963510
config:
34973511
type: object
34983512
additionalProperties:

0 commit comments

Comments
 (0)