@private
@private
# File lib/aws/ec2/resource.rb, line 148 def describe_call_attribute(name, opts = {}, &blk) attribute(name, opts, &blk) end
# File lib/aws/ec2/resource.rb, line 27 def __resource_id__ send(resource_id_method) end
# File lib/aws/ec2/resource.rb, line 76 def describe_attribute_call(attribute) name = describe_attribute_call_name attr_opt_name = Core::Inflection.class_name(attribute.get_as.to_s) attr_opt_name = attr_opt_name[0,1].downcase + attr_opt_name[1..-1] client.send(name, Hash[[[response_id_method.to_sym, __resource_id__], [:attribute, attr_opt_name]]]) end
# File lib/aws/ec2/resource.rb, line 70 def describe_call options = { :"#{response_id_method}s" => [__resource_id__] } client.send(describe_call_name, options) end
required for tagged item, which most ec2 resources are
# File lib/aws/ec2/resource.rb, line 98 def find_in_response response self.class.attribute_providers.each do |provider| if provider.request_types.include?(response.request_type) return send(provider.finder_method, response) end end end
# File lib/aws/ec2/resource.rb, line 55 def get_resource attribute describe_call end
# File lib/aws/ec2/resource.rb, line 38 def resource_id_method @resource_id_method ||= case when respond_to?(:id) && method(:id).owner != Kernel # id isn't defined on Object in some Ruby versions, in # others it is an alias for object_id; if the method is # not owned by Kernel we can assume that it has been # overridden in a subclass :id when respond_to?(:name) :name else raise NotImplementedError end end
@private
# File lib/aws/ec2/resource.rb, line 22 def resource_identifiers [[resource_id_method, send(resource_id_method)]] end
# File lib/aws/ec2/resource.rb, line 32 def response_id_method # e.g. instance_id inflected_name + "_" + resource_id_method.to_s end
# File lib/aws/ec2/resource.rb, line 60 def retrieve_attribute attribute_or_attribute_name, &block if attribute_or_attribute_name.is_a?(Symbol) attribute = self.class.attributes[attribute_or_attribute_name] else attribute = attribute_or_attribute_name end super(attribute, &block) end
# File lib/aws/ec2/resource.rb, line 88 def update_resource attribute, value options = {} options[attribute.set_as] = { :value => value } options[:"#{inflected_name}_id"] = __resource_id__ method_name = "modify_#{inflected_name}_attribute" client.send(method_name, options) end