Class: Fog::Compute::Gridscale::Sshkey

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/gridscale/models/sshkey.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



34
35
36
37
38
# File 'lib/fog/compute/gridscale/models/sshkey.rb', line 34

def delete
  requires :object_uuid
  response = service.sshkey_delete object_uuid
  response.body
end

#destroyObject



40
41
42
43
44
# File 'lib/fog/compute/gridscale/models/sshkey.rb', line 40

def destroy
  requires :object_uuid
  response = service.sshkey_delete(object_uuid)
  response
end

#saveObject

Raises:

  • (Fog::Errors::Error)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/compute/gridscale/models/sshkey.rb', line 18

def save
  raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
  requires :name, :sshkey

  options = {}

  if attributes[:labels]
    options[:labels] = labels
  end

  data = service.sshkey_create(name, sshkey, options)

  merge_attributes(data.body)
  true
end