Class: Morpheus::LibraryOperatingSystemsInterface

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

Instance Method Summary collapse

Instance Method Details

#create(payload) ⇒ Object



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

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

#create_image(payload) ⇒ Object



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

def create_image(payload)
  url = "#{@base_url}/api/library/operating-systems/os-types/create-image"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

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



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

def destroy(id, payload={})
  url = "#{@base_url}/api/library/operating-systems/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :delete, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#destroy_image(id, payload = {}) ⇒ Object



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

def destroy_image(id, payload={})
  url = "#{@base_url}/api/library/operating-systems/os-types/images/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :delete, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

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



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

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

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



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

def get_image(id, params={})
  raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
  url = "#{@base_url}/api/library/operating-systems/os-types/images/#{id}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#list_os_types(params = {}) ⇒ Object



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

def list_os_types(params={})
  url = "#{@base_url}/api/library/operating-systems/os-types"
  params['pageConfig'] = { sort:'owner,name', order:'desc,asc' }
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#update(id, payload) ⇒ Object



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

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