Class: RightScaleAPI::Account
- Defined in:
- lib/right-scale-api/account.rb
Defined Under Namespace
Classes: SubResource
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#create_deployment(opts) ⇒ Object
Creates a Deployment.
-
#create_ec2_ebs_volume(opts) ⇒ Object
Creates an EC2 EBS Volume.
-
#create_ec2_elastic_ip(opts) ⇒ Object
Creates an EC2 EBS Elastic IP.
-
#create_server(opts) ⇒ Object
Creates an EC2 Instance.
-
#get_ec2_ssh_key(id) ⇒ Object
Gets an EC2 ssh key.
Methods inherited from Base
api_name, attributes, create, #delete, #destroy, get, #get, #head, #initialize, #post, #put, #reload!, #send_request, #update, #uri
Constructor Details
This class inherits a constructor from RightScaleAPI::Base
Class Method Details
.sub_resources(*resources) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/right-scale-api/account.rb', line 6 def self.sub_resources *resources resources.each do |resource| module_eval %( def #{resource} get('/#{resource}.xml')['#{resource}'].map do |attrs| #{resource.to_s.classify}.new attrs.merge(:account => self) end end ),__FILE__, __LINE__-6 end end |
Instance Method Details
#create_deployment(opts) ⇒ Object
Creates a Deployment
34 35 36 |
# File 'lib/right-scale-api/account.rb', line 34 def create_deployment opts Deployment.create opts.merge :account => self end |
#create_ec2_ebs_volume(opts) ⇒ Object
Creates an EC2 EBS Volume
52 53 54 |
# File 'lib/right-scale-api/account.rb', line 52 def create_ec2_ebs_volume opts Ec2EbsVolume.create opts.merge :account => self end |
#create_ec2_elastic_ip(opts) ⇒ Object
Creates an EC2 EBS Elastic IP
42 43 44 |
# File 'lib/right-scale-api/account.rb', line 42 def create_ec2_elastic_ip opts Ec2ElasticIp.create opts.merge :account => self end |
#create_server(opts) ⇒ Object
Creates an EC2 Instance
60 61 62 |
# File 'lib/right-scale-api/account.rb', line 60 def create_server opts Server.create opts.merge :account => self end |
#get_ec2_ssh_key(id) ⇒ Object
Gets an EC2 ssh key. Currently you can’t get a list of ssh keys through the API, so you need to get the id through the web interface. my.rightscale.com/clouds/1/ec2_ssh_keys
68 69 70 |
# File 'lib/right-scale-api/account.rb', line 68 def get_ec2_ssh_key id Ec2SshKey.new get("/ec2_ssh_keys/#{id}").merge :id => id, :account => self end |