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.
50 lines
1.4 KiB
50 lines
1.4 KiB
class Lxd::Connection
|
|
attr_reader :con, :host, :port
|
|
|
|
"""
|
|
/1.0
|
|
/1.0/certificates
|
|
/1.0/certificates/<fingerprint>
|
|
/1.0/containers
|
|
/1.0/containers/<name>
|
|
/1.0/containers/<name>/exec
|
|
/1.0/containers/<name>/files
|
|
/1.0/containers/<name>/snapshots
|
|
/1.0/containers/<name>/snapshots/<name>
|
|
/1.0/containers/<name>/state
|
|
/1.0/containers/<name>/logs
|
|
/1.0/containers/<name>/logs/<logfile>
|
|
/1.0/events
|
|
/1.0/images
|
|
/1.0/images/<fingerprint>
|
|
/1.0/images/<fingerprint>/export
|
|
/1.0/images/aliases
|
|
/1.0/images/aliases/<name>
|
|
/1.0/networks
|
|
/1.0/networks/<name>
|
|
/1.0/operations
|
|
/1.0/operations/<uuid>
|
|
/1.0/operations/<uuid>/wait
|
|
/1.0/operations/<uuid>/websocket
|
|
/1.0/profiles
|
|
/1.0/profiles/<name>
|
|
"""
|
|
|
|
def initialize host, certificate
|
|
uri = URI.parse host.uri
|
|
@host = uri.host
|
|
@port = uri.port
|
|
@con = Net::HTTP.new @host, @port
|
|
@con.use_ssl = true
|
|
@con.cert = OpenSSL::X509::Certificate.new certificate.cert
|
|
@con.key = OpenSSL::PKey::EC.new certificate.key
|
|
@con.verify_mode = OpenSSL::SSL:VERIFY_NONE
|
|
end
|
|
|
|
def call
|
|
if not @api_version
|
|
@con.request(Net::HTTP::Get.new '/')
|
|
versions
|
|
end
|
|
end
|
|
# vim: set et ts=2 sw=2:
|