From fe6f5edabc9f86740e09ed1984119b623858fc3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 24 Jul 2024 13:44:37 +0200 Subject: [PATCH] feat(specs): add v2 endpoints for ingestion (#3410) --- specs/ingestion/common/schemas/task.yml | 95 ++++++++++++++++++- .../paths/authentications/authentications.yml | 2 +- .../paths/destinations/destinations.yml | 2 +- specs/ingestion/paths/runs/events/events.yml | 2 +- specs/ingestion/paths/runs/runs.yml | 2 +- specs/ingestion/paths/sources/sources.yml | 2 +- .../ingestion/paths/tasks/v1/disableTask.yml | 22 +++++ specs/ingestion/paths/tasks/v1/enableTask.yml | 21 ++++ specs/ingestion/paths/tasks/v1/runTask.yml | 21 ++++ .../ingestion/paths/tasks/v1/searchTasks.yml | 28 ++++++ specs/ingestion/paths/tasks/v1/taskID.yml | 64 +++++++++++++ specs/ingestion/paths/tasks/v1/tasks.yml | 66 +++++++++++++ .../paths/tasks/{ => v2}/disableTask.yml | 6 +- .../paths/tasks/{ => v2}/enableTask.yml | 6 +- .../paths/tasks/{ => v2}/runTask.yml | 6 +- .../paths/tasks/{ => v2}/searchTasks.yml | 6 +- .../ingestion/paths/tasks/{ => v2}/taskID.yml | 20 ++-- .../ingestion/paths/tasks/{ => v2}/tasks.yml | 32 +++---- .../paths/transformations/transformations.yml | 2 +- specs/ingestion/spec.yml | 24 +++-- templates/python/api.mustache | 2 +- templates/python/imports.mustache | 1 + tests/CTS/requests/ingestion/createTask.json | 47 ++------- .../CTS/requests/ingestion/createTaskV1.json | 73 ++++++++++++++ tests/CTS/requests/ingestion/deleteTask.json | 3 +- .../CTS/requests/ingestion/deleteTaskV1.json | 11 +++ tests/CTS/requests/ingestion/disableTask.json | 3 +- .../CTS/requests/ingestion/disableTaskV1.json | 11 +++ tests/CTS/requests/ingestion/enableTask.json | 3 +- .../CTS/requests/ingestion/enableTaskV1.json | 17 ++++ tests/CTS/requests/ingestion/getTask.json | 3 +- tests/CTS/requests/ingestion/getTaskV1.json | 11 +++ ...ications.json => listAuthentications.json} | 0 ...estinations.json => listDestinations.json} | 0 .../{getEvents.json => listEvents.json} | 0 .../ingestion/{getRuns.json => listRuns.json} | 0 .../{getSources.json => listSources.json} | 0 tests/CTS/requests/ingestion/listTasks.json | 9 ++ .../{getTasks.json => listTasksV1.json} | 1 - ...rmations.json => listTransformations.json} | 0 tests/CTS/requests/ingestion/runTask.json | 3 +- tests/CTS/requests/ingestion/runTaskV1.json | 11 +++ tests/CTS/requests/ingestion/searchTasks.json | 6 +- .../CTS/requests/ingestion/searchTasksV1.json | 39 ++++++++ tests/CTS/requests/ingestion/updateTask.json | 9 +- .../CTS/requests/ingestion/updateTaskV1.json | 17 ++++ 46 files changed, 595 insertions(+), 114 deletions(-) create mode 100644 specs/ingestion/paths/tasks/v1/disableTask.yml create mode 100644 specs/ingestion/paths/tasks/v1/enableTask.yml create mode 100644 specs/ingestion/paths/tasks/v1/runTask.yml create mode 100644 specs/ingestion/paths/tasks/v1/searchTasks.yml create mode 100644 specs/ingestion/paths/tasks/v1/taskID.yml create mode 100644 specs/ingestion/paths/tasks/v1/tasks.yml rename specs/ingestion/paths/tasks/{ => v2}/disableTask.yml (61%) rename specs/ingestion/paths/tasks/{ => v2}/enableTask.yml (61%) rename specs/ingestion/paths/tasks/{ => v2}/runTask.yml (66%) rename specs/ingestion/paths/tasks/{ => v2}/searchTasks.yml (71%) rename specs/ingestion/paths/tasks/{ => v2}/taskID.yml (59%) rename specs/ingestion/paths/tasks/{ => v2}/tasks.yml (52%) create mode 100644 tests/CTS/requests/ingestion/createTaskV1.json create mode 100644 tests/CTS/requests/ingestion/deleteTaskV1.json create mode 100644 tests/CTS/requests/ingestion/disableTaskV1.json create mode 100644 tests/CTS/requests/ingestion/enableTaskV1.json create mode 100644 tests/CTS/requests/ingestion/getTaskV1.json rename tests/CTS/requests/ingestion/{getAuthentications.json => listAuthentications.json} (100%) rename tests/CTS/requests/ingestion/{getDestinations.json => listDestinations.json} (100%) rename tests/CTS/requests/ingestion/{getEvents.json => listEvents.json} (100%) rename tests/CTS/requests/ingestion/{getRuns.json => listRuns.json} (100%) rename tests/CTS/requests/ingestion/{getSources.json => listSources.json} (100%) create mode 100644 tests/CTS/requests/ingestion/listTasks.json rename tests/CTS/requests/ingestion/{getTasks.json => listTasksV1.json} (78%) rename tests/CTS/requests/ingestion/{getTransformations.json => listTransformations.json} (100%) create mode 100644 tests/CTS/requests/ingestion/runTaskV1.json create mode 100644 tests/CTS/requests/ingestion/searchTasksV1.json create mode 100644 tests/CTS/requests/ingestion/updateTaskV1.json diff --git a/specs/ingestion/common/schemas/task.yml b/specs/ingestion/common/schemas/task.yml index efca300f1f..c5cf97fd8a 100644 --- a/specs/ingestion/common/schemas/task.yml +++ b/specs/ingestion/common/schemas/task.yml @@ -1,6 +1,48 @@ Task: type: object additionalProperties: false + properties: + taskID: + $ref: './common.yml#/taskID' + sourceID: + $ref: './common.yml#/sourceID' + destinationID: + $ref: './common.yml#/destinationID' + cron: + $ref: '#/Cron' + lastRun: + $ref: '#/LastRun' + nextRun: + $ref: '#/NextRun' + input: + $ref: '#/TaskInput' + enabled: + type: boolean + default: true + description: Whether the task is enabled. + failureThreshold: + $ref: '#/failureThreshold' + action: + $ref: '#/ActionType' + cursor: + $ref: './common.yml#/cursor' + createdAt: + $ref: './common.yml#/createdAt' + updatedAt: + $ref: './common.yml#/updatedAt' + required: + - taskID + - sourceID + - destinationID + - enabled + - action + - createdAt + +TaskV1: + type: object + additionalProperties: false + deprecated: true + description: The V1 task object, please use methods and types that don't contain the V1 suffix. properties: taskID: $ref: './common.yml#/taskID' @@ -47,6 +89,34 @@ TaskCreate: type: object additionalProperties: false description: API request body for creating a task. + properties: + sourceID: + $ref: './common.yml#/sourceID' + destinationID: + $ref: './common.yml#/destinationID' + action: + $ref: '#/ActionType' + cron: + $ref: '#/Cron' + enabled: + type: boolean + description: Whether the task is enabled. + failureThreshold: + $ref: '#/failureThreshold' + input: + $ref: '#/TaskInput' + cursor: + $ref: './common.yml#/cursor' + required: + - sourceID + - destinationID + - action + +TaskCreateV1: + type: object + additionalProperties: false + deprecated: true + description: API request body for creating a task using the V1 shape, please use methods and types that don't contain the V1 suffix. properties: sourceID: $ref: './common.yml#/sourceID' @@ -95,6 +165,24 @@ TaskUpdate: type: object additionalProperties: false description: API request body for updating a task. + properties: + destinationID: + $ref: './common.yml#/destinationID' + cron: + $ref: '#/Cron' + input: + $ref: '#/TaskInput' + enabled: + type: boolean + description: Whether the task is enabled. + failureThreshold: + $ref: '#/failureThreshold' + +TaskUpdateV1: + type: object + additionalProperties: false + deprecated: true + description: API request body for updating a task using the V1 shape, please use methods and types that don't contain the V1 suffix. properties: destinationID: $ref: './common.yml#/destinationID' @@ -188,6 +276,10 @@ LastRun: description: The last time the scheduled task ran in RFC 3339 format. type: string +NextRun: + description: The next scheduled run of the task in RFC 3339 format. + type: string + Cron: type: string description: Cron expression for the task's schedule. @@ -224,8 +316,7 @@ ScheduleTrigger: lastRun: $ref: '#/LastRun' nextRun: - description: The next scheduled run of the task in RFC 3339 format. - type: string + $ref: '#/NextRun' required: - type - cron diff --git a/specs/ingestion/paths/authentications/authentications.yml b/specs/ingestion/paths/authentications/authentications.yml index 7dbb2e9c38..49951dca5f 100644 --- a/specs/ingestion/paths/authentications/authentications.yml +++ b/specs/ingestion/paths/authentications/authentications.yml @@ -3,7 +3,7 @@ get: - authentications summary: List authentication resources description: Retrieves a list of all authentication resources. - operationId: getAuthentications + operationId: listAuthentications x-acl: - addObject - deleteIndex diff --git a/specs/ingestion/paths/destinations/destinations.yml b/specs/ingestion/paths/destinations/destinations.yml index 25319d03e9..d29c291e73 100644 --- a/specs/ingestion/paths/destinations/destinations.yml +++ b/specs/ingestion/paths/destinations/destinations.yml @@ -3,7 +3,7 @@ get: - destinations summary: List destinations description: Retrieves a list of destinations. - operationId: getDestinations + operationId: listDestinations x-acl: - addObject - deleteIndex diff --git a/specs/ingestion/paths/runs/events/events.yml b/specs/ingestion/paths/runs/events/events.yml index 9611d65128..edb4bbc457 100644 --- a/specs/ingestion/paths/runs/events/events.yml +++ b/specs/ingestion/paths/runs/events/events.yml @@ -3,7 +3,7 @@ get: - observability summary: List task run events description: Retrieves a list of events for a task run, identified by it's ID. - operationId: getEvents + operationId: listEvents x-acl: - addObject - deleteIndex diff --git a/specs/ingestion/paths/runs/runs.yml b/specs/ingestion/paths/runs/runs.yml index dbbb05c6a5..325eef76b3 100644 --- a/specs/ingestion/paths/runs/runs.yml +++ b/specs/ingestion/paths/runs/runs.yml @@ -3,7 +3,7 @@ get: - observability summary: List task runs description: Retrieve a list of task runs. - operationId: getRuns + operationId: listRuns x-acl: - addObject - deleteIndex diff --git a/specs/ingestion/paths/sources/sources.yml b/specs/ingestion/paths/sources/sources.yml index 74f10d152e..eb9f969703 100644 --- a/specs/ingestion/paths/sources/sources.yml +++ b/specs/ingestion/paths/sources/sources.yml @@ -3,7 +3,7 @@ get: - sources summary: List sources description: Retrieves a list of sources. - operationId: getSources + operationId: listSources x-acl: - addObject - deleteIndex diff --git a/specs/ingestion/paths/tasks/v1/disableTask.yml b/specs/ingestion/paths/tasks/v1/disableTask.yml new file mode 100644 index 0000000000..5e845d3c62 --- /dev/null +++ b/specs/ingestion/paths/tasks/v1/disableTask.yml @@ -0,0 +1,22 @@ +put: + tags: + - tasks + summary: Disable a task + description: Disables a task using the v1 endpoint, please use `disableTask` instead. + operationId: disableTaskV1 + deprecated: true + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/v1/enableTask.yml b/specs/ingestion/paths/tasks/v1/enableTask.yml new file mode 100644 index 0000000000..691d371e0f --- /dev/null +++ b/specs/ingestion/paths/tasks/v1/enableTask.yml @@ -0,0 +1,21 @@ +put: + tags: + - tasks + summary: Enable a task + description: Enables a task using the v1 endpoint, please use `enableTask` instead. + operationId: enableTaskV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/v1/runTask.yml b/specs/ingestion/paths/tasks/v1/runTask.yml new file mode 100644 index 0000000000..2aab117d61 --- /dev/null +++ b/specs/ingestion/paths/tasks/v1/runTask.yml @@ -0,0 +1,21 @@ +post: + tags: + - tasks + summary: Run a task + description: Runs a task using the v1 endpoint, please use `runTask` instead. You can check the status of task runs with the observability endpoints. + operationId: runTaskV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/run.yml#/RunResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/v1/searchTasks.yml b/specs/ingestion/paths/tasks/v1/searchTasks.yml new file mode 100644 index 0000000000..3198c01167 --- /dev/null +++ b/specs/ingestion/paths/tasks/v1/searchTasks.yml @@ -0,0 +1,28 @@ +post: + tags: + - tasks + summary: Search for tasks + description: Searches for tasks using the v1 endpoint, please use `searchTasks` instead. + operationId: searchTasksV1 + x-acl: + - addObject + - deleteIndex + - editSettings + requestBody: + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskSearch' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + title: searchTasksResponseV1 + type: array + items: + $ref: '../../../common/schemas/task.yml#/TaskV1' + '400': + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/v1/taskID.yml b/specs/ingestion/paths/tasks/v1/taskID.yml new file mode 100644 index 0000000000..2aa389834d --- /dev/null +++ b/specs/ingestion/paths/tasks/v1/taskID.yml @@ -0,0 +1,64 @@ +get: + tags: + - tasks + summary: Retrieve a task + description: Retrieves a task by its ID using the v1 endpoint, please use `getTask` instead. + operationId: getTaskV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskV1' + '400': + $ref: '../../../../common/responses/BadRequest.yml' + +patch: + tags: + - tasks + summary: Update a task + description: Updates a task by its ID using the v1 endpoint, please use `updateTask` instead. + operationId: updateTaskV1 + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + x-codegen-request-body-name: taskUpdate + requestBody: + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskUpdateV1' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' + +delete: + tags: + - tasks + summary: Delete a task + description: Deletes a task by its ID using the v1 endpoint, please use `deleteTask` instead. + operationId: deleteTaskV1 + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/common.yml#/DeleteResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/v1/tasks.yml b/specs/ingestion/paths/tasks/v1/tasks.yml new file mode 100644 index 0000000000..f380a243d7 --- /dev/null +++ b/specs/ingestion/paths/tasks/v1/tasks.yml @@ -0,0 +1,66 @@ +get: + tags: + - tasks + summary: List tasks + description: Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead. + operationId: listTasksV1 + x-acl: + - addObject + - deleteIndex + - editSettings + parameters: + - $ref: '../../../common/parameters.yml#/itemsPerPage' + - $ref: '../../../common/parameters.yml#/page' + - $ref: '../../../common/taskParameters.yml#/action' + - $ref: '../../../common/taskParameters.yml#/enabled' + - $ref: '../../../common/taskParameters.yml#/sourceID' + - $ref: '../../../common/taskParameters.yml#/destinationID' + - $ref: '../../../common/taskParameters.yml#/triggerType' + - $ref: '../../../common/taskParameters.yml#/sort' + - $ref: '../../../common/parameters.yml#/order' + responses: + '200': + description: OK + content: + application/json: + schema: + title: listTasksResponseV1 + type: object + description: Configured tasks and pagination information. + additionalProperties: false + properties: + tasks: + type: array + items: + $ref: '../../../common/schemas/task.yml#/TaskV1' + pagination: + $ref: '../../../common/schemas/pagination.yml#/Pagination' + required: + - tasks + - pagination + '400': + $ref: '../../../../common/responses/BadRequest.yml' + +post: + tags: + - tasks + summary: Create a task + description: Creates a new task using the v1 endpoint, please use `createTask` instead. + operationId: createTaskV1 + x-codegen-request-body-name: taskCreate + requestBody: + description: Request body for creating a task. + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskCreateV1' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskCreateResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/disableTask.yml b/specs/ingestion/paths/tasks/v2/disableTask.yml similarity index 61% rename from specs/ingestion/paths/tasks/disableTask.yml rename to specs/ingestion/paths/tasks/v2/disableTask.yml index 909e201fdb..f9ce7acca1 100644 --- a/specs/ingestion/paths/tasks/disableTask.yml +++ b/specs/ingestion/paths/tasks/v2/disableTask.yml @@ -9,13 +9,13 @@ put: - deleteIndex - editSettings parameters: - - $ref: '../../common/parameters.yml#/pathTaskID' + - $ref: '../../../common/parameters.yml#/pathTaskID' responses: '200': description: OK content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskUpdateResponse' + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/enableTask.yml b/specs/ingestion/paths/tasks/v2/enableTask.yml similarity index 61% rename from specs/ingestion/paths/tasks/enableTask.yml rename to specs/ingestion/paths/tasks/v2/enableTask.yml index 3787cef6c4..0d2958e33e 100644 --- a/specs/ingestion/paths/tasks/enableTask.yml +++ b/specs/ingestion/paths/tasks/v2/enableTask.yml @@ -9,13 +9,13 @@ put: - deleteIndex - editSettings parameters: - - $ref: '../../common/parameters.yml#/pathTaskID' + - $ref: '../../../common/parameters.yml#/pathTaskID' responses: '200': description: OK content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskUpdateResponse' + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/runTask.yml b/specs/ingestion/paths/tasks/v2/runTask.yml similarity index 66% rename from specs/ingestion/paths/tasks/runTask.yml rename to specs/ingestion/paths/tasks/v2/runTask.yml index 30635f5e52..83dbd5fc06 100644 --- a/specs/ingestion/paths/tasks/runTask.yml +++ b/specs/ingestion/paths/tasks/v2/runTask.yml @@ -9,13 +9,13 @@ post: - deleteIndex - editSettings parameters: - - $ref: '../../common/parameters.yml#/pathTaskID' + - $ref: '../../../common/parameters.yml#/pathTaskID' responses: '200': description: OK content: application/json: schema: - $ref: '../../common/schemas/run.yml#/RunResponse' + $ref: '../../../common/schemas/run.yml#/RunResponse' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/searchTasks.yml b/specs/ingestion/paths/tasks/v2/searchTasks.yml similarity index 71% rename from specs/ingestion/paths/tasks/searchTasks.yml rename to specs/ingestion/paths/tasks/v2/searchTasks.yml index 1af7e7c7b6..f2ee97a0ee 100644 --- a/specs/ingestion/paths/tasks/searchTasks.yml +++ b/specs/ingestion/paths/tasks/v2/searchTasks.yml @@ -12,7 +12,7 @@ post: content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskSearch' + $ref: '../../../common/schemas/task.yml#/TaskSearch' required: true responses: '200': @@ -23,6 +23,6 @@ post: title: searchTasksResponse type: array items: - $ref: '../../common/schemas/task.yml#/Task' + $ref: '../../../common/schemas/task.yml#/Task' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/taskID.yml b/specs/ingestion/paths/tasks/v2/taskID.yml similarity index 59% rename from specs/ingestion/paths/tasks/taskID.yml rename to specs/ingestion/paths/tasks/v2/taskID.yml index 33bdd8d46d..e45b4d46df 100644 --- a/specs/ingestion/paths/tasks/taskID.yml +++ b/specs/ingestion/paths/tasks/v2/taskID.yml @@ -9,16 +9,16 @@ get: - deleteIndex - editSettings parameters: - - $ref: '../../common/parameters.yml#/pathTaskID' + - $ref: '../../../common/parameters.yml#/pathTaskID' responses: '200': description: OK content: application/json: schema: - $ref: '../../common/schemas/task.yml#/Task' + $ref: '../../../common/schemas/task.yml#/Task' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' patch: tags: @@ -27,12 +27,12 @@ patch: description: Updates a task by its ID. operationId: updateTask parameters: - - $ref: '../../common/parameters.yml#/pathTaskID' + - $ref: '../../../common/parameters.yml#/pathTaskID' requestBody: content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskUpdate' + $ref: '../../../common/schemas/task.yml#/TaskUpdate' required: true responses: '200': @@ -40,9 +40,9 @@ patch: content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskUpdateResponse' + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' delete: tags: @@ -51,13 +51,13 @@ delete: description: Deletes a task by its ID. operationId: deleteTask parameters: - - $ref: '../../common/parameters.yml#/pathTaskID' + - $ref: '../../../common/parameters.yml#/pathTaskID' responses: '200': description: OK content: application/json: schema: - $ref: '../../common/schemas/common.yml#/DeleteResponse' + $ref: '../../../common/schemas/common.yml#/DeleteResponse' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/tasks/tasks.yml b/specs/ingestion/paths/tasks/v2/tasks.yml similarity index 52% rename from specs/ingestion/paths/tasks/tasks.yml rename to specs/ingestion/paths/tasks/v2/tasks.yml index d8ab6dc266..ffc5c6aebb 100644 --- a/specs/ingestion/paths/tasks/tasks.yml +++ b/specs/ingestion/paths/tasks/v2/tasks.yml @@ -3,21 +3,21 @@ get: - tasks summary: List tasks description: Retrieves a list of tasks. - operationId: getTasks + operationId: listTasks x-acl: - addObject - deleteIndex - editSettings parameters: - - $ref: '../../common/parameters.yml#/itemsPerPage' - - $ref: '../../common/parameters.yml#/page' - - $ref: '../../common/taskParameters.yml#/action' - - $ref: '../../common/taskParameters.yml#/enabled' - - $ref: '../../common/taskParameters.yml#/sourceID' - - $ref: '../../common/taskParameters.yml#/destinationID' - - $ref: '../../common/taskParameters.yml#/triggerType' - - $ref: '../../common/taskParameters.yml#/sort' - - $ref: '../../common/parameters.yml#/order' + - $ref: '../../../common/parameters.yml#/itemsPerPage' + - $ref: '../../../common/parameters.yml#/page' + - $ref: '../../../common/taskParameters.yml#/action' + - $ref: '../../../common/taskParameters.yml#/enabled' + - $ref: '../../../common/taskParameters.yml#/sourceID' + - $ref: '../../../common/taskParameters.yml#/destinationID' + - $ref: '../../../common/taskParameters.yml#/triggerType' + - $ref: '../../../common/taskParameters.yml#/sort' + - $ref: '../../../common/parameters.yml#/order' responses: '200': description: OK @@ -32,14 +32,14 @@ get: tasks: type: array items: - $ref: '../../common/schemas/task.yml#/Task' + $ref: '../../../common/schemas/task.yml#/Task' pagination: - $ref: '../../common/schemas/pagination.yml#/Pagination' + $ref: '../../../common/schemas/pagination.yml#/Pagination' required: - tasks - pagination '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' post: tags: @@ -52,7 +52,7 @@ post: content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskCreate' + $ref: '../../../common/schemas/task.yml#/TaskCreate' required: true responses: '200': @@ -60,6 +60,6 @@ post: content: application/json: schema: - $ref: '../../common/schemas/task.yml#/TaskCreateResponse' + $ref: '../../../common/schemas/task.yml#/TaskCreateResponse' '400': - $ref: '../../../common/responses/BadRequest.yml' + $ref: '../../../../common/responses/BadRequest.yml' diff --git a/specs/ingestion/paths/transformations/transformations.yml b/specs/ingestion/paths/transformations/transformations.yml index fb3d09c383..098d10eafa 100644 --- a/specs/ingestion/paths/transformations/transformations.yml +++ b/specs/ingestion/paths/transformations/transformations.yml @@ -3,7 +3,7 @@ get: - transformations summary: List transformations description: Retrieves a list of transformations. - operationId: getTransformations + operationId: listTransformations x-acl: - addObject - deleteIndex diff --git a/specs/ingestion/spec.yml b/specs/ingestion/spec.yml index 35dea446d4..6de5a2384d 100644 --- a/specs/ingestion/spec.yml +++ b/specs/ingestion/spec.yml @@ -140,17 +140,29 @@ paths: # tasks API. /1/tasks: - $ref: 'paths/tasks/tasks.yml' + $ref: 'paths/tasks/v1/tasks.yml' /1/tasks/search: - $ref: 'paths/tasks/searchTasks.yml' + $ref: 'paths/tasks/v1/searchTasks.yml' /1/tasks/{taskID}: - $ref: 'paths/tasks/taskID.yml' + $ref: 'paths/tasks/v1/taskID.yml' /1/tasks/{taskID}/run: - $ref: 'paths/tasks/runTask.yml' + $ref: 'paths/tasks/v1/runTask.yml' /1/tasks/{taskID}/enable: - $ref: 'paths/tasks/enableTask.yml' + $ref: 'paths/tasks/v1/enableTask.yml' /1/tasks/{taskID}/disable: - $ref: 'paths/tasks/disableTask.yml' + $ref: 'paths/tasks/v1/disableTask.yml' + /2/tasks: + $ref: 'paths/tasks/v2/tasks.yml' + /2/tasks/search: + $ref: 'paths/tasks/v2/searchTasks.yml' + /2/tasks/{taskID}: + $ref: 'paths/tasks/v2/taskID.yml' + /2/tasks/{taskID}/run: + $ref: 'paths/tasks/v2/runTask.yml' + /2/tasks/{taskID}/enable: + $ref: 'paths/tasks/v2/enableTask.yml' + /2/tasks/{taskID}/disable: + $ref: 'paths/tasks/v2/disableTask.yml' # transformations API. /1/transformations: diff --git a/templates/python/api.mustache b/templates/python/api.mustache index ee1351455c..b5446f39a7 100644 --- a/templates/python/api.mustache +++ b/templates/python/api.mustache @@ -107,7 +107,7 @@ class {{classname}}: :return: Returns the raw algoliasearch 'APIResponse' object. """ - {{#isDeprecated}}warnings.warn("{{{httpMethod}}} {{{path}}} is deprecated.", DeprecationWarning){{/isDeprecated}} + {{#isDeprecated}}warn("{{{httpMethod}}} {{{path}}} is deprecated.", DeprecationWarning){{/isDeprecated}} {{#allParams}} {{#required}} diff --git a/templates/python/imports.mustache b/templates/python/imports.mustache index 741dda33f9..2a3b8faea4 100644 --- a/templates/python/imports.mustache +++ b/templates/python/imports.mustache @@ -3,6 +3,7 @@ from __future__ import annotations import base64 import hashlib import hmac +from warnings import warn from random import randint from time import time from urllib.parse import quote diff --git a/tests/CTS/requests/ingestion/createTask.json b/tests/CTS/requests/ingestion/createTask.json index 81c5c1e8ff..4c20362ed0 100644 --- a/tests/CTS/requests/ingestion/createTask.json +++ b/tests/CTS/requests/ingestion/createTask.json @@ -1,71 +1,36 @@ [ { - "testName": "createTaskOnDemand", + "testName": "task without cron", "parameters": { "sourceID": "search", "destinationID": "destinationName", - "trigger": { - "type": "onDemand" - }, "action": "replace" }, "request": { - "path": "/1/tasks", + "path": "/2/tasks", "method": "POST", "body": { "sourceID": "search", "destinationID": "destinationName", - "trigger": { - "type": "onDemand" - }, "action": "replace" } } }, { - "testName": "createTaskSchedule", + "testName": "task with cron", "parameters": { "sourceID": "search", "destinationID": "destinationName", - "trigger": { - "type": "schedule", - "cron": "* * * * *" - }, + "cron": "* * * * *", "action": "replace" }, "request": { - "path": "/1/tasks", + "path": "/2/tasks", "method": "POST", "body": { "sourceID": "search", "destinationID": "destinationName", - "trigger": { - "type": "schedule", - "cron": "* * * * *" - }, - "action": "replace" - } - } - }, - { - "testName": "createTaskSubscription", - "parameters": { - "sourceID": "search", - "destinationID": "destinationName", - "trigger": { - "type": "onDemand" - }, - "action": "replace" - }, - "request": { - "path": "/1/tasks", - "method": "POST", - "body": { - "sourceID": "search", - "destinationID": "destinationName", - "trigger": { - "type": "onDemand" - }, + "cron": "* * * * *", "action": "replace" } } diff --git a/tests/CTS/requests/ingestion/createTaskV1.json b/tests/CTS/requests/ingestion/createTaskV1.json new file mode 100644 index 0000000000..81c5c1e8ff --- /dev/null +++ b/tests/CTS/requests/ingestion/createTaskV1.json @@ -0,0 +1,73 @@ +[ + { + "testName": "createTaskOnDemand", + "parameters": { + "sourceID": "search", + "destinationID": "destinationName", + "trigger": { + "type": "onDemand" + }, + "action": "replace" + }, + "request": { + "path": "/1/tasks", + "method": "POST", + "body": { + "sourceID": "search", + "destinationID": "destinationName", + "trigger": { + "type": "onDemand" + }, + "action": "replace" + } + } + }, + { + "testName": "createTaskSchedule", + "parameters": { + "sourceID": "search", + "destinationID": "destinationName", + "trigger": { + "type": "schedule", + "cron": "* * * * *" + }, + "action": "replace" + }, + "request": { + "path": "/1/tasks", + "method": "POST", + "body": { + "sourceID": "search", + "destinationID": "destinationName", + "trigger": { + "type": "schedule", + "cron": "* * * * *" + }, + "action": "replace" + } + } + }, + { + "testName": "createTaskSubscription", + "parameters": { + "sourceID": "search", + "destinationID": "destinationName", + "trigger": { + "type": "onDemand" + }, + "action": "replace" + }, + "request": { + "path": "/1/tasks", + "method": "POST", + "body": { + "sourceID": "search", + "destinationID": "destinationName", + "trigger": { + "type": "onDemand" + }, + "action": "replace" + } + } + } +] diff --git a/tests/CTS/requests/ingestion/deleteTask.json b/tests/CTS/requests/ingestion/deleteTask.json index 2626c4791b..afd2930e2e 100644 --- a/tests/CTS/requests/ingestion/deleteTask.json +++ b/tests/CTS/requests/ingestion/deleteTask.json @@ -1,11 +1,10 @@ [ { - "testName": "deleteTask", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" }, "request": { - "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", "method": "DELETE" } } diff --git a/tests/CTS/requests/ingestion/deleteTaskV1.json b/tests/CTS/requests/ingestion/deleteTaskV1.json new file mode 100644 index 0000000000..7dd4db8d55 --- /dev/null +++ b/tests/CTS/requests/ingestion/deleteTaskV1.json @@ -0,0 +1,11 @@ +[ + { + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" + }, + "request": { + "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "method": "DELETE" + } + } +] diff --git a/tests/CTS/requests/ingestion/disableTask.json b/tests/CTS/requests/ingestion/disableTask.json index 5ad96ad49a..3693801277 100644 --- a/tests/CTS/requests/ingestion/disableTask.json +++ b/tests/CTS/requests/ingestion/disableTask.json @@ -1,11 +1,10 @@ [ { - "testName": "disableTask", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" }, "request": { - "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/disable", + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/disable", "method": "PUT" } } diff --git a/tests/CTS/requests/ingestion/disableTaskV1.json b/tests/CTS/requests/ingestion/disableTaskV1.json new file mode 100644 index 0000000000..4e841a16f2 --- /dev/null +++ b/tests/CTS/requests/ingestion/disableTaskV1.json @@ -0,0 +1,11 @@ +[ + { + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" + }, + "request": { + "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/disable", + "method": "PUT" + } + } +] diff --git a/tests/CTS/requests/ingestion/enableTask.json b/tests/CTS/requests/ingestion/enableTask.json index 11975c415f..f5fb5450f7 100644 --- a/tests/CTS/requests/ingestion/enableTask.json +++ b/tests/CTS/requests/ingestion/enableTask.json @@ -1,11 +1,10 @@ [ { - "testName": "enable task e2e", "parameters": { "taskID": "76ab4c2a-ce17-496f-b7a6-506dc59ee498" }, "request": { - "path": "/1/tasks/76ab4c2a-ce17-496f-b7a6-506dc59ee498/enable", + "path": "/2/tasks/76ab4c2a-ce17-496f-b7a6-506dc59ee498/enable", "method": "PUT" }, "response": { diff --git a/tests/CTS/requests/ingestion/enableTaskV1.json b/tests/CTS/requests/ingestion/enableTaskV1.json new file mode 100644 index 0000000000..3e301e2b67 --- /dev/null +++ b/tests/CTS/requests/ingestion/enableTaskV1.json @@ -0,0 +1,17 @@ +[ + { + "parameters": { + "taskID": "76ab4c2a-ce17-496f-b7a6-506dc59ee498" + }, + "request": { + "path": "/1/tasks/76ab4c2a-ce17-496f-b7a6-506dc59ee498/enable", + "method": "PUT" + }, + "response": { + "statusCode": 200, + "body": { + "taskID": "76ab4c2a-ce17-496f-b7a6-506dc59ee498" + } + } + } +] diff --git a/tests/CTS/requests/ingestion/getTask.json b/tests/CTS/requests/ingestion/getTask.json index 07b32b0fc8..fc70c918a6 100644 --- a/tests/CTS/requests/ingestion/getTask.json +++ b/tests/CTS/requests/ingestion/getTask.json @@ -1,11 +1,10 @@ [ { - "testName": "getTask", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" }, "request": { - "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", "method": "GET" } } diff --git a/tests/CTS/requests/ingestion/getTaskV1.json b/tests/CTS/requests/ingestion/getTaskV1.json new file mode 100644 index 0000000000..de21f28d93 --- /dev/null +++ b/tests/CTS/requests/ingestion/getTaskV1.json @@ -0,0 +1,11 @@ +[ + { + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" + }, + "request": { + "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "method": "GET" + } + } +] diff --git a/tests/CTS/requests/ingestion/getAuthentications.json b/tests/CTS/requests/ingestion/listAuthentications.json similarity index 100% rename from tests/CTS/requests/ingestion/getAuthentications.json rename to tests/CTS/requests/ingestion/listAuthentications.json diff --git a/tests/CTS/requests/ingestion/getDestinations.json b/tests/CTS/requests/ingestion/listDestinations.json similarity index 100% rename from tests/CTS/requests/ingestion/getDestinations.json rename to tests/CTS/requests/ingestion/listDestinations.json diff --git a/tests/CTS/requests/ingestion/getEvents.json b/tests/CTS/requests/ingestion/listEvents.json similarity index 100% rename from tests/CTS/requests/ingestion/getEvents.json rename to tests/CTS/requests/ingestion/listEvents.json diff --git a/tests/CTS/requests/ingestion/getRuns.json b/tests/CTS/requests/ingestion/listRuns.json similarity index 100% rename from tests/CTS/requests/ingestion/getRuns.json rename to tests/CTS/requests/ingestion/listRuns.json diff --git a/tests/CTS/requests/ingestion/getSources.json b/tests/CTS/requests/ingestion/listSources.json similarity index 100% rename from tests/CTS/requests/ingestion/getSources.json rename to tests/CTS/requests/ingestion/listSources.json diff --git a/tests/CTS/requests/ingestion/listTasks.json b/tests/CTS/requests/ingestion/listTasks.json new file mode 100644 index 0000000000..ee4731f157 --- /dev/null +++ b/tests/CTS/requests/ingestion/listTasks.json @@ -0,0 +1,9 @@ +[ + { + "parameters": {}, + "request": { + "path": "/2/tasks", + "method": "GET" + } + } +] diff --git a/tests/CTS/requests/ingestion/getTasks.json b/tests/CTS/requests/ingestion/listTasksV1.json similarity index 78% rename from tests/CTS/requests/ingestion/getTasks.json rename to tests/CTS/requests/ingestion/listTasksV1.json index bd7badcef8..2f64b94e3d 100644 --- a/tests/CTS/requests/ingestion/getTasks.json +++ b/tests/CTS/requests/ingestion/listTasksV1.json @@ -1,6 +1,5 @@ [ { - "testName": "getTasks", "parameters": {}, "request": { "path": "/1/tasks", diff --git a/tests/CTS/requests/ingestion/getTransformations.json b/tests/CTS/requests/ingestion/listTransformations.json similarity index 100% rename from tests/CTS/requests/ingestion/getTransformations.json rename to tests/CTS/requests/ingestion/listTransformations.json diff --git a/tests/CTS/requests/ingestion/runTask.json b/tests/CTS/requests/ingestion/runTask.json index 7c42fd1f0e..b27ec76bbc 100644 --- a/tests/CTS/requests/ingestion/runTask.json +++ b/tests/CTS/requests/ingestion/runTask.json @@ -1,11 +1,10 @@ [ { - "testName": "runTask", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" }, "request": { - "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/run", + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/run", "method": "POST" } } diff --git a/tests/CTS/requests/ingestion/runTaskV1.json b/tests/CTS/requests/ingestion/runTaskV1.json new file mode 100644 index 0000000000..fb595cc613 --- /dev/null +++ b/tests/CTS/requests/ingestion/runTaskV1.json @@ -0,0 +1,11 @@ +[ + { + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f" + }, + "request": { + "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/run", + "method": "POST" + } + } +] diff --git a/tests/CTS/requests/ingestion/searchTasks.json b/tests/CTS/requests/ingestion/searchTasks.json index 04416539ad..3420ab8d56 100644 --- a/tests/CTS/requests/ingestion/searchTasks.json +++ b/tests/CTS/requests/ingestion/searchTasks.json @@ -1,6 +1,5 @@ [ { - "testName": "searchTasks", "parameters": { "taskIDs": [ "6c02aeb1-775e-418e-870b-1faccd4b2c0f", @@ -9,7 +8,7 @@ ] }, "request": { - "path": "/1/tasks/search", + "path": "/2/tasks/search", "method": "POST", "body": { "taskIDs": [ @@ -26,9 +25,6 @@ "taskID": "76ab4c2a-ce17-496f-b7a6-506dc59ee498", "sourceID": "75eeb306-51d3-4e5e-a279-3c92bd8893ac", "destinationID": "506d79fa-e29d-4bcf-907c-6b6a41172153", - "trigger": { - "type": "onDemand" - }, "enabled": true, "failureThreshold": 0, "action": "replace", diff --git a/tests/CTS/requests/ingestion/searchTasksV1.json b/tests/CTS/requests/ingestion/searchTasksV1.json new file mode 100644 index 0000000000..1874a66872 --- /dev/null +++ b/tests/CTS/requests/ingestion/searchTasksV1.json @@ -0,0 +1,39 @@ +[ + { + "parameters": { + "taskIDs": [ + "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "947ac9c4-7e58-4c87-b1e7-14a68e99699a", + "76ab4c2a-ce17-496f-b7a6-506dc59ee498" + ] + }, + "request": { + "path": "/1/tasks/search", + "method": "POST", + "body": { + "taskIDs": [ + "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "947ac9c4-7e58-4c87-b1e7-14a68e99699a", + "76ab4c2a-ce17-496f-b7a6-506dc59ee498" + ] + } + }, + "response": { + "statusCode": 200, + "body": [ + { + "taskID": "76ab4c2a-ce17-496f-b7a6-506dc59ee498", + "sourceID": "75eeb306-51d3-4e5e-a279-3c92bd8893ac", + "destinationID": "506d79fa-e29d-4bcf-907c-6b6a41172153", + "trigger": { + "type": "onDemand" + }, + "enabled": true, + "failureThreshold": 0, + "action": "replace", + "createdAt": "2024-01-08T16:47:41Z" + } + ] + } + } +] diff --git a/tests/CTS/requests/ingestion/updateTask.json b/tests/CTS/requests/ingestion/updateTask.json index de1dc98899..f39d8a004e 100644 --- a/tests/CTS/requests/ingestion/updateTask.json +++ b/tests/CTS/requests/ingestion/updateTask.json @@ -1,17 +1,18 @@ [ { - "testName": "updateTask", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", "taskUpdate": { - "enabled": false + "enabled": false, + "cron": "* * * * *" } }, "request": { - "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", "method": "PATCH", "body": { - "enabled": false + "enabled": false, + "cron": "* * * * *" } } } diff --git a/tests/CTS/requests/ingestion/updateTaskV1.json b/tests/CTS/requests/ingestion/updateTaskV1.json new file mode 100644 index 0000000000..f50c5d5e39 --- /dev/null +++ b/tests/CTS/requests/ingestion/updateTaskV1.json @@ -0,0 +1,17 @@ +[ + { + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "taskUpdate": { + "enabled": false + } + }, + "request": { + "path": "/1/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "method": "PATCH", + "body": { + "enabled": false + } + } + } +]