Class: MultiCloudImage

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

Overview

API 1.0

Instance Attribute Summary collapse

Attributes included from RightScale::Api::Base

#params

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) ⇒ MultiCloudImage

Returns a new instance of MultiCloudImage.



55
56
57
58
59
60
# File 'lib/rest_connection/rightscale/multi_cloud_image.rb', line 55

def initialize(*args, &block)
  super(*args, &block)
  if RightScale::Api::api0_1?
    @internal = MultiCloudImageInternal.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/multi_cloud_image.rb', line 33

def internal
  @internal
end

Instance Method Details

#find_and_flatten_settingsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rest_connection/rightscale/multi_cloud_image.rb', line 39

def find_and_flatten_settings
  if connection.settings[:legacy_shard]
    internal = MultiCloudImageInternal.new("href" => self.href)
    internal.reload
    total_image_count = internal.multi_cloud_image_cloud_settings.size
    # The .settings call filters out non-ec2 images
    more_settings = []
    if total_image_count > internal.settings.size
      more_settings = McMultiCloudImage.find(rs_id.to_i).settings
    end
    @params["multi_cloud_image_cloud_settings"] = internal.settings + more_settings
  else
    @params["multi_cloud_image_cloud_settings"] = McMultiCloudImage.find(rs_id.to_i).settings
  end
end

#supported_cloud_idsObject



35
36
37
# File 'lib/rest_connection/rightscale/multi_cloud_image.rb', line 35

def supported_cloud_ids
  @params["multi_cloud_image_cloud_settings"].map { |mcics| mcics.cloud_id }
end