Class: EC2Launcher::DSL::BlockDevice

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2launcher/dsl/block_device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBlockDevice

Returns a new instance of BlockDevice.



11
12
13
14
15
# File 'lib/ec2launcher/dsl/block_device.rb', line 11

def initialize()
  @count = 1
  @group = "root"
  @user = "root"
end

Instance Attribute Details

#mount_pointObject (readonly)

Returns the value of attribute mount_point.



8
9
10
# File 'lib/ec2launcher/dsl/block_device.rb', line 8

def mount_point
  @mount_point
end

#name(*name) ⇒ Object (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/ec2launcher/dsl/block_device.rb', line 9

def name
  @name
end

Instance Method Details

#count(*block_count) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/ec2launcher/dsl/block_device.rb', line 21

def count(*block_count)
  if block_count.empty?
    @count
  else
    @count = block_count[0]
    self
  end
end

#group(*group) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/ec2launcher/dsl/block_device.rb', line 30

def group(*group)
  if group.empty?
    @group
  else
    @group = group[0]
    self
  end
end

#is_raid?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/ec2launcher/dsl/block_device.rb', line 17

def is_raid?()
  @raid_level.nil?
end

#mount(*mount) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/ec2launcher/dsl/block_device.rb', line 39

def mount(*mount)
  if mount.empty?
    @mount
  else
    @mount_point = mount[0]
    self
  end
end

#owner(*owner) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/ec2launcher/dsl/block_device.rb', line 57

def owner(*owner)
  if owner.empty?
    @owner
  else
    @owner = owner[0]
    self
  end
end

#raid_level(*raid_level) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/ec2launcher/dsl/block_device.rb', line 66

def raid_level(*raid_level)
  if raid_level.empty?
    @raid_level
  else
    @raid_level = raid_level[0]
    self
  end
end

#size(*volume_size) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/ec2launcher/dsl/block_device.rb', line 75

def size(*volume_size)
  if volume_size.empty?
    @size
  else
    @size = volume_size[0].to_i
    self
  end
end

#to_json(*a) ⇒ Object



84
85
86
87
88
89
90
91
92
93
# File 'lib/ec2launcher/dsl/block_device.rb', line 84

def to_json(*a)
  {
    "name" => @name,
    "count" => @count,
    "raid_level" => @raid_level,
    "mount_point" => @mount_point,
    "owner" => @owner,
    "group" => @group
  }.to_json(*a)
end