class Morpheus::KeyPairsInterface

Public Instance Methods

create(account_id, options) click to toggle source
# File lib/morpheus/api/key_pairs_interface.rb, line 23
def create(account_id, options)
  url = "#{@base_url}/api/key-pairs"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] = account_id if account_id
  payload = options
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end
destroy(account_id, id) click to toggle source
# File lib/morpheus/api/key_pairs_interface.rb, line 41
def destroy(account_id, id)
  url = "#{@base_url}/api/key-pairs/#{id}"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] = account_id if account_id
  opts = {method: :delete, url: url, headers: headers}
  execute(opts)
end
generate(account_id, options) click to toggle source
# File lib/morpheus/api/key_pairs_interface.rb, line 49
def generate(account_id, options)
  url = "#{@base_url}/api/key-pairs/generate"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] = account_id if account_id
  payload = options
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end
get(account_id, id) click to toggle source
# File lib/morpheus/api/key_pairs_interface.rb, line 5
def get(account_id, 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'] = account_id if account_id
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
list(account_id, options={}) click to toggle source
# File lib/morpheus/api/key_pairs_interface.rb, line 14
def list(account_id, options={})
  url = "#{@base_url}/api/key-pairs"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  headers[:params].merge!(options)
  headers[:params]['accountId'] = account_id if account_id
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
update(account_id, id, options) click to toggle source
# File lib/morpheus/api/key_pairs_interface.rb, line 32
def update(account_id, id, options)
  url = "#{@base_url}/api/key-pairs/#{id}"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params]['accountId'] = account_id if account_id
  payload = options
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end