Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(specs): add authentications to ingestion transformations #3494

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions specs/ingestion/common/schemas/transformation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Transformation:
properties:
transformationID:
$ref: './common.yml#/transformationID'
authenticationIDs:
$ref: '#/AuthenticationIDs'
code:
$ref: '#/Code'
name:
Expand Down Expand Up @@ -32,6 +34,12 @@ Description:
type: string
description: A descriptive name for your transformation of what it does.

AuthenticationIDs:
description: The authentications associated for the current transformation.
type: array
items:
$ref: './common.yml#/authenticationID'

TransformationCreate:
type: object
additionalProperties: false
Expand All @@ -43,6 +51,8 @@ TransformationCreate:
$ref: '#/Name'
description:
$ref: '#/Description'
authenticationIDs:
$ref: '#/AuthenticationIDs'
required:
- code
- name
Expand Down Expand Up @@ -93,6 +103,10 @@ TransformationTry:
sampleRecord:
description: The record to apply the given code to.
type: object
authentications:
type: array
items:
$ref: './authentication.yml#/AuthenticationCreate'
required:
- code
- sampleRecord
Expand Down
27 changes: 27 additions & 0 deletions specs/ingestion/paths/transformations/transformationTryID.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
post:
tags:
- transformations
summary: Try a transformation
description: Try a transformation before updating it.
operationId: tryTransformationBeforeUpdate
x-acl:
- addObject
- deleteIndex
- editSettings
parameters:
- $ref: '../../common/parameters.yml#/pathTransformationID'
requestBody:
content:
application/json:
schema:
$ref: '../../common/schemas/transformation.yml#/TransformationTry'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../../common/schemas/transformation.yml#/TransformationTryResponse'
'400':
$ref: '../../../common/responses/BadRequest.yml'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ post:
tags:
- transformations
summary: Try a transformation
description: Try a transformation.
description: Try a transformation before creating it.
operationId: tryTransformation
x-acl:
- addObject
Expand Down
2 changes: 2 additions & 0 deletions specs/ingestion/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ paths:
$ref: 'paths/transformations/transformationsModels.yml'
/1/transformations/{transformationID}:
$ref: 'paths/transformations/transformationID.yml'
/1/transformations/{transformationID}/try:
$ref: 'paths/transformations/transformationTryID.yml'

# observability API.
/1/runs:
Expand Down
41 changes: 41 additions & 0 deletions tests/CTS/requests/ingestion/tryTransformation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,46 @@
}
}
}
},
{
"testName": "with authentications",
"parameters": {
"code": "foo",
"sampleRecord": {
"bar": "baz"
},
"authentications": [
{
"type": "oauth",
"name": "authName",
"input": {
"url": "http://test.oauth",
"client_id": "myID",
"client_secret": "mySecret"
}
}
]
},
"request": {
"path": "/1/transformations/try",
"method": "POST",
"body": {
"code": "foo",
"sampleRecord": {
"bar": "baz"
},
"authentications": [
{
"type": "oauth",
"name": "authName",
"input": {
"url": "http://test.oauth",
"client_id": "myID",
"client_secret": "mySecret"
}
}
]
}
}
}
]
67 changes: 67 additions & 0 deletions tests/CTS/requests/ingestion/tryTransformationBeforeUpdate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[
{
"parameters": {
"transformationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"transformationTry": {
"code": "foo",
"sampleRecord": {
"bar": "baz"
}
}
},
"request": {
"path": "/1/transformations/6c02aeb1-775e-418e-870b-1faccd4b2c0f/try",
"method": "POST",
"body": {
"code": "foo",
"sampleRecord": {
"bar": "baz"
}
}
}
},
{
"testName": "existing with authentications",
"parameters": {
"transformationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"transformationTry": {
"code": "foo",
"sampleRecord": {
"bar": "baz"
},
"authentications": [
{
"type": "oauth",
"name": "authName",
"input": {
"url": "http://test.oauth",
"client_id": "myID",
"client_secret": "mySecret"
}
}
]
}
},
"request": {
"path": "/1/transformations/6c02aeb1-775e-418e-870b-1faccd4b2c0f/try",
"method": "POST",
"body": {
"code": "foo",
"sampleRecord": {
"bar": "baz"
},
"authentications": [
{
"type": "oauth",
"name": "authName",
"input": {
"url": "http://test.oauth",
"client_id": "myID",
"client_secret": "mySecret"
}
}
]
}
}
}
]
Loading