Sha256: fdbde40e5945f0a8922a4f13be6fc287e211795a4bdc1c5a6a9dd112d0fe41d3

Contents?: true

Size: 787 Bytes

Versions: 23

Compression:

Stored size: 787 Bytes

Contents

module Yao::Resources
  class Keypair < Base
    friendly_attributes :name, :public_key, :fingerprint

    self.service        = "compute"
    self.resource_name  = "os-keypair"
    self.resources_name = "os-keypairs"

    # os-keypairs API returns very complicated JSON.
    # For example.
    # {
    #   "keypairs": [
    #     {
    #       "keypair": {
    #          "fingerprint": "...",
    #        }
    #     },
    #     {
    #       "keypair": {
    #          "fingerprint": "...",
    #        }
    #     },
    #   ]
    #
    # @param query [Hash]
    # @return [Array<Yao::Resources::Keypairs>]
    def self.list(query={})
      res = GET(resources_name, query)
      res.body['keypairs'].map { |attribute|
        new(attribute['keypair'])
      }
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
yao-0.9.1 lib/yao/resources/keypair.rb
yao-0.9.0 lib/yao/resources/keypair.rb
yao-0.8.0 lib/yao/resources/keypair.rb