conductor_ruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +142 -0
- data/LICENSE +190 -0
- data/README.md +517 -0
- data/examples/agentic_workflows/llm_chat.rb +106 -0
- data/examples/dynamic_workflow.rb +177 -0
- data/examples/event_handler.rb +94 -0
- data/examples/event_listener_examples.rb +430 -0
- data/examples/helloworld/greetings_worker.rb +24 -0
- data/examples/helloworld/helloworld.rb +99 -0
- data/examples/kitchensink.rb +213 -0
- data/examples/metadata_journey.rb +189 -0
- data/examples/metrics_example.rb +284 -0
- data/examples/new_dsl_demo.rb +141 -0
- data/examples/orkes/http_poll.rb +83 -0
- data/examples/orkes/secrets_example.rb +69 -0
- data/examples/orkes/wait_for_webhook.rb +90 -0
- data/examples/prompt_journey.rb +245 -0
- data/examples/rag_workflow.rb +167 -0
- data/examples/schedule_journey.rb +244 -0
- data/examples/simple_worker.rb +125 -0
- data/examples/simple_workflow.rb +89 -0
- data/examples/task_context_example.rb +257 -0
- data/examples/task_listener_example.rb +192 -0
- data/examples/worker_configuration_example.rb +282 -0
- data/examples/workflow_dsl.rb +316 -0
- data/examples/workflow_ops.rb +305 -0
- data/lib/conductor/client/authorization_client.rb +238 -0
- data/lib/conductor/client/integration_client.rb +108 -0
- data/lib/conductor/client/metadata_client.rb +139 -0
- data/lib/conductor/client/prompt_client.rb +58 -0
- data/lib/conductor/client/scheduler_client.rb +132 -0
- data/lib/conductor/client/schema_client.rb +32 -0
- data/lib/conductor/client/secret_client.rb +48 -0
- data/lib/conductor/client/task_client.rb +168 -0
- data/lib/conductor/client/workflow_client.rb +242 -0
- data/lib/conductor/configuration/authentication_settings.rb +17 -0
- data/lib/conductor/configuration.rb +103 -0
- data/lib/conductor/exceptions.rb +86 -0
- data/lib/conductor/http/api/application_resource_api.rb +107 -0
- data/lib/conductor/http/api/authorization_resource_api.rb +56 -0
- data/lib/conductor/http/api/event_resource_api.rb +133 -0
- data/lib/conductor/http/api/gateway_auth_resource_api.rb +48 -0
- data/lib/conductor/http/api/group_resource_api.rb +76 -0
- data/lib/conductor/http/api/integration_resource_api.rb +145 -0
- data/lib/conductor/http/api/metadata_resource_api.rb +231 -0
- data/lib/conductor/http/api/prompt_resource_api.rb +81 -0
- data/lib/conductor/http/api/role_resource_api.rb +60 -0
- data/lib/conductor/http/api/scheduler_resource_api.rb +211 -0
- data/lib/conductor/http/api/schema_resource_api.rb +82 -0
- data/lib/conductor/http/api/secret_resource_api.rb +134 -0
- data/lib/conductor/http/api/task_resource_api.rb +321 -0
- data/lib/conductor/http/api/token_resource_api.rb +42 -0
- data/lib/conductor/http/api/user_resource_api.rb +59 -0
- data/lib/conductor/http/api/workflow_bulk_resource_api.rb +91 -0
- data/lib/conductor/http/api/workflow_resource_api.rb +451 -0
- data/lib/conductor/http/api_client.rb +437 -0
- data/lib/conductor/http/models/authentication_config.rb +67 -0
- data/lib/conductor/http/models/authorization_request.rb +39 -0
- data/lib/conductor/http/models/base_model.rb +162 -0
- data/lib/conductor/http/models/bulk_response.rb +39 -0
- data/lib/conductor/http/models/conductor_application.rb +39 -0
- data/lib/conductor/http/models/conductor_user.rb +53 -0
- data/lib/conductor/http/models/create_or_update_application_request.rb +24 -0
- data/lib/conductor/http/models/create_or_update_role_request.rb +27 -0
- data/lib/conductor/http/models/event_handler.rb +130 -0
- data/lib/conductor/http/models/generate_token_request.rb +27 -0
- data/lib/conductor/http/models/group.rb +36 -0
- data/lib/conductor/http/models/integration.rb +70 -0
- data/lib/conductor/http/models/integration_api.rb +53 -0
- data/lib/conductor/http/models/integration_api_update.rb +43 -0
- data/lib/conductor/http/models/integration_update.rb +36 -0
- data/lib/conductor/http/models/permission.rb +24 -0
- data/lib/conductor/http/models/poll_data.rb +33 -0
- data/lib/conductor/http/models/prompt_template.rb +59 -0
- data/lib/conductor/http/models/prompt_template_test_request.rb +43 -0
- data/lib/conductor/http/models/rerun_workflow_request.rb +37 -0
- data/lib/conductor/http/models/role.rb +27 -0
- data/lib/conductor/http/models/schema_def.rb +59 -0
- data/lib/conductor/http/models/search_result.rb +187 -0
- data/lib/conductor/http/models/skip_task_request.rb +27 -0
- data/lib/conductor/http/models/start_workflow_request.rb +68 -0
- data/lib/conductor/http/models/subject_ref.rb +35 -0
- data/lib/conductor/http/models/tag_object.rb +36 -0
- data/lib/conductor/http/models/target_ref.rb +39 -0
- data/lib/conductor/http/models/task.rb +156 -0
- data/lib/conductor/http/models/task_def.rb +95 -0
- data/lib/conductor/http/models/task_exec_log.rb +30 -0
- data/lib/conductor/http/models/task_result.rb +115 -0
- data/lib/conductor/http/models/task_result_status.rb +24 -0
- data/lib/conductor/http/models/token.rb +33 -0
- data/lib/conductor/http/models/upsert_group_request.rb +30 -0
- data/lib/conductor/http/models/upsert_user_request.rb +39 -0
- data/lib/conductor/http/models/workflow.rb +202 -0
- data/lib/conductor/http/models/workflow_def.rb +73 -0
- data/lib/conductor/http/models/workflow_schedule.rb +100 -0
- data/lib/conductor/http/models/workflow_state_update.rb +30 -0
- data/lib/conductor/http/models/workflow_status_constants.rb +57 -0
- data/lib/conductor/http/models/workflow_task.rb +169 -0
- data/lib/conductor/http/models/workflow_test_request.rb +67 -0
- data/lib/conductor/http/rest_client.rb +211 -0
- data/lib/conductor/orkes/models/access_key.rb +56 -0
- data/lib/conductor/orkes/models/granted_permission.rb +27 -0
- data/lib/conductor/orkes/models/metadata_tag.rb +15 -0
- data/lib/conductor/orkes/models/rate_limit_tag.rb +15 -0
- data/lib/conductor/orkes/orkes_clients.rb +69 -0
- data/lib/conductor/version.rb +5 -0
- data/lib/conductor/worker/events/conductor_event.rb +40 -0
- data/lib/conductor/worker/events/global_dispatcher.rb +37 -0
- data/lib/conductor/worker/events/http_events.rb +25 -0
- data/lib/conductor/worker/events/listener_registry.rb +40 -0
- data/lib/conductor/worker/events/listeners.rb +34 -0
- data/lib/conductor/worker/events/sync_event_dispatcher.rb +78 -0
- data/lib/conductor/worker/events/task_runner_events.rb +271 -0
- data/lib/conductor/worker/events/workflow_events.rb +49 -0
- data/lib/conductor/worker/fiber_executor.rb +532 -0
- data/lib/conductor/worker/ractor_task_runner.rb +501 -0
- data/lib/conductor/worker/task_context.rb +114 -0
- data/lib/conductor/worker/task_definition_registrar.rb +322 -0
- data/lib/conductor/worker/task_handler.rb +360 -0
- data/lib/conductor/worker/task_in_progress.rb +60 -0
- data/lib/conductor/worker/task_runner.rb +538 -0
- data/lib/conductor/worker/telemetry/metrics_collector.rb +196 -0
- data/lib/conductor/worker/telemetry/prometheus_backend.rb +224 -0
- data/lib/conductor/worker/worker.rb +355 -0
- data/lib/conductor/worker/worker_config.rb +154 -0
- data/lib/conductor/worker/worker_registry.rb +71 -0
- data/lib/conductor/workflow/dsl/input_ref.rb +37 -0
- data/lib/conductor/workflow/dsl/output_ref.rb +44 -0
- data/lib/conductor/workflow/dsl/parallel_builder.rb +49 -0
- data/lib/conductor/workflow/dsl/switch_builder.rb +74 -0
- data/lib/conductor/workflow/dsl/task_ref.rb +178 -0
- data/lib/conductor/workflow/dsl/workflow_builder.rb +1016 -0
- data/lib/conductor/workflow/dsl/workflow_definition.rb +150 -0
- data/lib/conductor/workflow/llm/chat_message.rb +47 -0
- data/lib/conductor/workflow/llm/embedding_model.rb +19 -0
- data/lib/conductor/workflow/llm/tool_call.rb +43 -0
- data/lib/conductor/workflow/llm/tool_spec.rb +46 -0
- data/lib/conductor/workflow/task_type.rb +68 -0
- data/lib/conductor/workflow/timeout_policy.rb +31 -0
- data/lib/conductor/workflow/workflow_executor.rb +373 -0
- data/lib/conductor.rb +192 -0
- metadata +359 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# TaskResourceApi - API for task operations
|
|
9
|
+
class TaskResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
# Initialize TaskResourceApi
|
|
13
|
+
# @param [ApiClient] api_client Optional API client
|
|
14
|
+
def initialize(api_client = nil)
|
|
15
|
+
@api_client = api_client || ApiClient.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Poll for a task of a certain type
|
|
19
|
+
# @param [String] task_type Task type to poll
|
|
20
|
+
# @param [String] worker_id Worker ID (optional)
|
|
21
|
+
# @param [String] domain Domain (optional)
|
|
22
|
+
# @return [Task, nil] Task object or nil if no task available
|
|
23
|
+
def poll(task_type, worker_id: nil, domain: nil)
|
|
24
|
+
query_params = {}
|
|
25
|
+
query_params[:workerid] = worker_id if worker_id
|
|
26
|
+
query_params[:domain] = domain if domain
|
|
27
|
+
|
|
28
|
+
@api_client.call_api(
|
|
29
|
+
'/tasks/poll/{taskType}',
|
|
30
|
+
'GET',
|
|
31
|
+
path_params: { taskType: task_type },
|
|
32
|
+
query_params: query_params,
|
|
33
|
+
return_type: 'Task',
|
|
34
|
+
return_http_data_only: true
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Batch poll for tasks
|
|
39
|
+
# @param [String] task_type Task type to poll
|
|
40
|
+
# @param [Integer] count Number of tasks to poll (default: 1, max: 100)
|
|
41
|
+
# @param [Integer] timeout Timeout in milliseconds (default: 100)
|
|
42
|
+
# @param [String] worker_id Worker ID (optional)
|
|
43
|
+
# @param [String] domain Domain (optional)
|
|
44
|
+
# @return [Array<Task>] Array of tasks
|
|
45
|
+
def batch_poll(task_type, count: 1, timeout: 100, worker_id: nil, domain: nil)
|
|
46
|
+
query_params = {
|
|
47
|
+
count: [count, 100].min,
|
|
48
|
+
timeout: timeout
|
|
49
|
+
}
|
|
50
|
+
query_params[:workerid] = worker_id if worker_id
|
|
51
|
+
query_params[:domain] = domain if domain
|
|
52
|
+
|
|
53
|
+
@api_client.call_api(
|
|
54
|
+
'/tasks/poll/batch/{taskType}',
|
|
55
|
+
'GET',
|
|
56
|
+
path_params: { taskType: task_type },
|
|
57
|
+
query_params: query_params,
|
|
58
|
+
return_type: 'Array<Task>',
|
|
59
|
+
return_http_data_only: true
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Update task status
|
|
64
|
+
# @param [TaskResult] body Task result
|
|
65
|
+
# @return [String] Task ID
|
|
66
|
+
def update_task(body)
|
|
67
|
+
@api_client.call_api(
|
|
68
|
+
'/tasks',
|
|
69
|
+
'POST',
|
|
70
|
+
body: body,
|
|
71
|
+
return_type: 'String',
|
|
72
|
+
return_http_data_only: true
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Get task details
|
|
77
|
+
# @param [String] task_id Task ID
|
|
78
|
+
# @return [Task] Task object
|
|
79
|
+
def get_task(task_id)
|
|
80
|
+
@api_client.call_api(
|
|
81
|
+
'/tasks/{taskId}',
|
|
82
|
+
'GET',
|
|
83
|
+
path_params: { taskId: task_id },
|
|
84
|
+
return_type: 'Task',
|
|
85
|
+
return_http_data_only: true
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Remove task from queue
|
|
90
|
+
# @param [String] task_type Task type
|
|
91
|
+
# @param [String] task_id Task ID
|
|
92
|
+
# @return [void]
|
|
93
|
+
def remove_task_from_queue(task_type, task_id)
|
|
94
|
+
@api_client.call_api(
|
|
95
|
+
'/tasks/queue/{taskType}/{taskId}',
|
|
96
|
+
'DELETE',
|
|
97
|
+
path_params: { taskType: task_type, taskId: task_id },
|
|
98
|
+
return_http_data_only: true
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Get task queue sizes
|
|
103
|
+
# @param [Array<String>] task_types List of task types (optional)
|
|
104
|
+
# @return [Hash<String, Integer>] Map of task type to queue size
|
|
105
|
+
def size(task_types: nil)
|
|
106
|
+
@api_client.call_api(
|
|
107
|
+
'/tasks/queue/sizes',
|
|
108
|
+
'POST',
|
|
109
|
+
body: task_types || [],
|
|
110
|
+
return_type: 'Hash<String, Integer>',
|
|
111
|
+
return_http_data_only: true
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Get all queue details
|
|
116
|
+
# @return [Hash<String, Integer>] Map of task type to queue size
|
|
117
|
+
def all_queue_details
|
|
118
|
+
@api_client.call_api(
|
|
119
|
+
'/tasks/queue/all',
|
|
120
|
+
'GET',
|
|
121
|
+
return_type: 'Hash<String, Integer>',
|
|
122
|
+
return_http_data_only: true
|
|
123
|
+
)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Get queue details for a task type
|
|
127
|
+
# @param [String] task_type Task type
|
|
128
|
+
# @return [Hash] Queue details
|
|
129
|
+
def get_task_queue_details(task_type)
|
|
130
|
+
@api_client.call_api(
|
|
131
|
+
'/tasks/queue/all/{taskType}',
|
|
132
|
+
'GET',
|
|
133
|
+
path_params: { taskType: task_type },
|
|
134
|
+
return_type: 'Hash<String, Object>',
|
|
135
|
+
return_http_data_only: true
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Add task execution log
|
|
140
|
+
# @param [String] task_id Task ID
|
|
141
|
+
# @param [String] log Log message
|
|
142
|
+
# @return [void]
|
|
143
|
+
def log(task_id, log)
|
|
144
|
+
@api_client.call_api(
|
|
145
|
+
'/tasks/{taskId}/log',
|
|
146
|
+
'POST',
|
|
147
|
+
path_params: { taskId: task_id },
|
|
148
|
+
body: log,
|
|
149
|
+
return_http_data_only: true
|
|
150
|
+
)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Get task execution logs
|
|
154
|
+
# @param [String] task_id Task ID
|
|
155
|
+
# @return [Array<TaskExecLog>] Array of task execution logs
|
|
156
|
+
def get_task_logs(task_id)
|
|
157
|
+
@api_client.call_api(
|
|
158
|
+
'/tasks/{taskId}/log',
|
|
159
|
+
'GET',
|
|
160
|
+
path_params: { taskId: task_id },
|
|
161
|
+
return_type: 'Array<TaskExecLog>',
|
|
162
|
+
return_http_data_only: true
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Get pending tasks for a task type
|
|
167
|
+
# @param [String] task_type Task type
|
|
168
|
+
# @param [Integer] start Start index (default: 0)
|
|
169
|
+
# @param [Integer] count Number of tasks (default: 100)
|
|
170
|
+
# @return [Array<Task>] Array of pending tasks
|
|
171
|
+
def get_pending_task_for_task_type(task_type, start: 0, count: 100)
|
|
172
|
+
@api_client.call_api(
|
|
173
|
+
'/tasks/in_progress/{taskType}',
|
|
174
|
+
'GET',
|
|
175
|
+
path_params: { taskType: task_type },
|
|
176
|
+
query_params: { start: start, count: count },
|
|
177
|
+
return_type: 'Array<Task>',
|
|
178
|
+
return_http_data_only: true
|
|
179
|
+
)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Update task by reference name
|
|
183
|
+
# @param [String] workflow_id Workflow ID
|
|
184
|
+
# @param [String] task_ref_name Task reference name
|
|
185
|
+
# @param [String] status New status
|
|
186
|
+
# @param [Hash] output Task output data (optional)
|
|
187
|
+
# @param [String] worker_id Worker ID (optional)
|
|
188
|
+
# @return [String] Updated workflow ID
|
|
189
|
+
def update_task_by_ref_name(workflow_id, task_ref_name, status, output: nil, worker_id: nil)
|
|
190
|
+
query_params = {}
|
|
191
|
+
query_params[:workerid] = worker_id if worker_id
|
|
192
|
+
|
|
193
|
+
@api_client.call_api(
|
|
194
|
+
'/tasks/{workflowId}/{taskRefName}/{status}',
|
|
195
|
+
'POST',
|
|
196
|
+
path_params: {
|
|
197
|
+
workflowId: workflow_id,
|
|
198
|
+
taskRefName: task_ref_name,
|
|
199
|
+
status: status
|
|
200
|
+
},
|
|
201
|
+
query_params: query_params,
|
|
202
|
+
body: output || {},
|
|
203
|
+
return_type: 'String',
|
|
204
|
+
return_http_data_only: true
|
|
205
|
+
)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Update task by reference name synchronously (returns workflow state)
|
|
209
|
+
# @param [String] workflow_id Workflow ID
|
|
210
|
+
# @param [String] task_ref_name Task reference name
|
|
211
|
+
# @param [String] status New status
|
|
212
|
+
# @param [Hash] output Task output data
|
|
213
|
+
# @param [String] worker_id Worker ID (optional)
|
|
214
|
+
# @return [Workflow] Updated workflow
|
|
215
|
+
def update_task_sync(workflow_id, task_ref_name, status, output: nil, worker_id: nil)
|
|
216
|
+
query_params = {}
|
|
217
|
+
query_params[:workerid] = worker_id if worker_id
|
|
218
|
+
|
|
219
|
+
@api_client.call_api(
|
|
220
|
+
'/tasks/{workflowId}/{taskRefName}/{status}/sync',
|
|
221
|
+
'POST',
|
|
222
|
+
path_params: {
|
|
223
|
+
workflowId: workflow_id,
|
|
224
|
+
taskRefName: task_ref_name,
|
|
225
|
+
status: status
|
|
226
|
+
},
|
|
227
|
+
query_params: query_params,
|
|
228
|
+
body: output || {},
|
|
229
|
+
return_type: 'Workflow',
|
|
230
|
+
return_http_data_only: true
|
|
231
|
+
)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Get all queue details (verbose)
|
|
235
|
+
# @return [Hash] Verbose queue details
|
|
236
|
+
def all_verbose
|
|
237
|
+
@api_client.call_api(
|
|
238
|
+
'/tasks/queue/all/verbose',
|
|
239
|
+
'GET',
|
|
240
|
+
return_type: 'Hash<String, Object>',
|
|
241
|
+
return_http_data_only: true
|
|
242
|
+
)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Get queue sizes for specific task types
|
|
246
|
+
# @param [Array<String>] task_types List of task type names
|
|
247
|
+
# @return [Hash<String, Integer>]
|
|
248
|
+
def get_queue_sizes_for_tasks(task_types)
|
|
249
|
+
query_params = {}
|
|
250
|
+
query_params[:taskType] = task_types if task_types&.any?
|
|
251
|
+
|
|
252
|
+
@api_client.call_api(
|
|
253
|
+
'/tasks/queue/sizes',
|
|
254
|
+
'GET',
|
|
255
|
+
query_params: query_params,
|
|
256
|
+
return_type: 'Hash<String, Integer>',
|
|
257
|
+
return_http_data_only: true
|
|
258
|
+
)
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Get poll data for a task type
|
|
262
|
+
# @param [String] task_type Task type name
|
|
263
|
+
# @return [Array<PollData>]
|
|
264
|
+
def get_poll_data(task_type)
|
|
265
|
+
@api_client.call_api(
|
|
266
|
+
'/tasks/queue/polldata',
|
|
267
|
+
'GET',
|
|
268
|
+
query_params: { taskType: task_type },
|
|
269
|
+
return_type: 'Array<PollData>',
|
|
270
|
+
return_http_data_only: true
|
|
271
|
+
)
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Get all poll data
|
|
275
|
+
# @return [Array<PollData>]
|
|
276
|
+
def get_all_poll_data
|
|
277
|
+
@api_client.call_api(
|
|
278
|
+
'/tasks/queue/polldata/all',
|
|
279
|
+
'GET',
|
|
280
|
+
return_type: 'Array<PollData>',
|
|
281
|
+
return_http_data_only: true
|
|
282
|
+
)
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Requeue pending tasks of a type
|
|
286
|
+
# @param [String] task_type Task type name
|
|
287
|
+
# @return [String]
|
|
288
|
+
def requeue_pending_task(task_type)
|
|
289
|
+
@api_client.call_api(
|
|
290
|
+
'/tasks/queue/requeue/{taskType}',
|
|
291
|
+
'POST',
|
|
292
|
+
path_params: { taskType: task_type },
|
|
293
|
+
return_type: 'String',
|
|
294
|
+
return_http_data_only: true
|
|
295
|
+
)
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
# Search for tasks
|
|
299
|
+
# @param [Integer] start Start index (default: 0)
|
|
300
|
+
# @param [Integer] size Page size (default: 100)
|
|
301
|
+
# @param [String] sort Sort order (optional)
|
|
302
|
+
# @param [String] free_text Free text search (default: '*')
|
|
303
|
+
# @param [String] query Query string (optional)
|
|
304
|
+
# @return [SearchResult]
|
|
305
|
+
def search(start: 0, size: 100, sort: nil, free_text: '*', query: nil)
|
|
306
|
+
query_params = { start: start, size: size, freeText: free_text }
|
|
307
|
+
query_params[:sort] = sort if sort
|
|
308
|
+
query_params[:query] = query if query
|
|
309
|
+
|
|
310
|
+
@api_client.call_api(
|
|
311
|
+
'/tasks/search',
|
|
312
|
+
'GET',
|
|
313
|
+
query_params: query_params,
|
|
314
|
+
return_type: 'SearchResult',
|
|
315
|
+
return_http_data_only: true
|
|
316
|
+
)
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# TokenResourceApi - API for token management operations (Orkes)
|
|
9
|
+
class TokenResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
def initialize(api_client = nil)
|
|
13
|
+
@api_client = api_client || ApiClient.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Generate a token
|
|
17
|
+
# @param [GenerateTokenRequest] body Token request
|
|
18
|
+
# @return [Hash]
|
|
19
|
+
def generate_token(body)
|
|
20
|
+
@api_client.call_api(
|
|
21
|
+
'/token',
|
|
22
|
+
'POST',
|
|
23
|
+
body: body,
|
|
24
|
+
return_type: 'Object',
|
|
25
|
+
return_http_data_only: true
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Get user info from current token
|
|
30
|
+
# @return [Hash]
|
|
31
|
+
def get_user_info
|
|
32
|
+
@api_client.call_api(
|
|
33
|
+
'/token/userInfo',
|
|
34
|
+
'GET',
|
|
35
|
+
return_type: 'Object',
|
|
36
|
+
return_http_data_only: true
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# UserResourceApi - API for user management operations (Orkes)
|
|
9
|
+
class UserResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
def initialize(api_client = nil)
|
|
13
|
+
@api_client = api_client || ApiClient.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Create or update a user
|
|
17
|
+
def upsert_user(body, id)
|
|
18
|
+
@api_client.call_api('/users/{id}', 'PUT', path_params: { id: id }, body: body, return_type: 'ConductorUser',
|
|
19
|
+
return_http_data_only: true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get a user by ID
|
|
23
|
+
def get_user(id)
|
|
24
|
+
@api_client.call_api('/users/{id}', 'GET', path_params: { id: id }, return_type: 'ConductorUser',
|
|
25
|
+
return_http_data_only: true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# List all users
|
|
29
|
+
def list_users(apps: false)
|
|
30
|
+
@api_client.call_api('/users', 'GET', query_params: { apps: apps }, return_type: 'Array<ConductorUser>',
|
|
31
|
+
return_http_data_only: true)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delete a user
|
|
35
|
+
def delete_user(id)
|
|
36
|
+
@api_client.call_api('/users/{id}', 'DELETE', path_params: { id: id }, return_http_data_only: true)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Check permissions for a user
|
|
40
|
+
def check_permissions(user_id, target_type, target_id)
|
|
41
|
+
@api_client.call_api(
|
|
42
|
+
'/users/{userId}/checkPermissions',
|
|
43
|
+
'GET',
|
|
44
|
+
path_params: { userId: user_id },
|
|
45
|
+
query_params: { type: target_type, id: target_id },
|
|
46
|
+
return_type: 'Object',
|
|
47
|
+
return_http_data_only: true
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get granted permissions for a user
|
|
52
|
+
def get_granted_permissions(user_id)
|
|
53
|
+
@api_client.call_api('/users/{userId}/permissions', 'GET', path_params: { userId: user_id },
|
|
54
|
+
return_type: 'Object', return_http_data_only: true)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# WorkflowBulkResourceApi - Bulk operations on workflows
|
|
9
|
+
class WorkflowBulkResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
def initialize(api_client = nil)
|
|
13
|
+
@api_client = api_client || ApiClient.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Pause workflows in bulk
|
|
17
|
+
# @param [Array<String>] workflow_ids List of workflow IDs
|
|
18
|
+
# @return [BulkResponse]
|
|
19
|
+
def pause_workflow(workflow_ids)
|
|
20
|
+
@api_client.call_api(
|
|
21
|
+
'/workflow/bulk/pause',
|
|
22
|
+
'PUT',
|
|
23
|
+
body: workflow_ids,
|
|
24
|
+
return_type: 'BulkResponse',
|
|
25
|
+
return_http_data_only: true
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Resume workflows in bulk
|
|
30
|
+
# @param [Array<String>] workflow_ids List of workflow IDs
|
|
31
|
+
# @return [BulkResponse]
|
|
32
|
+
def resume_workflow(workflow_ids)
|
|
33
|
+
@api_client.call_api(
|
|
34
|
+
'/workflow/bulk/resume',
|
|
35
|
+
'PUT',
|
|
36
|
+
body: workflow_ids,
|
|
37
|
+
return_type: 'BulkResponse',
|
|
38
|
+
return_http_data_only: true
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Restart workflows in bulk
|
|
43
|
+
# @param [Array<String>] workflow_ids List of workflow IDs
|
|
44
|
+
# @param [Boolean] use_latest_definitions Use latest definitions (default: false)
|
|
45
|
+
# @return [BulkResponse]
|
|
46
|
+
def restart(workflow_ids, use_latest_definitions: false)
|
|
47
|
+
@api_client.call_api(
|
|
48
|
+
'/workflow/bulk/restart',
|
|
49
|
+
'POST',
|
|
50
|
+
query_params: { useLatestDefinitions: use_latest_definitions },
|
|
51
|
+
body: workflow_ids,
|
|
52
|
+
return_type: 'BulkResponse',
|
|
53
|
+
return_http_data_only: true
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Retry workflows in bulk
|
|
58
|
+
# @param [Array<String>] workflow_ids List of workflow IDs
|
|
59
|
+
# @return [BulkResponse]
|
|
60
|
+
def retry(workflow_ids)
|
|
61
|
+
@api_client.call_api(
|
|
62
|
+
'/workflow/bulk/retry',
|
|
63
|
+
'POST',
|
|
64
|
+
body: workflow_ids,
|
|
65
|
+
return_type: 'BulkResponse',
|
|
66
|
+
return_http_data_only: true
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Terminate workflows in bulk
|
|
71
|
+
# @param [Array<String>] workflow_ids List of workflow IDs
|
|
72
|
+
# @param [String] reason Termination reason (optional)
|
|
73
|
+
# @param [Boolean] trigger_failure_workflow Trigger failure workflow (default: false)
|
|
74
|
+
# @return [BulkResponse]
|
|
75
|
+
def terminate(workflow_ids, reason: nil, trigger_failure_workflow: false)
|
|
76
|
+
query_params = { triggerFailureWorkflow: trigger_failure_workflow }
|
|
77
|
+
query_params[:reason] = reason if reason
|
|
78
|
+
|
|
79
|
+
@api_client.call_api(
|
|
80
|
+
'/workflow/bulk/terminate',
|
|
81
|
+
'POST',
|
|
82
|
+
query_params: query_params,
|
|
83
|
+
body: workflow_ids,
|
|
84
|
+
return_type: 'BulkResponse',
|
|
85
|
+
return_http_data_only: true
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|