Class: Deltacloud::StorageVolume

Inherits:
BaseModel show all
Defined in:
lib/deltacloud/models/storage_volume.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

attr_accessor, attributes, #attributes, #id, #initialize, #to_entity

Constructor Details

This class inherits a constructor from Deltacloud::BaseModel

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



26
27
28
# File 'lib/deltacloud/models/storage_volume.rb', line 26

def actions
  @actions
end

#capacityObject

Returns the value of attribute capacity.



22
23
24
# File 'lib/deltacloud/models/storage_volume.rb', line 22

def capacity
  @capacity
end

#createdObject

Returns the value of attribute created.



20
21
22
# File 'lib/deltacloud/models/storage_volume.rb', line 20

def created
  @created
end

#descriptionObject

openstack volumes have a display_description attr



29
30
31
# File 'lib/deltacloud/models/storage_volume.rb', line 29

def description
  @description
end

#deviceObject

Returns the value of attribute device.



24
25
26
# File 'lib/deltacloud/models/storage_volume.rb', line 24

def device
  @device
end

#instance_idObject

Returns the value of attribute instance_id.



23
24
25
# File 'lib/deltacloud/models/storage_volume.rb', line 23

def instance_id
  @instance_id
end

#kindObject

Returns the value of attribute kind.



28
29
30
# File 'lib/deltacloud/models/storage_volume.rb', line 28

def kind
  @kind
end

#nameObject

Returns the value of attribute name.



27
28
29
# File 'lib/deltacloud/models/storage_volume.rb', line 27

def name
  @name
end

#realm_idObject

Returns the value of attribute realm_id.



25
26
27
# File 'lib/deltacloud/models/storage_volume.rb', line 25

def realm_id
  @realm_id
end

#stateObject

Returns the value of attribute state.



21
22
23
# File 'lib/deltacloud/models/storage_volume.rb', line 21

def state
  @state
end

Instance Method Details

#to_hash(context) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/deltacloud/models/storage_volume.rb', line 31

def to_hash(context)
  r = {
    :id => self.id,
    :href => context.storage_volume_url(self.id),
    :name => name,
    :description => description,
    :state => state,
    :created => created,
    :realm => { :id => realm_id, :href => context.realm_url(realm_id), :rel => :realm },
    :device => device,
    :kind => kind,
    :capacity => capacity,
  }
  r[:actions] = (actions || []).map { |a|
    { :href => context.send("#{a}_storage_volume_url", self.id), :rel => a }
  }
  if instance_id
    r[:instance] = { :id => instance_id, :href => context.instance_url(instance_id), :rel => :instance }
  else
    r[:instance] = {}
  end
  r
end