lib/conjur/api/hosts.rb in conjur-api-2.0.0 vs lib/conjur/api/hosts.rb in conjur-api-2.0.1
- old
+ new
@@ -1,22 +1,9 @@
require 'conjur/host'
module Conjur
class API
- def create_host options
- log do |logger|
- logger << "Creating host"
- end
- resp = JSON.parse RestClient::Resource.new("#{Conjur::Core::API.host}/hosts", credentials).post(options)
- host(resp['id']).tap do |h|
- log do |logger|
- logger << "Created host #{h.id}"
- end
- h.attributes = resp
- end
- end
-
class << self
def enroll_host(url)
if Conjur.log
logger << "Enrolling host with URL #{url}"
end
@@ -28,10 +15,14 @@
body = response.body
[ mime_type, body ]
end
end
+ def create_host options
+ standard_create Conjur::Core::API.host, :host, nil, options
+ end
+
def host id
- Host.new("#{Conjur::Core::API.host}/hosts/#{path_escape id}", credentials)
+ standard_show Conjur::Core::API.host, :host, id
end
end
end