Class: CloudAccount

Inherits:
Object
  • Object
show all
Extended by:
RightScale::Api::GatewayExtend
Includes:
RightScale::Api::Gateway
Defined in:
lib/rest_connection/rightscale/cloud_account.rb

Overview

API 1.5

Instance Attribute Summary

Attributes included from RightScale::Api::Base

#params

Instance Method Summary collapse

Methods included from RightScale::Api::GatewayExtend

filters, find, find_all, find_by, find_with_filter, load, load_all, parse_args, resource_post_name

Methods included from RightScale::Api::GatewayConnection

#connection

Methods included from RightScale::Api::BaseExtend

#[], #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::Gateway

#[], #[]=, #actions, #hash_of_links, #href, #initialize, #load, #method_missing, #nickname, #parse_params, #rediscover, #save

Methods included from RightScale::Api::Base

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

Dynamic Method Handling

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

Instance Method Details

#cloud_idObject



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

def cloud_id
  self.cloud.split("/").last
end

#create(opts) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/rest_connection/rightscale/cloud_account.rb', line 37

def create(opts)
  location = connection.post(self.resource_plural_name, self.resource_singular_name.to_sym => opts)
  if location =~ /aws/
    return "AWS Cloud Added successfully"
  else
    newrecord = self.new('links' => [ {'rel' => 'self', 'href' => location } ])
    newrecord.reload
    return newrecord
  end
end