Class: Morpheus::ImageBuilderImageBuildsInterface

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

Overview

this may change to just /api/image-builds

Instance Method Summary collapse

Instance Method Details

#base_pathObject



5
6
7
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 5

def base_path
  "#{@base_url}/api/image-builds"
end

#create(payload) ⇒ Object



24
25
26
27
28
29
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 24

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

#create_options(params = {}) ⇒ Object



66
67
68
69
70
71
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 66

def create_options(params={})
  url = "#{base_path}/create-options"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#destroy(id, params = {}) ⇒ Object



45
46
47
48
49
50
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 45

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

#get(id, params = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 9

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

#list(params = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 17

def list(params={})
  url = "#{base_path}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#list_executions(id, params = {}) ⇒ Object



59
60
61
62
63
64
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 59

def list_executions(id, params={})
  url = "#{base_path}/#{id}/list-executions"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#run(id, params = {}) ⇒ Object



52
53
54
55
56
57
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 52

def run(id, params={})
  url = "#{base_path}/#{id}/run"
  headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers}
  execute(opts)
end

#update(id, payload) ⇒ Object

def validate_save(payload) url = "##base_path/validate-save" headers = { :authorization => "Bearer #@access_token", 'Content-Type' => 'application/json' } opts = :post, url: url, headers: headers, payload: payload.to_json execute(opts) end



38
39
40
41
42
43
# File 'lib/morpheus/api/image_builder_image_builds_interface.rb', line 38

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