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,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# EventResourceApi - API for event handler operations
|
|
9
|
+
class EventResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
def initialize(api_client = nil)
|
|
13
|
+
@api_client = api_client || ApiClient.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Add an event handler
|
|
17
|
+
# @param [EventHandler] body Event handler definition
|
|
18
|
+
# @return [void]
|
|
19
|
+
def add_event_handler(body)
|
|
20
|
+
@api_client.call_api(
|
|
21
|
+
'/event',
|
|
22
|
+
'POST',
|
|
23
|
+
body: body,
|
|
24
|
+
return_http_data_only: true
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Update an event handler
|
|
29
|
+
# @param [EventHandler] body Event handler definition
|
|
30
|
+
# @return [void]
|
|
31
|
+
def update_event_handler(body)
|
|
32
|
+
@api_client.call_api(
|
|
33
|
+
'/event',
|
|
34
|
+
'PUT',
|
|
35
|
+
body: body,
|
|
36
|
+
return_http_data_only: true
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Get all event handlers
|
|
41
|
+
# @return [Array<EventHandler>]
|
|
42
|
+
def get_event_handlers
|
|
43
|
+
@api_client.call_api(
|
|
44
|
+
'/event',
|
|
45
|
+
'GET',
|
|
46
|
+
return_type: 'Array<EventHandler>',
|
|
47
|
+
return_http_data_only: true
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get event handlers for a specific event
|
|
52
|
+
# @param [String] event Event name
|
|
53
|
+
# @param [Boolean] active_only Only return active handlers (default: true)
|
|
54
|
+
# @return [Array<EventHandler>]
|
|
55
|
+
def get_event_handlers_for_event(event, active_only: true)
|
|
56
|
+
@api_client.call_api(
|
|
57
|
+
'/event/{event}',
|
|
58
|
+
'GET',
|
|
59
|
+
path_params: { event: event },
|
|
60
|
+
query_params: { activeOnly: active_only },
|
|
61
|
+
return_type: 'Array<EventHandler>',
|
|
62
|
+
return_http_data_only: true
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Remove an event handler
|
|
67
|
+
# @param [String] name Event handler name
|
|
68
|
+
# @return [void]
|
|
69
|
+
def remove_event_handler(name)
|
|
70
|
+
@api_client.call_api(
|
|
71
|
+
'/event/{name}',
|
|
72
|
+
'DELETE',
|
|
73
|
+
path_params: { name: name },
|
|
74
|
+
return_http_data_only: true
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Get queue configuration
|
|
79
|
+
# @param [String] queue_type Queue type
|
|
80
|
+
# @param [String] queue_name Queue name
|
|
81
|
+
# @return [Hash]
|
|
82
|
+
def get_queue_config(queue_type, queue_name)
|
|
83
|
+
@api_client.call_api(
|
|
84
|
+
'/event/queue/config/{queueType}/{queueName}',
|
|
85
|
+
'GET',
|
|
86
|
+
path_params: { queueType: queue_type, queueName: queue_name },
|
|
87
|
+
return_type: 'Hash<String, Object>',
|
|
88
|
+
return_http_data_only: true
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Update queue configuration
|
|
93
|
+
# @param [String] queue_type Queue type
|
|
94
|
+
# @param [String] queue_name Queue name
|
|
95
|
+
# @param [String] body Queue configuration (JSON string)
|
|
96
|
+
# @return [void]
|
|
97
|
+
def put_queue_config(queue_type, queue_name, body)
|
|
98
|
+
@api_client.call_api(
|
|
99
|
+
'/event/queue/config/{queueType}/{queueName}',
|
|
100
|
+
'PUT',
|
|
101
|
+
path_params: { queueType: queue_type, queueName: queue_name },
|
|
102
|
+
body: body,
|
|
103
|
+
return_http_data_only: true
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Delete queue configuration
|
|
108
|
+
# @param [String] queue_type Queue type
|
|
109
|
+
# @param [String] queue_name Queue name
|
|
110
|
+
# @return [void]
|
|
111
|
+
def delete_queue_config(queue_type, queue_name)
|
|
112
|
+
@api_client.call_api(
|
|
113
|
+
'/event/queue/config/{queueType}/{queueName}',
|
|
114
|
+
'DELETE',
|
|
115
|
+
path_params: { queueType: queue_type, queueName: queue_name },
|
|
116
|
+
return_http_data_only: true
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Get all queue names
|
|
121
|
+
# @return [Hash<String, String>]
|
|
122
|
+
def get_queue_names
|
|
123
|
+
@api_client.call_api(
|
|
124
|
+
'/event/queue/config',
|
|
125
|
+
'GET',
|
|
126
|
+
return_type: 'Hash<String, String>',
|
|
127
|
+
return_http_data_only: true
|
|
128
|
+
)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# GatewayAuthResourceApi - API for gateway authentication config (Orkes)
|
|
9
|
+
class GatewayAuthResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
def initialize(api_client = nil)
|
|
13
|
+
@api_client = api_client || ApiClient.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Create gateway auth config
|
|
17
|
+
def create_config(body)
|
|
18
|
+
@api_client.call_api('/gateway/config/auth', 'POST', body: body, return_type: 'String',
|
|
19
|
+
return_http_data_only: true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get gateway auth config by ID
|
|
23
|
+
def get_config(id)
|
|
24
|
+
@api_client.call_api('/gateway/config/auth/{id}', 'GET', path_params: { id: id },
|
|
25
|
+
return_type: 'AuthenticationConfig', return_http_data_only: true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# List all gateway auth configs
|
|
29
|
+
def list_configs
|
|
30
|
+
@api_client.call_api('/gateway/config/auth', 'GET', return_type: 'Array<AuthenticationConfig>',
|
|
31
|
+
return_http_data_only: true)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Update gateway auth config
|
|
35
|
+
def update_config(id, body)
|
|
36
|
+
@api_client.call_api('/gateway/config/auth/{id}', 'PUT', path_params: { id: id }, body: body,
|
|
37
|
+
return_http_data_only: true)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Delete gateway auth config
|
|
41
|
+
def delete_config(id)
|
|
42
|
+
@api_client.call_api('/gateway/config/auth/{id}', 'DELETE', path_params: { id: id },
|
|
43
|
+
return_http_data_only: true)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# GroupResourceApi - API for group management operations (Orkes)
|
|
9
|
+
class GroupResourceApi
|
|
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 group
|
|
17
|
+
def upsert_group(body, id)
|
|
18
|
+
@api_client.call_api('/groups/{id}', 'PUT', path_params: { id: id }, body: body, return_type: 'Group',
|
|
19
|
+
return_http_data_only: true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get a group by ID
|
|
23
|
+
def get_group(id)
|
|
24
|
+
@api_client.call_api('/groups/{id}', 'GET', path_params: { id: id }, return_type: 'Group',
|
|
25
|
+
return_http_data_only: true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# List all groups
|
|
29
|
+
def list_groups
|
|
30
|
+
@api_client.call_api('/groups', 'GET', return_type: 'Array<Group>', return_http_data_only: true)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Delete a group
|
|
34
|
+
def delete_group(id)
|
|
35
|
+
@api_client.call_api('/groups/{id}', 'DELETE', path_params: { id: id }, return_http_data_only: true)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Add a user to a group
|
|
39
|
+
def add_user_to_group(group_id, user_id)
|
|
40
|
+
@api_client.call_api('/groups/{groupId}/users/{userId}', 'POST',
|
|
41
|
+
path_params: { groupId: group_id, userId: user_id }, return_http_data_only: true)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Get users in a group
|
|
45
|
+
def get_users_in_group(id)
|
|
46
|
+
@api_client.call_api('/groups/{id}/users', 'GET', path_params: { id: id },
|
|
47
|
+
return_type: 'Array<ConductorUser>', return_http_data_only: true)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Remove a user from a group
|
|
51
|
+
def remove_user_from_group(group_id, user_id)
|
|
52
|
+
@api_client.call_api('/groups/{groupId}/users/{userId}', 'DELETE',
|
|
53
|
+
path_params: { groupId: group_id, userId: user_id }, return_http_data_only: true)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Add multiple users to a group
|
|
57
|
+
def add_users_to_group(group_id, user_ids)
|
|
58
|
+
@api_client.call_api('/groups/{groupId}/users', 'POST', path_params: { groupId: group_id }, body: user_ids,
|
|
59
|
+
return_http_data_only: true)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Remove multiple users from a group
|
|
63
|
+
def remove_users_from_group(group_id, user_ids)
|
|
64
|
+
@api_client.call_api('/groups/{groupId}/users', 'DELETE', path_params: { groupId: group_id }, body: user_ids,
|
|
65
|
+
return_http_data_only: true)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Get granted permissions for a group
|
|
69
|
+
def get_granted_permissions(group_id)
|
|
70
|
+
@api_client.call_api('/groups/{groupId}/permissions', 'GET', path_params: { groupId: group_id },
|
|
71
|
+
return_type: 'Object', return_http_data_only: true)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# IntegrationResourceApi - API for integration management operations (Orkes)
|
|
9
|
+
class IntegrationResourceApi
|
|
10
|
+
attr_accessor :api_client
|
|
11
|
+
|
|
12
|
+
def initialize(api_client = nil)
|
|
13
|
+
@api_client = api_client || ApiClient.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Save (create/update) an integration provider
|
|
17
|
+
def save_integration(body, name)
|
|
18
|
+
@api_client.call_api('/integrations/provider/{name}', 'POST', path_params: { name: name }, body: body,
|
|
19
|
+
return_http_data_only: true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get an integration provider
|
|
23
|
+
def get_integration(name)
|
|
24
|
+
@api_client.call_api('/integrations/provider/{name}', 'GET', path_params: { name: name },
|
|
25
|
+
return_type: 'Integration', return_http_data_only: true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Get all integration providers
|
|
29
|
+
def get_integrations
|
|
30
|
+
@api_client.call_api('/integrations/provider', 'GET', return_type: 'Array<Integration>',
|
|
31
|
+
return_http_data_only: true)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delete an integration provider
|
|
35
|
+
def delete_integration(name)
|
|
36
|
+
@api_client.call_api('/integrations/provider/{name}', 'DELETE', path_params: { name: name },
|
|
37
|
+
return_http_data_only: true)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Save (create/update) an integration API
|
|
41
|
+
def save_integration_api(body, name, integration_name)
|
|
42
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}', 'POST',
|
|
43
|
+
path_params: { name: name, integration_name: integration_name }, body: body, return_http_data_only: true)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Get an integration API
|
|
47
|
+
def get_integration_api(name, integration_name)
|
|
48
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}', 'GET',
|
|
49
|
+
path_params: { name: name, integration_name: integration_name }, return_type: 'IntegrationApi', return_http_data_only: true)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Get all integration APIs for a provider
|
|
53
|
+
def get_integration_apis(name)
|
|
54
|
+
@api_client.call_api('/integrations/provider/{name}/integration', 'GET',
|
|
55
|
+
path_params: { name: name }, return_type: 'Array<IntegrationApi>', return_http_data_only: true)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Delete an integration API
|
|
59
|
+
def delete_integration_api(name, integration_name)
|
|
60
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}', 'DELETE',
|
|
61
|
+
path_params: { name: name, integration_name: integration_name }, return_http_data_only: true)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Associate a prompt with an integration
|
|
65
|
+
def associate_prompt_with_integration(integration_provider, integration_name, prompt_name)
|
|
66
|
+
@api_client.call_api('/integrations/provider/{integration_provider}/integration/{integration_name}/prompt/{prompt_name}', 'POST',
|
|
67
|
+
path_params: { integration_provider: integration_provider, integration_name: integration_name, prompt_name: prompt_name },
|
|
68
|
+
return_http_data_only: true)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Get prompts associated with an integration
|
|
72
|
+
def get_prompts_with_integration(integration_provider, integration_name)
|
|
73
|
+
@api_client.call_api('/integrations/provider/{integration_provider}/integration/{integration_name}/prompt', 'GET',
|
|
74
|
+
path_params: { integration_provider: integration_provider, integration_name: integration_name },
|
|
75
|
+
return_type: 'Array<PromptTemplate>', return_http_data_only: true)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Get token usage for an integration API
|
|
79
|
+
def get_token_usage_for_integration(name, integration_name)
|
|
80
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}/metrics', 'GET',
|
|
81
|
+
path_params: { name: name, integration_name: integration_name }, return_type: 'Integer', return_http_data_only: true)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Get token usage for an integration provider
|
|
85
|
+
def get_token_usage_for_integration_provider(name)
|
|
86
|
+
@api_client.call_api('/integrations/provider/{name}/metrics', 'GET',
|
|
87
|
+
path_params: { name: name }, return_type: 'Object', return_http_data_only: true)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Set tags for an integration API
|
|
91
|
+
def put_tag_for_integration(body, name, integration_name)
|
|
92
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}/tags', 'PUT',
|
|
93
|
+
path_params: { name: name, integration_name: integration_name }, body: body, return_http_data_only: true)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Get tags for an integration API
|
|
97
|
+
def get_tags_for_integration(name, integration_name)
|
|
98
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}/tags', 'GET',
|
|
99
|
+
path_params: { name: name, integration_name: integration_name }, return_type: 'Array<TagObject>', return_http_data_only: true)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Delete tags for an integration API
|
|
103
|
+
def delete_tag_for_integration(body, name, integration_name)
|
|
104
|
+
@api_client.call_api('/integrations/provider/{name}/integration/{integration_name}/tags', 'DELETE',
|
|
105
|
+
path_params: { name: name, integration_name: integration_name }, body: body, return_http_data_only: true)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Set tags for an integration provider
|
|
109
|
+
def put_tag_for_integration_provider(body, name)
|
|
110
|
+
@api_client.call_api('/integrations/provider/{name}/tags', 'PUT',
|
|
111
|
+
path_params: { name: name }, body: body, return_http_data_only: true)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Get tags for an integration provider
|
|
115
|
+
def get_tags_for_integration_provider(name)
|
|
116
|
+
@api_client.call_api('/integrations/provider/{name}/tags', 'GET',
|
|
117
|
+
path_params: { name: name }, return_type: 'Array<TagObject>', return_http_data_only: true)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Delete tags for an integration provider
|
|
121
|
+
def delete_tag_for_integration_provider(body, name)
|
|
122
|
+
@api_client.call_api('/integrations/provider/{name}/tags', 'DELETE',
|
|
123
|
+
path_params: { name: name }, body: body, return_http_data_only: true)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Get available APIs for an integration
|
|
127
|
+
def get_integration_available_apis(name)
|
|
128
|
+
@api_client.call_api('/integrations/provider/{name}/integration/all', 'GET',
|
|
129
|
+
path_params: { name: name }, return_type: 'Array<IntegrationApi>', return_http_data_only: true)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Get integration provider definitions
|
|
133
|
+
def get_integration_provider_defs
|
|
134
|
+
@api_client.call_api('/integrations/def', 'GET', return_type: 'Object', return_http_data_only: true)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Get all providers and integrations
|
|
138
|
+
def get_providers_and_integrations
|
|
139
|
+
@api_client.call_api('/integrations/all', 'GET', return_type: 'Array<Integration>',
|
|
140
|
+
return_http_data_only: true)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../api_client'
|
|
4
|
+
|
|
5
|
+
module Conductor
|
|
6
|
+
module Http
|
|
7
|
+
module Api
|
|
8
|
+
# MetadataResourceApi - API for workflow and task metadata operations
|
|
9
|
+
# Manages task definitions and workflow definitions
|
|
10
|
+
class MetadataResourceApi
|
|
11
|
+
attr_accessor :api_client
|
|
12
|
+
|
|
13
|
+
# Initialize MetadataResourceApi
|
|
14
|
+
# @param [ApiClient] api_client Optional API client
|
|
15
|
+
def initialize(api_client = nil)
|
|
16
|
+
@api_client = api_client || ApiClient.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# ==========================================
|
|
20
|
+
# Workflow Definition Operations
|
|
21
|
+
# ==========================================
|
|
22
|
+
|
|
23
|
+
# Create a new workflow definition
|
|
24
|
+
# @param [WorkflowDef] body Workflow definition
|
|
25
|
+
# @param [Boolean] overwrite Overwrite existing definition (default: false)
|
|
26
|
+
# @return [Object] Response object
|
|
27
|
+
def create_workflow(body, overwrite: false)
|
|
28
|
+
@api_client.call_api(
|
|
29
|
+
'/metadata/workflow',
|
|
30
|
+
'POST',
|
|
31
|
+
query_params: { overwrite: overwrite },
|
|
32
|
+
body: body,
|
|
33
|
+
return_type: 'Object',
|
|
34
|
+
return_http_data_only: true
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Update workflow definition(s)
|
|
39
|
+
# @param [Array<WorkflowDef>] body List of workflow definitions
|
|
40
|
+
# @param [Boolean] overwrite Overwrite existing definitions (default: true)
|
|
41
|
+
# @return [Object] Response object
|
|
42
|
+
def update_workflows(body, overwrite: true)
|
|
43
|
+
@api_client.call_api(
|
|
44
|
+
'/metadata/workflow',
|
|
45
|
+
'PUT',
|
|
46
|
+
query_params: { overwrite: overwrite },
|
|
47
|
+
body: body,
|
|
48
|
+
return_type: 'Object',
|
|
49
|
+
return_http_data_only: true
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Get a workflow definition by name
|
|
54
|
+
# @param [String] name Workflow name
|
|
55
|
+
# @param [Integer] version Workflow version (optional, returns latest if not specified)
|
|
56
|
+
# @return [WorkflowDef] Workflow definition
|
|
57
|
+
def get_workflow_def(name, version: nil)
|
|
58
|
+
query_params = {}
|
|
59
|
+
query_params[:version] = version if version
|
|
60
|
+
|
|
61
|
+
@api_client.call_api(
|
|
62
|
+
'/metadata/workflow/{name}',
|
|
63
|
+
'GET',
|
|
64
|
+
path_params: { name: name },
|
|
65
|
+
query_params: query_params,
|
|
66
|
+
return_type: 'WorkflowDef',
|
|
67
|
+
return_http_data_only: true
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Get all workflow definitions
|
|
72
|
+
# @param [String] access Access level filter (optional)
|
|
73
|
+
# @return [Array<WorkflowDef>] List of workflow definitions
|
|
74
|
+
def get_all_workflows(access: nil)
|
|
75
|
+
query_params = {}
|
|
76
|
+
query_params[:access] = access if access
|
|
77
|
+
|
|
78
|
+
@api_client.call_api(
|
|
79
|
+
'/metadata/workflow',
|
|
80
|
+
'GET',
|
|
81
|
+
query_params: query_params,
|
|
82
|
+
return_type: 'Array<WorkflowDef>',
|
|
83
|
+
return_http_data_only: true
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Unregister (delete) a workflow definition
|
|
88
|
+
# @param [String] name Workflow name
|
|
89
|
+
# @param [Integer] version Workflow version
|
|
90
|
+
# @return [void]
|
|
91
|
+
def unregister_workflow_def(name, version:)
|
|
92
|
+
@api_client.call_api(
|
|
93
|
+
'/metadata/workflow/{name}/{version}',
|
|
94
|
+
'DELETE',
|
|
95
|
+
path_params: { name: name, version: version },
|
|
96
|
+
return_http_data_only: true
|
|
97
|
+
)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# ==========================================
|
|
101
|
+
# Task Definition Operations
|
|
102
|
+
# ==========================================
|
|
103
|
+
|
|
104
|
+
# Register (create) task definition(s)
|
|
105
|
+
# @param [Array<TaskDef>] body List of task definitions
|
|
106
|
+
# @return [Object] Response object
|
|
107
|
+
def register_task_def(body)
|
|
108
|
+
# Ensure body is an array
|
|
109
|
+
task_defs = body.is_a?(Array) ? body : [body]
|
|
110
|
+
|
|
111
|
+
@api_client.call_api(
|
|
112
|
+
'/metadata/taskdefs',
|
|
113
|
+
'POST',
|
|
114
|
+
body: task_defs,
|
|
115
|
+
return_type: 'Object',
|
|
116
|
+
return_http_data_only: true
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Update an existing task definition
|
|
121
|
+
# @param [TaskDef] body Task definition
|
|
122
|
+
# @return [Object] Response object
|
|
123
|
+
def update_task_def(body)
|
|
124
|
+
@api_client.call_api(
|
|
125
|
+
'/metadata/taskdefs',
|
|
126
|
+
'PUT',
|
|
127
|
+
body: body,
|
|
128
|
+
return_type: 'Object',
|
|
129
|
+
return_http_data_only: true
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Get a task definition by name
|
|
134
|
+
# @param [String] task_type Task type name
|
|
135
|
+
# @return [TaskDef] Task definition
|
|
136
|
+
def get_task_def(task_type)
|
|
137
|
+
@api_client.call_api(
|
|
138
|
+
'/metadata/taskdefs/{tasktype}',
|
|
139
|
+
'GET',
|
|
140
|
+
path_params: { tasktype: task_type },
|
|
141
|
+
return_type: 'TaskDef',
|
|
142
|
+
return_http_data_only: true
|
|
143
|
+
)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Get all task definitions
|
|
147
|
+
# @param [String] access Access level filter (optional)
|
|
148
|
+
# @return [Array<TaskDef>] List of task definitions
|
|
149
|
+
def get_all_task_defs(access: nil)
|
|
150
|
+
query_params = {}
|
|
151
|
+
query_params[:access] = access if access
|
|
152
|
+
|
|
153
|
+
@api_client.call_api(
|
|
154
|
+
'/metadata/taskdefs',
|
|
155
|
+
'GET',
|
|
156
|
+
query_params: query_params,
|
|
157
|
+
return_type: 'Array<TaskDef>',
|
|
158
|
+
return_http_data_only: true
|
|
159
|
+
)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Unregister (delete) a task definition
|
|
163
|
+
# @param [String] task_type Task type name
|
|
164
|
+
# @return [void]
|
|
165
|
+
def unregister_task_def(task_type)
|
|
166
|
+
@api_client.call_api(
|
|
167
|
+
'/metadata/taskdefs/{tasktype}',
|
|
168
|
+
'DELETE',
|
|
169
|
+
path_params: { tasktype: task_type },
|
|
170
|
+
return_http_data_only: true
|
|
171
|
+
)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# ==========================================
|
|
175
|
+
# Workflow Metadata (Tags) Operations
|
|
176
|
+
# ==========================================
|
|
177
|
+
|
|
178
|
+
# Store metadata (tags) associated with a workflow
|
|
179
|
+
# @param [String] name Workflow name
|
|
180
|
+
# @param [Object] body Workflow tag/metadata
|
|
181
|
+
# @param [Integer] version Workflow version (optional)
|
|
182
|
+
# @return [void]
|
|
183
|
+
def create_workflow_metadata(name, body, version: nil)
|
|
184
|
+
query_params = {}
|
|
185
|
+
query_params[:version] = version if version
|
|
186
|
+
|
|
187
|
+
@api_client.call_api(
|
|
188
|
+
'/metadata/tags/workflow/{name}',
|
|
189
|
+
'POST',
|
|
190
|
+
path_params: { name: name },
|
|
191
|
+
query_params: query_params,
|
|
192
|
+
body: body,
|
|
193
|
+
return_http_data_only: true
|
|
194
|
+
)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Get metadata (tags) associated with a workflow
|
|
198
|
+
# @param [String] name Workflow name
|
|
199
|
+
# @param [Integer] version Workflow version (optional)
|
|
200
|
+
# @return [Object] Workflow metadata/tags
|
|
201
|
+
def get_workflow_metadata(name, version: nil)
|
|
202
|
+
query_params = {}
|
|
203
|
+
query_params[:version] = version if version
|
|
204
|
+
|
|
205
|
+
@api_client.call_api(
|
|
206
|
+
'/metadata/tags/workflow/{name}',
|
|
207
|
+
'GET',
|
|
208
|
+
path_params: { name: name },
|
|
209
|
+
query_params: query_params,
|
|
210
|
+
return_type: 'Object',
|
|
211
|
+
return_http_data_only: true
|
|
212
|
+
)
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Delete metadata (tags) associated with a workflow
|
|
216
|
+
# @param [String] name Workflow name
|
|
217
|
+
# @param [Integer] version Workflow version
|
|
218
|
+
# @return [void]
|
|
219
|
+
def delete_workflow_metadata(name, version:)
|
|
220
|
+
@api_client.call_api(
|
|
221
|
+
'/metadata/tags/workflow/{name}',
|
|
222
|
+
'DELETE',
|
|
223
|
+
path_params: { name: name },
|
|
224
|
+
query_params: { version: version },
|
|
225
|
+
return_http_data_only: true
|
|
226
|
+
)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|