Class: Morpheus::KeyPairsInterface

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

Instance Method Summary collapse

Instance Method Details

#create(account_id, options) ⇒ Object



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

def create(, options)
  url = "#{@base_url}/api/key-pairs"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] =  if 
  payload = options
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#destroy(account_id, id) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/morpheus/api/key_pairs_interface.rb', line 41

def destroy(, id)
  url = "#{@base_url}/api/key-pairs/#{id}"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] =  if 
  opts = {method: :delete, url: url, headers: headers}
  execute(opts)
end

#generate(account_id, options) ⇒ Object



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

def generate(, options)
  url = "#{@base_url}/api/key-pairs/generate"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] =  if 
  payload = options
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#get(account_id, id) ⇒ Object



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

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

#list(account_id, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/morpheus/api/key_pairs_interface.rb', line 14

def list(, options={})
  url = "#{@base_url}/api/key-pairs"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  headers[:params].merge!(options)
  headers[:params]['accountId'] =  if 
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#update(account_id, id, options) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/morpheus/api/key_pairs_interface.rb', line 32

def update(, id, options)
  url = "#{@base_url}/api/key-pairs/#{id}"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] =  if 
  payload = options
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end