Class: Ec2SshKey

Inherits:
Object
  • Object
show all
Extended by:
RightScale::Api::BaseExtend
Includes:
RightScale::Api::Base
Defined in:
lib/rest_connection/rightscale/ec2_ssh_key.rb

Overview

API 1.0

Instance Attribute Summary collapse

Attributes included from RightScale::Api::Base

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RightScale::Api::BaseExtend

[], create, deny_methods, filters, find, find_all, find_by, find_by_cloud_id, find_by_id, find_by_nickname, find_by_nickname_speed, find_with_filter, resource_plural_name, resource_singular_name

Methods included from RightScale::Api::BaseConnection

#connection

Methods included from RightScale::Api::Base

#[], #[]=, #destroy, #method_missing, #reload, #resource_plural_name, #resource_singular_name, #rs_id, #save

Constructor Details

#initialize(*args, &block) ⇒ Ec2SshKey

Returns a new instance of Ec2SshKey.



44
45
46
47
48
49
# File 'lib/rest_connection/rightscale/ec2_ssh_key.rb', line 44

def initialize(*args, &block)
  super(*args, &block)
  if RightScale::Api::api0_1?
    @internal = Ec2SshKeyInternal.new(*args, &block)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightScale::Api::Base

Instance Attribute Details

#internalObject

Returns the value of attribute internal.



33
34
35
# File 'lib/rest_connection/rightscale/ec2_ssh_key.rb', line 33

def internal
  @internal
end

Class Method Details

.create(opts) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/rest_connection/rightscale/ec2_ssh_key.rb', line 35

def self.create(opts)
  create_opts = { self.resource_singular_name.to_sym => opts }
  create_opts['cloud_id'] = opts['cloud_id'] if opts['cloud_id']
  location = connection.post(self.resource_plural_name, create_opts)
  newrecord = self.new('href' => location)
  newrecord.reload
  newrecord
end