Class: Morpheus::KeyPairsInterface
Instance Method Summary
collapse
Methods inherited from APIClient
#accounts, #app_templates, #apps, #archive_buckets, #archive_files, #auth, #clouds, #containers, #custom_instance_types, #dashboard, #deploy, #deployments, #dry, #dry_run, #execute, #groups, #image_builder, #instance_types, #instances, #key_pairs, #license, #load_balancers, #logs, #monitoring, #option_type_lists, #option_types, #options, #provision_types, #roles, #security_group_rules, #security_groups, #servers, #set_ssl_verification_enabled, #setup, #ssl_verification_enabled?, #task_sets, #tasks, #users, #virtual_images, #whoami
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ KeyPairsInterface
Returns a new instance of KeyPairsInterface.
4
5
6
7
8
9
|
# File 'lib/morpheus/api/key_pairs_interface.rb', line 4
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
@access_token = access_token
@refresh_token = refresh_token
@base_url = base_url
@expires_at = expires_at
end
|
Instance Method Details
#create(account_id, options) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/morpheus/api/key_pairs_interface.rb', line 29
def create(account_id, options)
url = "#{@base_url}/api/key-pairs"
= { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
[:params]['accountId'] = account_id if account_id
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#destroy(account_id, id) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/morpheus/api/key_pairs_interface.rb', line 47
def destroy(account_id, id)
url = "#{@base_url}/api/key-pairs/#{id}"
= { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
[:params]['accountId'] = account_id if account_id
opts = {method: :delete, url: url, headers: }
execute(opts)
end
|
#get(account_id, id) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/morpheus/api/key_pairs_interface.rb', line 11
def get(account_id, id)
raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
url = "#{@base_url}/api/key-pairs/#{id}"
= { params: {}, authorization: "Bearer #{@access_token}" }
[:params]['accountId'] = account_id if account_id
opts = {method: :get, url: url, headers: }
execute(opts)
end
|
#list(account_id, options = {}) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/morpheus/api/key_pairs_interface.rb', line 20
def list(account_id, options={})
url = "#{@base_url}/api/key-pairs"
= { params: {}, authorization: "Bearer #{@access_token}" }
[:params].merge!(options)
[:params]['accountId'] = account_id if account_id
opts = {method: :get, url: url, headers: }
execute(opts)
end
|
#update(account_id, id, options) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/morpheus/api/key_pairs_interface.rb', line 38
def update(account_id, id, options)
url = "#{@base_url}/api/key-pairs/#{id}"
= { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
[:params]['accountId'] = account_id if account_id
payload = options
opts = {method: :put, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|