Module: Deltacloud::Client::Methods::Key

Included in:
Connection
Defined in:
lib/deltacloud/client/methods/key.rb

Instance Method Summary collapse

Instance Method Details

#create_key(key_name, create_opts = {}) ⇒ Object

Create a new credentials to use with authentication to an Instance

  • key_name -> The name of the key

  • create_opts : public_key -> Your SSH public key (eg. ~/.ssh/id_rsa.pub)



46
47
48
# File 'lib/deltacloud/client/methods/key.rb', line 46

def create_key(key_name, create_opts={})
  create_resource :key, create_opts.merge(:name => key_name)
end

#destroy_key(key_id) ⇒ Object

Destroy the SSH key



52
53
54
# File 'lib/deltacloud/client/methods/key.rb', line 52

def destroy_key(key_id)
  destroy_resource :key, key_id
end

#key(key_id) ⇒ Object

Retrieve the single key entity

  • key_id -> Key entity to retrieve



34
35
36
37
# File 'lib/deltacloud/client/methods/key.rb', line 34

def key(key_id)
  from_resource :key,
    connection.get(api_uri("keys/#{key_id}"))
end

#keys(filter_opts = {}) ⇒ Object

Retrieve list of all key entities

  • filter_opts:

    • :id -> Filter entities using ‘id’ attribute



25
26
27
28
# File 'lib/deltacloud/client/methods/key.rb', line 25

def keys(filter_opts={})
  from_collection :keys,
    connection.get(api_uri('keys'), filter_opts)
end