Class: Fog::Compute::DigitalOcean::SshKeys

Inherits:
PagingCollection show all
Defined in:
lib/fog/digitalocean/models/compute/ssh_keys.rb

Instance Method Summary collapse

Methods inherited from PagingCollection

#next_page, #previous_page

Instance Method Details

#all(filters = {}) ⇒ Fog::Compute::DigitalOceanV2::Sshkeys

Returns list of ssh keys

Returns:

  • (Fog::Compute::DigitalOceanV2::Sshkeys)

    Retrieves a list of ssh keys.

Raises:

  • (Fog::Compute::DigitalOceanV2::NotFound)
    • HTTP 404

  • (Fog::Compute::DigitalOceanV2::BadRequest)
    • HTTP 400

  • (Fog::Compute::DigitalOceanV2::InternalServerError)
    • HTTP 500

  • (Fog::Compute::DigitalOceanV2::ServiceError)

See Also:



16
17
18
19
20
21
22
# File 'lib/fog/digitalocean/models/compute/ssh_keys.rb', line 16

def all(filters = {})
  data = service.list_ssh_keys(filters)
  links = data.body["links"]
  get_paged_links(links)
  keys = data.body["ssh_keys"]
  load(keys)
end

#get(id) ⇒ Fog::Compute::DigitalOceanV2::Sshkeys

Returns ssh key

Returns:

  • (Fog::Compute::DigitalOceanV2::Sshkeys)

    Retrieves a list of ssh keys.

Raises:

  • (Fog::Compute::DigitalOceanV2::NotFound)
    • HTTP 404

  • (Fog::Compute::DigitalOceanV2::BadRequest)
    • HTTP 400

  • (Fog::Compute::DigitalOceanV2::InternalServerError)
    • HTTP 500

  • (Fog::Compute::DigitalOceanV2::ServiceError)

See Also:



31
32
33
34
35
36
# File 'lib/fog/digitalocean/models/compute/ssh_keys.rb', line 31

def get(id)
  key = service.get_ssh_key(id).body['ssh_key']
  new(key) if key
rescue Fog::Errors::NotFound
  nil
end