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.
27 lines
621 B
27 lines
621 B
class Lxd::Certificate
|
|
include ActiveModel::Model
|
|
|
|
attr_accessor :api, :uri, :type, :certificate, :fingerprint
|
|
|
|
def self.all api
|
|
return [] unless 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] = if @type then @type else 'client' end
|
|
data[:name] = name
|
|
data[:password] = password if password
|
|
data[:certificate] = @certificate if @certificate
|
|
|
|
@api.add_certificate data
|
|
end
|
|
|
|
def delete
|
|
@api.delete_certificate @fingerprint
|
|
end
|
|
end
|
|
# vim: set et ts=2 sw=2:
|