Class: Morpheus::ExecuteSchedulesInterface

Inherits:
APIClient
  • Object
show all
Defined in:
lib/morpheus/api/execute_schedules_interface.rb

Instance Method Summary collapse

Instance Method Details

#add_instances(id, payload) ⇒ Object



43
44
45
46
47
48
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 43

def add_instances(id, payload)
  url = "#{@base_url}/api/execute-schedules/#{id}/add-instances"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json}
  execute(opts)
end

#add_servers(id, payload) ⇒ Object



57
58
59
60
61
62
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 57

def add_servers(id, payload)
  url = "#{@base_url}/api/execute-schedules/#{id}/add-servers"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json}
  execute(opts)
end

#create(options) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 20

def create(options)
  url = "#{@base_url}/api/execute-schedules"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  payload = options
  opts = {method: :post, url: url, timeout: 10, headers: headers, payload: payload.to_json}
  execute(opts)
end

#destroy(id) ⇒ Object



36
37
38
39
40
41
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 36

def destroy(id)
  url = "#{@base_url}/api/execute-schedules/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :delete, url: url, timeout: 10, headers: headers}
  execute(opts)
end

#get(id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 5

def get(id)
  raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
  url = "#{@base_url}/api/execute-schedules/#{id}"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, timeout: 10, headers: headers}
  execute(opts)
end

#list(params = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 13

def list(params={})
  url = "#{@base_url}/api/execute-schedules"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, timeout: 10, headers: headers}
  execute(opts)
end

#remove_instances(id, payload) ⇒ Object



50
51
52
53
54
55
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 50

def remove_instances(id, payload)
  url = "#{@base_url}/api/execute-schedules/#{id}/remove-instances"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json}
  execute(opts)
end

#remove_servers(id, payload) ⇒ Object



64
65
66
67
68
69
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 64

def remove_servers(id, payload)
  url = "#{@base_url}/api/execute-schedules/#{id}/remove-servers"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json}
  execute(opts)
end

#update(id, options) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/morpheus/api/execute_schedules_interface.rb', line 28

def update(id, options)
  url = "#{@base_url}/api/execute-schedules/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  payload = options
  opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json}
  execute(opts)
end