Skip to content

Commit e966760

Browse files
authored
[Workflow Pause]: Add api/v1 support (#705)
<!-- Describe what has changed in this PR --> **What changed?** Adds versioned API endpoint support for `PauseWorkflowExecution` and `UnpauseWorkflowExecution` operations by adding `/api/v1/` HTTP bindings alongside the existing unversioned paths. <!-- Tell your future self why have you made these changes --> **Why?** The Go server configuration in [UI](https://github.com/temporalio/ui) currently groups all API routes under `/api/v1/`.
1 parent b537ad8 commit e966760

File tree

3 files changed

+191
-0
lines changed

3 files changed

+191
-0
lines changed

openapi/openapiv2.json

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3769,6 +3769,53 @@
37693769
]
37703770
}
37713771
},
3772+
"/api/v1/namespaces/{namespace}/workflows/{workflowId}/pause": {
3773+
"post": {
3774+
"summary": "Note: This is an experimental API and the behavior may change in a future release.\nPauseWorkflowExecution pauses the workflow execution specified in the request. Pausing a workflow execution results in\n- The workflow execution status changes to `PAUSED` and a new WORKFLOW_EXECUTION_PAUSED event is added to the history\n- No new workflow tasks or activity tasks are dispatched.\n - Any workflow task currently executing on the worker will be allowed to complete.\n - Any activity task currently executing will be paused.\n- All server-side events will continue to be processed by the server.\n- Queries & Updates on a paused workflow will be rejected.",
3775+
"operationId": "PauseWorkflowExecution2",
3776+
"responses": {
3777+
"200": {
3778+
"description": "A successful response.",
3779+
"schema": {
3780+
"$ref": "#/definitions/v1PauseWorkflowExecutionResponse"
3781+
}
3782+
},
3783+
"default": {
3784+
"description": "An unexpected error response.",
3785+
"schema": {
3786+
"$ref": "#/definitions/rpcStatus"
3787+
}
3788+
}
3789+
},
3790+
"parameters": [
3791+
{
3792+
"name": "namespace",
3793+
"description": "Namespace of the workflow to pause.",
3794+
"in": "path",
3795+
"required": true,
3796+
"type": "string"
3797+
},
3798+
{
3799+
"name": "workflowId",
3800+
"description": "ID of the workflow execution to be paused. Required.",
3801+
"in": "path",
3802+
"required": true,
3803+
"type": "string"
3804+
},
3805+
{
3806+
"name": "body",
3807+
"in": "body",
3808+
"required": true,
3809+
"schema": {
3810+
"$ref": "#/definitions/WorkflowServicePauseWorkflowExecutionBody"
3811+
}
3812+
}
3813+
],
3814+
"tags": [
3815+
"WorkflowService"
3816+
]
3817+
}
3818+
},
37723819
"/api/v1/namespaces/{namespace}/workflows/{workflowId}/signal-with-start/{signalName}": {
37733820
"post": {
37743821
"summary": "SignalWithStartWorkflowExecution is used to ensure a signal is sent to a workflow, even if\nit isn't yet started.",
@@ -3822,6 +3869,53 @@
38223869
]
38233870
}
38243871
},
3872+
"/api/v1/namespaces/{namespace}/workflows/{workflowId}/unpause": {
3873+
"post": {
3874+
"summary": "Note: This is an experimental API and the behavior may change in a future release.\nUnpauseWorkflowExecution unpauses a previously paused workflow execution specified in the request.\nUnpausing a workflow execution results in\n- The workflow execution status changes to `RUNNING` and a new WORKFLOW_EXECUTION_UNPAUSED event is added to the history\n- Workflow tasks and activity tasks are resumed.",
3875+
"operationId": "UnpauseWorkflowExecution2",
3876+
"responses": {
3877+
"200": {
3878+
"description": "A successful response.",
3879+
"schema": {
3880+
"$ref": "#/definitions/v1UnpauseWorkflowExecutionResponse"
3881+
}
3882+
},
3883+
"default": {
3884+
"description": "An unexpected error response.",
3885+
"schema": {
3886+
"$ref": "#/definitions/rpcStatus"
3887+
}
3888+
}
3889+
},
3890+
"parameters": [
3891+
{
3892+
"name": "namespace",
3893+
"description": "Namespace of the workflow to unpause.",
3894+
"in": "path",
3895+
"required": true,
3896+
"type": "string"
3897+
},
3898+
{
3899+
"name": "workflowId",
3900+
"description": "ID of the workflow execution to be paused. Required.",
3901+
"in": "path",
3902+
"required": true,
3903+
"type": "string"
3904+
},
3905+
{
3906+
"name": "body",
3907+
"in": "body",
3908+
"required": true,
3909+
"schema": {
3910+
"$ref": "#/definitions/WorkflowServiceUnpauseWorkflowExecutionBody"
3911+
}
3912+
}
3913+
],
3914+
"tags": [
3915+
"WorkflowService"
3916+
]
3917+
}
3918+
},
38253919
"/api/v1/nexus/endpoints": {
38263920
"get": {
38273921
"summary": "List all Nexus endpoints for the cluster, sorted by ID in ascending order. Set page_token in the request to the\nnext_page_token field of the previous response to get the next page of results. An empty next_page_token\nindicates that there are no more results. During pagination, a newly added service with an ID lexicographically\nearlier than the previous page's last endpoint's ID may be missed.",

openapi/openapiv3.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,6 +3120,52 @@ paths:
31203120
application/json:
31213121
schema:
31223122
$ref: '#/components/schemas/Status'
3123+
/api/v1/namespaces/{namespace}/workflows/{workflowId}/pause:
3124+
post:
3125+
tags:
3126+
- WorkflowService
3127+
description: |-
3128+
Note: This is an experimental API and the behavior may change in a future release.
3129+
PauseWorkflowExecution pauses the workflow execution specified in the request. Pausing a workflow execution results in
3130+
- The workflow execution status changes to `PAUSED` and a new WORKFLOW_EXECUTION_PAUSED event is added to the history
3131+
- No new workflow tasks or activity tasks are dispatched.
3132+
- Any workflow task currently executing on the worker will be allowed to complete.
3133+
- Any activity task currently executing will be paused.
3134+
- All server-side events will continue to be processed by the server.
3135+
- Queries & Updates on a paused workflow will be rejected.
3136+
operationId: PauseWorkflowExecution
3137+
parameters:
3138+
- name: namespace
3139+
in: path
3140+
description: Namespace of the workflow to pause.
3141+
required: true
3142+
schema:
3143+
type: string
3144+
- name: workflowId
3145+
in: path
3146+
description: ID of the workflow execution to be paused. Required.
3147+
required: true
3148+
schema:
3149+
type: string
3150+
requestBody:
3151+
content:
3152+
application/json:
3153+
schema:
3154+
$ref: '#/components/schemas/PauseWorkflowExecutionRequest'
3155+
required: true
3156+
responses:
3157+
"200":
3158+
description: OK
3159+
content:
3160+
application/json:
3161+
schema:
3162+
$ref: '#/components/schemas/PauseWorkflowExecutionResponse'
3163+
default:
3164+
description: Default error response
3165+
content:
3166+
application/json:
3167+
schema:
3168+
$ref: '#/components/schemas/Status'
31233169
/api/v1/namespaces/{namespace}/workflows/{workflowId}/signal-with-start/{signalName}:
31243170
post:
31253171
tags:
@@ -3174,6 +3220,49 @@ paths:
31743220
application/json:
31753221
schema:
31763222
$ref: '#/components/schemas/Status'
3223+
/api/v1/namespaces/{namespace}/workflows/{workflowId}/unpause:
3224+
post:
3225+
tags:
3226+
- WorkflowService
3227+
description: |-
3228+
Note: This is an experimental API and the behavior may change in a future release.
3229+
UnpauseWorkflowExecution unpauses a previously paused workflow execution specified in the request.
3230+
Unpausing a workflow execution results in
3231+
- The workflow execution status changes to `RUNNING` and a new WORKFLOW_EXECUTION_UNPAUSED event is added to the history
3232+
- Workflow tasks and activity tasks are resumed.
3233+
operationId: UnpauseWorkflowExecution
3234+
parameters:
3235+
- name: namespace
3236+
in: path
3237+
description: Namespace of the workflow to unpause.
3238+
required: true
3239+
schema:
3240+
type: string
3241+
- name: workflowId
3242+
in: path
3243+
description: ID of the workflow execution to be paused. Required.
3244+
required: true
3245+
schema:
3246+
type: string
3247+
requestBody:
3248+
content:
3249+
application/json:
3250+
schema:
3251+
$ref: '#/components/schemas/UnpauseWorkflowExecutionRequest'
3252+
required: true
3253+
responses:
3254+
"200":
3255+
description: OK
3256+
content:
3257+
application/json:
3258+
schema:
3259+
$ref: '#/components/schemas/UnpauseWorkflowExecutionResponse'
3260+
default:
3261+
description: Default error response
3262+
content:
3263+
application/json:
3264+
schema:
3265+
$ref: '#/components/schemas/Status'
31773266
/api/v1/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/cancel:
31783267
post:
31793268
tags:

temporal/api/workflowservice/v1/service.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,10 @@ service WorkflowService {
12981298
option (google.api.http) = {
12991299
post: "/namespaces/{namespace}/workflows/{workflow_id}/pause"
13001300
body: "*"
1301+
additional_bindings {
1302+
post: "/api/v1/namespaces/{namespace}/workflows/{workflow_id}/pause"
1303+
body: "*"
1304+
}
13011305
};
13021306
}
13031307

@@ -1310,6 +1314,10 @@ service WorkflowService {
13101314
option (google.api.http) = {
13111315
post: "/namespaces/{namespace}/workflows/{workflow_id}/unpause"
13121316
body: "*"
1317+
additional_bindings {
1318+
post: "/api/v1/namespaces/{namespace}/workflows/{workflow_id}/unpause"
1319+
body: "*"
1320+
}
13131321
};
13141322
}
13151323

0 commit comments

Comments
 (0)