Class: Scooter::HttpDispatchers::OrchestratorDispatcher

Inherits:
HttpDispatcher
  • Object
show all
Includes:
Scooter::HttpDispatchers::Orchestrator::V1
Defined in:
lib/scooter/httpdispatchers/orchestratordispatcher.rb

Instance Attribute Summary

Attributes inherited from HttpDispatcher

#connection, #faraday_logger, #host, #send_auth_token_as_query_param, #token

Instance Method Summary collapse

Methods included from Scooter::HttpDispatchers::Orchestrator::V1

#delete_scheduled_job, #finish_plan, #get_applications_in_environment, #get_environment, #get_environments, #get_events, #get_instances_in_environment, #get_inventory, #get_job, #get_last_jobs, #get_nodes, #get_plan_job, #get_report, #get_scheduled_jobs, #get_status, #get_task, #get_tasks, #plan_task, #post_deploy, #post_dumpling, #post_inventory, #post_plan, #post_schedule_task, #post_stop, #post_task, #start_plan

Methods inherited from HttpDispatcher

#create_default_connection, #is_resolvable, #set_url_prefix

Constructor Details

#initialize(host) ⇒ OrchestratorDispatcher

Returns a new instance of OrchestratorDispatcher.



11
12
13
14
15
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 11

def initialize(host)
  super(host)
  @connection.url_prefix.path = '/orchestrator'
  @connection.url_prefix.port = 8143
end

Instance Method Details

#create_dumpling(dumpling) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



83
84
85
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 83

def create_dumpling(dumpling)
  post_dumpling(dumpling)
end

#create_scheduled_job(payload) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



88
89
90
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 88

def create_scheduled_job(payload)
  post_schedule_task(payload)
end

#deploy_environment(environment, opts = {}) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



58
59
60
61
62
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 58

def deploy_environment(environment, opts={})
  payload = opts
  payload['environment'] = environment
  post_deploy(payload)
end

#environment(environment) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



43
44
45
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 43

def environment(environment)
  get_environment(environment)
end

#get_job_events(job_id) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



38
39
40
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 38

def get_job_events(job_id)
  get_events(job_id)
end

#get_job_report(job_id) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



33
34
35
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 33

def get_job_report(job_id)
  get_report(job_id)
end

#list_app_instances(environment) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



53
54
55
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 53

def list_app_instances(environment)
  get_instances_in_environment(environment)
end

#list_applications(environment) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



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

def list_applications(environment)
  get_applications_in_environment(environment)
end

#list_job_details(job_id) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



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

def list_job_details(job_id)
  get_job(job_id)
end

#list_jobs(n_jobs = nil) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



18
19
20
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 18

def list_jobs(n_jobs=nil)
  get_last_jobs(n_jobs)
end

#list_nodes_associated_with_job(job_id) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



28
29
30
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 28

def list_nodes_associated_with_job(job_id)
  get_nodes(job_id)
end

#list_scheduled_jobs(limit = nil, offset = nil) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



98
99
100
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 98

def list_scheduled_jobs(limit=nil, offset=nil)
  get_scheduled_jobs(limit, offset)
end

#nodes_connected_to_broker(node_list) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



77
78
79
80
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 77

def nodes_connected_to_broker(node_list)
  payload = {'nodes' => node_list}
  post_inventory(payload)
end

#plan_job(environment, opts = {}) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



70
71
72
73
74
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 70

def plan_job(environment, opts={})
  payload = opts
  payload['environment'] = environment
  post_plan(payload)
end

#remove_scheduled_job(job_id) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



93
94
95
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 93

def remove_scheduled_job(job_id)
  delete_scheduled_job(job_id)
end

#stop_job(job_id) ⇒ Faraday::Response

Returns response object from Faraday http client.

Returns:

  • (Faraday::Response)

    response object from Faraday http client



65
66
67
# File 'lib/scooter/httpdispatchers/orchestratordispatcher.rb', line 65

def stop_job(job_id)
  post_stop({'job' => "/jobs/#{job_id}"})
end