Class: Fog::Compute::Softlayer::KeyPair

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

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
# File 'lib/fog/softlayer/models/compute/key_pair.rb', line 24

def create
  requires :key, :label
  response = service.create_key_pair(attributes).body
  merge_attributes(response)
  self
end

#destroyObject



37
38
39
40
41
# File 'lib/fog/softlayer/models/compute/key_pair.rb', line 37

def destroy
  requires :id
  service.delete_key_pair(self.id)
  true
end

#saveObject



20
21
22
# File 'lib/fog/softlayer/models/compute/key_pair.rb', line 20

def save
  identity ? update : create
end

#updateObject



31
32
33
34
35
# File 'lib/fog/softlayer/models/compute/key_pair.rb', line 31

def update
  requires :id
  merge_attributes(service.update_key_pair(self.id, self.attributes).body)
  self
end