Class: Conductor::Http::Api::MetadataResourceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/http/api/metadata_resource_api.rb

Overview

MetadataResourceApi - API for workflow and task metadata operations Manages task definitions and workflow definitions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = nil) ⇒ MetadataResourceApi

Initialize MetadataResourceApi

Parameters:

  • api_client (ApiClient) (defaults to: nil)

    Optional API client



15
16
17
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 15

def initialize(api_client = nil)
  @api_client = api_client || ApiClient.new
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



11
12
13
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 11

def api_client
  @api_client
end

Instance Method Details

#create_workflow(body, overwrite: false) ⇒ Object

Create a new workflow definition

Parameters:

  • body (WorkflowDef)

    Workflow definition

  • overwrite (Boolean) (defaults to: false)

    Overwrite existing definition (default: false)

Returns:

  • (Object)

    Response object



27
28
29
30
31
32
33
34
35
36
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 27

def create_workflow(body, overwrite: false)
  @api_client.call_api(
    '/metadata/workflow',
    'POST',
    query_params: { overwrite: overwrite },
    body: body,
    return_type: 'Object',
    return_http_data_only: true
  )
end

#create_workflow_metadata(name, body, version: nil) ⇒ void

This method returns an undefined value.

Store metadata (tags) associated with a workflow

Parameters:

  • name (String)

    Workflow name

  • body (Object)

    Workflow tag/metadata

  • version (Integer) (defaults to: nil)

    Workflow version (optional)



183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 183

def (name, body, version: nil)
  query_params = {}
  query_params[:version] = version if version

  @api_client.call_api(
    '/metadata/tags/workflow/{name}',
    'POST',
    path_params: { name: name },
    query_params: query_params,
    body: body,
    return_http_data_only: true
  )
end

#delete_workflow_metadata(name, version:) ⇒ void

This method returns an undefined value.

Delete metadata (tags) associated with a workflow

Parameters:

  • name (String)

    Workflow name

  • version (Integer)

    Workflow version



219
220
221
222
223
224
225
226
227
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 219

def (name, version:)
  @api_client.call_api(
    '/metadata/tags/workflow/{name}',
    'DELETE',
    path_params: { name: name },
    query_params: { version: version },
    return_http_data_only: true
  )
end

#get_all_task_defs(access: nil) ⇒ Array<TaskDef>

Get all task definitions

Parameters:

  • access (String) (defaults to: nil)

    Access level filter (optional)

Returns:

  • (Array<TaskDef>)

    List of task definitions



149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 149

def get_all_task_defs(access: nil)
  query_params = {}
  query_params[:access] = access if access

  @api_client.call_api(
    '/metadata/taskdefs',
    'GET',
    query_params: query_params,
    return_type: 'Array<TaskDef>',
    return_http_data_only: true
  )
end

#get_all_workflows(access: nil) ⇒ Array<WorkflowDef>

Get all workflow definitions

Parameters:

  • access (String) (defaults to: nil)

    Access level filter (optional)

Returns:

  • (Array<WorkflowDef>)

    List of workflow definitions



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 74

def get_all_workflows(access: nil)
  query_params = {}
  query_params[:access] = access if access

  @api_client.call_api(
    '/metadata/workflow',
    'GET',
    query_params: query_params,
    return_type: 'Array<WorkflowDef>',
    return_http_data_only: true
  )
end

#get_task_def(task_type) ⇒ TaskDef

Get a task definition by name

Parameters:

  • task_type (String)

    Task type name

Returns:

  • (TaskDef)

    Task definition



136
137
138
139
140
141
142
143
144
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 136

def get_task_def(task_type)
  @api_client.call_api(
    '/metadata/taskdefs/{tasktype}',
    'GET',
    path_params: { tasktype: task_type },
    return_type: 'TaskDef',
    return_http_data_only: true
  )
end

#get_workflow_def(name, version: nil) ⇒ WorkflowDef

Get a workflow definition by name

Parameters:

  • name (String)

    Workflow name

  • version (Integer) (defaults to: nil)

    Workflow version (optional, returns latest if not specified)

Returns:

  • (WorkflowDef)

    Workflow definition



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 57

def get_workflow_def(name, version: nil)
  query_params = {}
  query_params[:version] = version if version

  @api_client.call_api(
    '/metadata/workflow/{name}',
    'GET',
    path_params: { name: name },
    query_params: query_params,
    return_type: 'WorkflowDef',
    return_http_data_only: true
  )
end

#get_workflow_metadata(name, version: nil) ⇒ Object

Get metadata (tags) associated with a workflow

Parameters:

  • name (String)

    Workflow name

  • version (Integer) (defaults to: nil)

    Workflow version (optional)

Returns:

  • (Object)

    Workflow metadata/tags



201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 201

def (name, version: nil)
  query_params = {}
  query_params[:version] = version if version

  @api_client.call_api(
    '/metadata/tags/workflow/{name}',
    'GET',
    path_params: { name: name },
    query_params: query_params,
    return_type: 'Object',
    return_http_data_only: true
  )
end

#register_task_def(body) ⇒ Object

Register (create) task definition(s)

Parameters:

  • body (Array<TaskDef>)

    List of task definitions

Returns:

  • (Object)

    Response object



107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 107

def register_task_def(body)
  # Ensure body is an array
  task_defs = body.is_a?(Array) ? body : [body]

  @api_client.call_api(
    '/metadata/taskdefs',
    'POST',
    body: task_defs,
    return_type: 'Object',
    return_http_data_only: true
  )
end

#unregister_task_def(task_type) ⇒ void

This method returns an undefined value.

Unregister (delete) a task definition

Parameters:

  • task_type (String)

    Task type name



165
166
167
168
169
170
171
172
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 165

def unregister_task_def(task_type)
  @api_client.call_api(
    '/metadata/taskdefs/{tasktype}',
    'DELETE',
    path_params: { tasktype: task_type },
    return_http_data_only: true
  )
end

#unregister_workflow_def(name, version:) ⇒ void

This method returns an undefined value.

Unregister (delete) a workflow definition

Parameters:

  • name (String)

    Workflow name

  • version (Integer)

    Workflow version



91
92
93
94
95
96
97
98
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 91

def unregister_workflow_def(name, version:)
  @api_client.call_api(
    '/metadata/workflow/{name}/{version}',
    'DELETE',
    path_params: { name: name, version: version },
    return_http_data_only: true
  )
end

#update_task_def(body) ⇒ Object

Update an existing task definition

Parameters:

  • body (TaskDef)

    Task definition

Returns:

  • (Object)

    Response object



123
124
125
126
127
128
129
130
131
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 123

def update_task_def(body)
  @api_client.call_api(
    '/metadata/taskdefs',
    'PUT',
    body: body,
    return_type: 'Object',
    return_http_data_only: true
  )
end

#update_workflows(body, overwrite: true) ⇒ Object

Update workflow definition(s)

Parameters:

  • body (Array<WorkflowDef>)

    List of workflow definitions

  • overwrite (Boolean) (defaults to: true)

    Overwrite existing definitions (default: true)

Returns:

  • (Object)

    Response object



42
43
44
45
46
47
48
49
50
51
# File 'lib/conductor/http/api/metadata_resource_api.rb', line 42

def update_workflows(body, overwrite: true)
  @api_client.call_api(
    '/metadata/workflow',
    'PUT',
    query_params: { overwrite: overwrite },
    body: body,
    return_type: 'Object',
    return_http_data_only: true
  )
end