certificate.rb 493 Bytes
class Lxd::Certificate
	include ActiveModel::Model

  attr_accessor :api, :type, :certificate, :fingerprint

	def self.all api
		api.certificates.map { |cert|
			Lxd::Certificate.new({api: api}.merge cert)
		}
	end

	def add password=nil, name='lex-deeit'
		data = Hash.new
		data[:type] = @type if @type else 'client'
		data[:name] = name
		data[:password] = password if password
		data[:certificate] = @certificate if @certificate

		@api.add_certificate data
	end
end
# vim: set ts=2 sw=2: