Class: Conductor::Metadata

Inherits:
Model
  • Object
show all
Defined in:
lib/nf-conductor/http/metadata.rb

Instance Attribute Summary

Attributes inherited from Model

#response, #status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

build

Constructor Details

#initialize(response) ⇒ Metadata

Returns a new instance of Metadata.



3
4
5
# File 'lib/nf-conductor/http/metadata.rb', line 3

def initialize(response)
  super(response)
end

Class Method Details

.create_or_update_workflows(workflow_list) ⇒ Object

PUT /metadata/workflow Create or update workflow definition



79
80
81
82
83
84
85
# File 'lib/nf-conductor/http/metadata.rb', line 79

def create_or_update_workflows(workflow_list)
  response = Connection.new.put(
    "/metadata/taskdefs",
    { body: (workflow_list.is_a?(Array) ? workflow_list : [workflow_list]).to_json }
  )
  Metadata.build(response)
end

.create_tasks(task_list) ⇒ Object

POST /metadata/taskdefs Create new task definition(s) 204 success



25
26
27
28
29
30
31
# File 'lib/nf-conductor/http/metadata.rb', line 25

def create_tasks(task_list)
  response = Connection.new.post(
    "/metadata/taskdefs",
    { body: (task_list.is_a?(Array) ? task_list : [task_list]).to_json }
  )
  Metadata.build(response)
end

.create_workflow(workflow) ⇒ Object

POST /metadata/workflow Create a new workflow definition



69
70
71
72
73
74
75
# File 'lib/nf-conductor/http/metadata.rb', line 69

def create_workflow(workflow)
  response = Connection.new.post(
    "/metadata/workflow",
    { body: workflow.to_json }
  )
  Metadata.build(response)
end

.delete_task(task_type) ⇒ Object

DELETE /metadata/taskdefs/taskType Remove a task definition



45
46
47
48
# File 'lib/nf-conductor/http/metadata.rb', line 45

def delete_task(task_type)
  response = Connection.new.delete("/metadata/taskdefs/#{task_type}")
  Metadata.build(response)
end

.get_all_tasksObject

GET /metadata/taskdefs Gets all task definition



10
11
12
13
# File 'lib/nf-conductor/http/metadata.rb', line 10

def get_all_tasks
  response = Connection.new.get("/metadata/taskdefs")
  Metadata.build(response)
end

.get_all_workflowsObject

GET /metadata/workflow Retrieves all workflow definition along with blueprint



52
53
54
55
# File 'lib/nf-conductor/http/metadata.rb', line 52

def get_all_workflows
  response = Connection.new.get("/metadata/workflow")
  Metadata.build(response)
end

.get_task(task_type) ⇒ Object

GET /metadata/taskdefs/taskType Gets the task definition



17
18
19
20
# File 'lib/nf-conductor/http/metadata.rb', line 17

def get_task(task_type)
  response = Connection.new.get("/metadata/taskdefs/#{task_type}")
  Metadata.build(response)
end

.get_workflow(workflow_name, version: nil) ⇒ Object

GET /metadata/workflow/name?version= Retrieves workflow definition along with blueprint



59
60
61
62
63
64
65
# File 'lib/nf-conductor/http/metadata.rb', line 59

def get_workflow(workflow_name, version: nil)
  query_string = "/metadata/workflow/#{workflow_name}?"
  query_string += "version=#{version}" if version

  response = Connection.new.get(query_string)
  Metadata.build(response)
end

.update_task(task_definition) ⇒ Object

PUT /metadata/taskdefs Update an existing task



35
36
37
38
39
40
41
# File 'lib/nf-conductor/http/metadata.rb', line 35

def update_task(task_definition)
  response = Connection.new.put(
    "/metadata/taskdefs",
    { body: task_definition.to_json }
  )
  Metadata.build(response)
end