Class: HP::Cloud::VolumeAttachment

Inherits:
Object
  • Object
show all
Defined in:
lib/hpcloud/volume_attachment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(va = nil) ⇒ VolumeAttachment

Returns a new instance of VolumeAttachment.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/hpcloud/volume_attachment.rb', line 33

def initialize(va = nil)
  @cstatus = CliStatus.new
  @fog_va = va
  if va.nil?
    return
  end
  @id = va["id"]
  @device = va["device"]
  @serverId = va["serverId"]
  @volumeId = va["volumeId"]
  @name = va["name"]
  @server = va["server"]
end

Instance Attribute Details

#cstatusObject

Returns the value of attribute cstatus.



25
26
27
# File 'lib/hpcloud/volume_attachment.rb', line 25

def cstatus
  @cstatus
end

#deviceObject

Returns the value of attribute device.



26
27
28
# File 'lib/hpcloud/volume_attachment.rb', line 26

def device
  @device
end

#idObject

Returns the value of attribute id.



26
27
28
# File 'lib/hpcloud/volume_attachment.rb', line 26

def id
  @id
end

#metaObject

Returns the value of attribute meta.



27
28
29
# File 'lib/hpcloud/volume_attachment.rb', line 27

def meta
  @meta
end

#nameObject

Returns the value of attribute name.



26
27
28
# File 'lib/hpcloud/volume_attachment.rb', line 26

def name
  @name
end

#serverObject

Returns the value of attribute server.



26
27
28
# File 'lib/hpcloud/volume_attachment.rb', line 26

def server
  @server
end

#serverIdObject

Returns the value of attribute serverId.



26
27
28
# File 'lib/hpcloud/volume_attachment.rb', line 26

def serverId
  @serverId
end

#volumeIdObject

Returns the value of attribute volumeId.



26
27
28
# File 'lib/hpcloud/volume_attachment.rb', line 26

def volumeId
  @volumeId
end

Class Method Details

.get_keysObject



29
30
31
# File 'lib/hpcloud/volume_attachment.rb', line 29

def self.get_keys()
  return [ "id", "name", "server", "device" ]
end

Instance Method Details

#is_valid?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/hpcloud/volume_attachment.rb', line 53

def is_valid?
  return @cstatus.is_success?
end

#to_hashObject



47
48
49
50
51
# File 'lib/hpcloud/volume_attachment.rb', line 47

def to_hash
  hash = {}
  instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
  hash
end