Module: Scooter::HttpDispatchers::Orchestrator::V1

Included in:
Scooter::HttpDispatchers::OrchestratorDispatcher
Defined in:
lib/scooter/httpdispatchers/orchestrator/v1/v1.rb

Overview

Methods here are generally representative of endpoints

Instance Method Summary collapse

Instance Method Details

#delete_scheduled_job(job_id) ⇒ Object



152
153
154
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 152

def delete_scheduled_job(job_id)
  @connection.delete("#{@version}/scheduled_jobs/#{job_id}")
end

#finish_plan(payload) ⇒ Object



128
129
130
131
132
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 128

def finish_plan(payload)
  @connection.post("#{@version}/command/plan_finish") do |req|
    req.body = payload
  end
end

#get_applications_in_environment(environment) ⇒ Object



48
49
50
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 48

def get_applications_in_environment(environment)
  @connection.get("#{@version}/environments/#{environment}/applications")
end

#get_environment(environment) ⇒ Object



44
45
46
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 44

def get_environment(environment)
  @connection.get("#{@version}/environments/#{environment}")
end

#get_environmentsObject

environments endpoints



40
41
42
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 40

def get_environments
  @connection.get("v1/environments")
end

#get_events(job_id) ⇒ Object



35
36
37
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 35

def get_events(job_id)
  @connection.get("#{@version}/jobs/#{job_id}/events")
end

#get_instances_in_environment(environment) ⇒ Object



52
53
54
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 52

def get_instances_in_environment(environment)
  @connection.get("#{@version}/environments/#{environment}/instances")
end

#get_inventory(node = nil) ⇒ Object

inventory endpoints



82
83
84
85
86
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 82

def get_inventory(node=nil)
  url = "#{@version}/inventory"
  url << "/#{node}" if node
  @connection.get(url)
end

#get_job(job_id) ⇒ Object



23
24
25
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 23

def get_job(job_id)
  @connection.get("#{@version}/jobs/#{job_id}")
end

#get_last_jobs(limit = nil, offset = nil, order_by = nil, order = nil) ⇒ Object

jobs endpoints



13
14
15
16
17
18
19
20
21
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 13

def get_last_jobs(limit=nil, offset=nil, order_by=nil, order=nil)
  path = "#{@version}/jobs"
  @connection.get(path) do |request|
    request.params['limit'] = limit if limit
    request.params['offset'] = offset if offset
    request.params['order_by'] = order_by if order_by
    request.params['order'] = order if order
  end
end

#get_nodes(job_id) ⇒ Object



27
28
29
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 27

def get_nodes(job_id)
  @connection.get("#{@version}/jobs/#{job_id}/nodes")
end

#get_plan_job(plan_job_id) ⇒ Object



140
141
142
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 140

def get_plan_job(plan_job_id)
  @connection.get("#{@version}/plan_jobs/#{plan_job_id}")
end

#get_report(job_id) ⇒ Object



31
32
33
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 31

def get_report(job_id)
  @connection.get("#{@version}/jobs/#{job_id}/report")
end

#get_scheduled_jobs(limit = nil, offset = nil) ⇒ Object



144
145
146
147
148
149
150
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 144

def get_scheduled_jobs(limit=nil, offset=nil)
  path = "#{@version}/scheduled_jobs"
  @connection.get(path) do |request|
    request.params['limit'] = limit if limit
    request.params['offset'] = offset if offset
  end
end

#get_statusObject

status endpoint



95
96
97
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 95

def get_status
  @connection.get("#{@version}/status")
end

#get_task(mod, task) ⇒ Object

task endpoints



100
101
102
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 100

def get_task(mod, task)
  @connection.get("#{@version}/tasks/#{mod}/#{task}")
end

#get_tasksObject



104
105
106
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 104

def get_tasks
  @connection.get("#{@version}/tasks")
end

#initialize(host) ⇒ Object



7
8
9
10
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 7

def initialize(host)
  super(host)
  @version = 'v1'
end

#plan_task(payload) ⇒ Object



134
135
136
137
138
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 134

def plan_task(payload)
  @connection.post("#{@version}/command/plan_task") do |req|
    req.body = payload
  end
end

#post_deploy(payload) ⇒ Object

command endpoints



57
58
59
60
61
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 57

def post_deploy(payload)
  @connection.post("#{@version}/command/deploy") do |req|
    req.body = payload
  end
end

#post_dumpling(payload) ⇒ Object

dumpling endpoints



115
116
117
118
119
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 115

def post_dumpling(payload)
  @connection.post("#{@version}/dumplings") do |req|
    req.body = payload
  end
end

#post_inventory(payload) ⇒ Object



88
89
90
91
92
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 88

def post_inventory(payload)
  @connection.post("#{@version}/inventory") do |req|
    req.body = payload
  end
end

#post_plan(payload) ⇒ Object



69
70
71
72
73
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 69

def post_plan(payload)
  @connection.post("#{@version}/command/plan") do |req|
    req.body = payload
  end
end

#post_schedule_task(payload) ⇒ Object



75
76
77
78
79
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 75

def post_schedule_task(payload)
  @connection.post("#{@version}/command/schedule_task") do |req|
    req.body = payload
  end
end

#post_stop(payload) ⇒ Object



63
64
65
66
67
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 63

def post_stop(payload)
  @connection.post("#{@version}/command/stop") do |req|
    req.body = payload
  end
end

#post_task(payload) ⇒ Object



108
109
110
111
112
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 108

def post_task(payload)
  @connection.post("#{@version}/command/task") do |req|
    req.body = payload
  end
end

#start_plan(payload) ⇒ Object

task plan endpoints



122
123
124
125
126
# File 'lib/scooter/httpdispatchers/orchestrator/v1/v1.rb', line 122

def start_plan(payload)
  @connection.post("#{@version}/command/plan_start") do |req|
    req.body = payload
  end
end