You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
643 B
23 lines
643 B
class Lxd::Server
|
|
include ActiveModel::Model
|
|
|
|
attr_accessor :api_extensions, :api_status, :api_version, :auth, :config,
|
|
:environment, :public
|
|
|
|
def self.by_host(host, certificate)
|
|
all = Array.new;
|
|
|
|
uri = URI.parse(host.uri + '/1.0')
|
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
http.use_ssl = true
|
|
http.cert = OpenSSL::X509::Certificate.new(certificate.cert)
|
|
http.key = OpenSSL::PKey::RSA.new(certificate.key)
|
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
|
|
request = Net::HTTP::Get.new(uri.request_uri)
|
|
response = http.request(request)
|
|
|
|
Lxd::Server.new(JSON.parse(response.body)['metadata'])
|
|
end
|
|
end
|
|
# vim: set ts=2 sw=2:
|