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

Instance Method Summary collapse

Instance Attribute Details

#fingerprintString (readonly)

Returns unique fingerprint.

Returns:

  • (String)

    unique fingerprint



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

attribute :fingerprint

#nameString

Returns the keypair name.

Returns:

  • (String)

    the keypair name



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

identity  :name

#private_keyString (readonly)

Returns the private key.

Returns:

  • (String)

    the private key



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

attribute :private_key

#public_keyString (readonly)

Returns the public key.

Returns:



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

attribute :public_key

#user_idString (readonly)

Returns the user_id associated to.

Returns:

  • (String)

    the user_id associated to



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

attribute :user_id

Instance Method Details

#destroyBoolean

Destroys a keypair

Returns:

  • (Boolean)

    true if the keypair is successfully deleted

Raises:



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

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

#saveBoolean

Creates a keypair

Returns:

  • (Boolean)

    true if the keypair is successfully created

Raises:



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

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