Class: Awsum::Ec2::Image

Inherits:
Object show all
Defined in:
lib/ec2/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ec2, id, location, state, owner, public, architecture, type, kernel_id, ram_disk_id, platform, product_codes) ⇒ Image

:nodoc:



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ec2/image.rb', line 6

def initialize(ec2, id, location, state, owner, public, architecture, type, kernel_id, ram_disk_id, platform, product_codes) #:nodoc:
  @ec2 = ec2
  @id = id 
  @location = location 
  @state = state 
  @owner = owner 
  @public = public 
  @architecture = architecture 
  @type = type 
  @kernel_id = kernel_id 
  @ramdisk_id = ram_disk_id
  @platform = platform
  @product_codes = product_codes
end

Instance Attribute Details

#architectureObject (readonly)

Returns the value of attribute architecture.



4
5
6
# File 'lib/ec2/image.rb', line 4

def architecture
  @architecture
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/ec2/image.rb', line 4

def id
  @id
end

#kernel_idObject (readonly)

Returns the value of attribute kernel_id.



4
5
6
# File 'lib/ec2/image.rb', line 4

def kernel_id
  @kernel_id
end

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/ec2/image.rb', line 4

def location
  @location
end

#ownerObject (readonly)

Returns the value of attribute owner.



4
5
6
# File 'lib/ec2/image.rb', line 4

def owner
  @owner
end

#platformObject (readonly)

Returns the value of attribute platform.



4
5
6
# File 'lib/ec2/image.rb', line 4

def platform
  @platform
end

#product_codesObject (readonly)

Returns the value of attribute product_codes.



4
5
6
# File 'lib/ec2/image.rb', line 4

def product_codes
  @product_codes
end

#publicObject (readonly)

Returns the value of attribute public.



4
5
6
# File 'lib/ec2/image.rb', line 4

def public
  @public
end

#ramdisk_idObject (readonly)

Returns the value of attribute ramdisk_id.



4
5
6
# File 'lib/ec2/image.rb', line 4

def ramdisk_id
  @ramdisk_id
end

#stateObject (readonly)

Returns the value of attribute state.



4
5
6
# File 'lib/ec2/image.rb', line 4

def state
  @state
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/ec2/image.rb', line 4

def type
  @type
end

Instance Method Details

#deregisterObject

Deregister this Image



26
27
28
# File 'lib/ec2/image.rb', line 26

def deregister
  @ec2.deregister_image @id
end

#public?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/ec2/image.rb', line 21

def public?
  @public
end

#reregisterObject

Reregister this image

Will both deregister and then register the Image again



33
34
35
36
37
38
# File 'lib/ec2/image.rb', line 33

def reregister
  @ec2.deregister_image @id
  new_id = @ec2.register_image @location
  @id = new_id
  self
end

#run(options = {}) ⇒ Object Also known as: launch

launches instances of this image

Options:

  • :min - The minimum number of instances to launch. Default: 1

  • :max - The maximum number of instances to launch. Default: 1

  • :key_name - The name of the key pair with which to launch instances

  • :security_groups - The names of security groups to associate launched instances with

  • :user_data - User data made available to instances (Note: Must be 16K or less, will be base64 encoded by Awsum)

  • :instance_type - The size of the instances to launch, can be one of [m1.small, m1.large, m1.xlarge, c1.medium, c1.xlarge], default is m1.small

  • :availability_zone - The name of the availability zone to launch this instance in

  • :kernel_id - The ID of the kernel with which to launch instances

  • :ramdisk_id - The ID of the RAM disk with which to launch instances

  • :block_device_map - A ‘hash’ of mappings. E.g. => ‘sdb’



53
54
55
# File 'lib/ec2/image.rb', line 53

def run(options = {})
  @ec2.run_instances(id, options)
end