Skip to content

Commit

Permalink
OpenAPI: Standardize credentials in loadTable/loadView responses (#10722
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nastra authored Oct 18, 2024
1 parent 8a931e8 commit 44233fa
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions open-api/rest-catalog-open-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,14 @@ class AssertViewUUID(BaseModel):
uuid: str


class StorageCredential(BaseModel):
prefix: str = Field(
...,
description='Indicates a storage location prefix where the credential is relevant. Clients should choose the most specific prefix (by selecting the longest prefix) if several credentials of the same type are available.',
)
config: Dict[str, str]


class PlanStatus(BaseModel):
__root__: Literal['completed', 'submitted', 'cancelled', 'failed'] = Field(
..., description='Status of a server-side planning operation'
Expand Down Expand Up @@ -1195,6 +1203,11 @@ class LoadTableResult(BaseModel):
- `s3.session-token`: if present, this value should be used for as the session token
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
## Storage Credentials
Credentials for ADLS / GCS / S3 / ... are provided through the `storage-credentials` field.
Clients must first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
"""

metadata_location: Optional[str] = Field(
Expand All @@ -1204,6 +1217,9 @@ class LoadTableResult(BaseModel):
)
metadata: TableMetadata
config: Optional[Dict[str, str]] = None
storage_credentials: Optional[List[StorageCredential]] = Field(
None, alias='storage-credentials'
)


class ScanTasks(BaseModel):
Expand Down Expand Up @@ -1311,11 +1327,19 @@ class LoadViewResult(BaseModel):
- `token`: Authorization bearer token to use for view requests if OAuth2 security is enabled
## Storage Credentials
Credentials for ADLS / GCS / S3 / ... are provided through the `storage-credentials` field.
Clients must first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
"""

metadata_location: str = Field(..., alias='metadata-location')
metadata: ViewMetadata
config: Optional[Dict[str, str]] = None
storage_credentials: Optional[List[StorageCredential]] = Field(
None, alias='storage-credentials'
)


class ReportMetricsRequest(BaseModel):
Expand Down
32 changes: 32 additions & 0 deletions open-api/rest-catalog-open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3103,6 +3103,21 @@ components:
uuid:
type: string

StorageCredential:
type: object
required:
- prefix
- config
properties:
prefix:
type: string
description: Indicates a storage location prefix where the credential is relevant. Clients should choose the most
specific prefix (by selecting the longest prefix) if several credentials of the same type are available.
config:
type: object
additionalProperties:
type: string

LoadTableResult:
description: |
Result used when a table is successfully loaded.
Expand All @@ -3129,6 +3144,11 @@ components:
- `s3.secret-access-key`: secret for credentials that provide access to data in S3
- `s3.session-token`: if present, this value should be used for as the session token
- `s3.remote-signing-enabled`: if `true` remote signing should be performed as described in the `s3-signer-open-api.yaml` specification
## Storage Credentials
Credentials for ADLS / GCS / S3 / ... are provided through the `storage-credentials` field.
Clients must first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
type: object
required:
- metadata
Expand All @@ -3142,6 +3162,10 @@ components:
type: object
additionalProperties:
type: string
storage-credentials:
type: array
items:
$ref: '#/components/schemas/StorageCredential'

ScanTasks:
type: object
Expand Down Expand Up @@ -3395,6 +3419,10 @@ components:
- `token`: Authorization bearer token to use for view requests if OAuth2 security is enabled
## Storage Credentials
Credentials for ADLS / GCS / S3 / ... are provided through the `storage-credentials` field.
Clients must first check whether the respective credentials exist in the `storage-credentials` field before checking the `config` for credentials.
type: object
required:
- metadata-location
Expand All @@ -3408,6 +3436,10 @@ components:
type: object
additionalProperties:
type: string
storage-credentials:
type: array
items:
$ref: '#/components/schemas/StorageCredential'

TokenType:
type: string
Expand Down

0 comments on commit 44233fa

Please sign in to comment.