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



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

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

#destroyObject



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

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

#saveObject



22
23
24
# File 'lib/fog/softlayer/models/compute/key_pair.rb', line 22

def save
  identity ? update : create
end

#updateObject



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

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