Class: Fog::Compute::RackspaceV2::KeyPair

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

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Attribute Details

#fingerprintString (readonly)

Returns unique fingerprint.

Returns:

  • (String)

    unique fingerprint



26
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 26

attribute :fingerprint

#nameString

Returns the keypair name.

Returns:

  • (String)

    the keypair name



10
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 10

identity  :name

#private_keyString (readonly)

Returns the private key.

Returns:

  • (String)

    the private key



18
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 18

attribute :private_key

#public_keyString (readonly)

Returns the public key.

Returns:



14
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 14

attribute :public_key

#user_idString (readonly)

Returns the user_id associated to.

Returns:

  • (String)

    the user_id associated to



22
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 22

attribute :user_id

Instance Method Details

#destroyBoolean

Destroys a keypair



47
48
49
50
51
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 47

def destroy
    requires :identity
    service.delete_keypair(identity)
    true
end

#saveBoolean

Creates a keypair



34
35
36
37
38
39
# File 'lib/fog/rackspace/models/compute_v2/key_pair.rb', line 34

def save
  requires :name
  data = service.create_keypair(name, public_key)
  merge_attributes(data.body['keypair'])
  data.body['keypair']['name'] == name
end