class EY::CloudClient::Keypair
Public Class Methods
all(api)
click to toggle source
# File lib/engineyard-cloud-client/models/keypair.rb, line 8 def self.all(api) self.from_array(api, api.get("/keypairs")["keypairs"]) end
create(api, attrs = {})
click to toggle source
Create a Keypair
with your SSH public key so that you can access your Instances via SSH If successful, returns new Keypair
and EY
Cloud will have registered your public key If unsuccessful, raises EY::CloudClient::RequestFailed
Usage Keypair.create
(api,
name: "laptop", public_key: "ssh-rsa OTHERKEYPAIR"
)
NOTE: Syntax above is for Ruby 1.9. In Ruby 1.8, keys must all be strings.
# File lib/engineyard-cloud-client/models/keypair.rb, line 24 def self.create(api, attrs = {}) params = attrs.dup # no default fields raise EY::CloudClient::AttributeRequiredError.new("name") unless params["name"] raise EY::CloudClient::AttributeRequiredError.new("public_key") unless params["public_key"] response = api.post("/keypairs", "keypair" => params)['keypair'] self.from_hash(api, response) end
Public Instance Methods
destroy()
click to toggle source
# File lib/engineyard-cloud-client/models/keypair.rb, line 32 def destroy api.delete("/keypairs/#{id}") end
sort_attributes()
click to toggle source
# File lib/engineyard-cloud-client/models/keypair.rb, line 36 def sort_attributes sort_string(name) end