Class: RightScaleAPI::Account
- Defined in:
- lib/right-scale-api/account.rb
Defined Under Namespace
Classes: SubResource
Class Method Summary collapse
-
.sub_resources(*resources) ⇒ Object
Creates a method for each passed symbol that grabs the list of objects matching it takes options that are added as query params also does some munging of the opts in particular, :region => :us_east/:us_west/:eu/:ap will map to the proper cloud_id, so you don’t have to remember them.
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, #collection_uri, create, #delete, #destroy, get, #get, #head, #initialize, #path, #post, #put, #reload!, #send_request, #update, #uri
Constructor Details
This class inherits a constructor from RightScaleAPI::Base
Class Method Details
.sub_resources(*resources) ⇒ Object
Creates a method for each passed symbol that grabs the list of objects matching it takes options that are added as query params also does some munging of the opts in particular, :region => :us_east/:us_west/:eu/:ap will map to the proper cloud_id, so you don’t have to remember them
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/right-scale-api/account.rb', line 12 def self.sub_resources *resources resources.each do |resource| module_eval %( def #{resource} query_opts={} get('/#{resource}.xml', :query => #{resource.to_s.classify}.opts_to_query_opts(query_opts) )['#{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
41 42 43 |
# File 'lib/right-scale-api/account.rb', line 41 def create_deployment opts Deployment.create opts.merge :account => self end |
#create_ec2_ebs_volume(opts) ⇒ Object
Creates an EC2 EBS Volume
60 61 62 |
# File 'lib/right-scale-api/account.rb', line 60 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
49 50 51 |
# File 'lib/right-scale-api/account.rb', line 49 def create_ec2_elastic_ip opts Ec2ElasticIp.create opts.merge :account => self end |
#create_server(opts) ⇒ Object
Creates an EC2 Instance
69 70 71 |
# File 'lib/right-scale-api/account.rb', line 69 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
78 79 80 |
# File 'lib/right-scale-api/account.rb', line 78 def get_ec2_ssh_key id Ec2SshKey.new get("/ec2_ssh_keys/#{id}").merge :id => id, :account => self end |