Class: AWS::EC2::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/help/state_transition_helper.rb,
lib/audit/lib/ec2_utils.rb,
lib/help/ec2_helper.rb,
lib/help/ec2_helper.rb

Overview

Implements some helper methods around the EC2 API and methods that are not yet implemented in the amazon-ec2 gem

Constant Summary collapse

API_VERSION_HACKED =
'2011-11-01'

Instance Method Summary collapse

Instance Method Details

#api_versionObject



22
23
24
# File 'lib/help/ec2_helper.rb', line 22

def api_version
  API_VERSION_HACKED
end

#describe_instance_attribute(options) ⇒ Object



7
8
9
10
11
12
# File 'lib/help/ec2_helper.rb', line 7

def describe_instance_attribute(options)
  params = {}
  params["InstanceId"] = options[:instance_id].to_s
  params["Attribute"] = "rootDeviceName" unless options[:attributes][:rootDeviceName] == nil
  return response_generator(:action => "DescribeInstanceAttribute", :params => params)
end

#describe_internetgateways(options = {}) ⇒ Object



32
33
34
35
36
# File 'lib/help/ec2_helper.rb', line 32

def describe_internetgateways( options = {} )
  options = { :interetgateway_id => [] }.merge(options)
  params = pathlist("internetGatewayId", options[:interetgateway_id])
  return response_generator(:action => "DescribeInternetGateways", :params => params)
end

#describe_vpcs(options = {}) ⇒ Object



26
27
28
29
30
# File 'lib/help/ec2_helper.rb', line 26

def describe_vpcs( options = {} )
  options = { :vpc_id => [] }.merge(options)
  params = pathlist("VpcId", options[:vpc_id])
  return response_generator(:action => "DescribeVpcs", :params => params)
end

#get_console_output(options = {}) ⇒ Object

The GetConsoleOutput operation retrieves console output that has been posted for the specified instance.

Instance console output is buffered and posted shortly after instance boot, reboot and once the instance is terminated. Only the most recent 64 KB of posted output is available. Console output is available for at least 1 hour after the most recent post.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :instance_id (String) — default: ""

    an Instance ID

Raises:

  • (ArgumentError)


234
235
236
237
238
239
# File 'lib/audit/lib/ec2_utils.rb', line 234

def get_console_output( options = {} )
  options = {:instance_id => ""}.merge(options)
  raise ArgumentError, "No instance ID provided" if options[:instance_id].nil? || options[:instance_id].empty?
  params = { "InstanceId" => options[:instance_id] }
  return response_generator(:action => "GetConsoleOutput", :params => params)
end

#register_image_updated(options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/help/state_transition_helper.rb', line 16

def register_image_updated(options)
  puts "register_image_updated: #{options.inspect}"
  params = {}
  params["Name"] = options[:name].to_s
  params["BlockDeviceMapping.1.Ebs.SnapshotId"] = options[:snapshot_id].to_s
  params["BlockDeviceMapping.1.DeviceName"] = options[:root_device_name].to_s
  params["Description"] = options[:description].to_s
  params["KernelId"] = options[:kernel_id].to_s unless options[:kernel_id] == nil
  params["RamdiskId"] = options[:ramdisk_id].to_s unless options[:ramdisk_id] == nil
  params["Architecture"] = options[:architecture].to_s
  params["RootDeviceName"] = options[:root_device_name].to_s
  return response_generator(:action => "RegisterImage", :params => params)
end