Class: UltraVault::DiskSafe

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/ultravault/data_objects/disk_safe.rb

Defined Under Namespace

Classes: DeviceList

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ DiskSafe

Returns a new instance of DiskSafe.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ultravault/data_objects/disk_safe.rb', line 8

def initialize(params)
  @agent_id = params[:agent_id]
  @compression_level = params[:compression_level]
  @compression_type = params[:compression_type]
  @description = params[:description]
  @device_count = params[:device_count].to_i
  @device_list = [params[:device_list]].flatten.collect do |device|
    DeviceList.new(device) if device
  end
  @id = params[:id]      
  @open = params[:open]                        
  @recovery_point_count = params[:recovery_point_count].to_i
  @size = params[:size].to_i  
  @size_of_deltas = params[:size_of_deltas_in_disk_safe].to_i
  @volume_id = params[:volume_id]
  extract_attributes params[:disk_safe_attribute_map]
  super(params)
end

Instance Attribute Details

#agent_idObject (readonly)

Returns the value of attribute agent_id.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def agent_id
  @agent_id
end

#compression_levelObject (readonly)

Returns the value of attribute compression_level.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def compression_level
  @compression_level
end

#compression_typeObject (readonly)

Returns the value of attribute compression_type.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def compression_type
  @compression_type
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def description
  @description
end

#device_countObject (readonly)

Returns the value of attribute device_count.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def device_count
  @device_count
end

#device_listObject (readonly)

Returns the value of attribute device_list.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def device_list
  @device_list
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def id
  @id
end

#openObject (readonly)

Returns the value of attribute open.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def open
  @open
end

#recovery_point_countObject (readonly)

Returns the value of attribute recovery_point_count.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def recovery_point_count
  @recovery_point_count
end

#sizeObject (readonly)

Returns the value of attribute size.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def size
  @size
end

#size_of_deltasObject (readonly)

Returns the value of attribute size_of_deltas.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def size_of_deltas
  @size_of_deltas
end

#volume_idObject (readonly)

Returns the value of attribute volume_id.



3
4
5
# File 'lib/ultravault/data_objects/disk_safe.rb', line 3

def volume_id
  @volume_id
end

Class Method Details

.all[UltraVault::DiskSafe]

Returns all disk safes for the current user.

Returns:

Raises:

  • (Savon::SOAP::Fault)

    errors from the soap transaction



48
49
50
# File 'lib/ultravault/data_objects/disk_safe.rb', line 48

def self.all
  UltraVault::DiskSafeService.new.all_disk_safes
end

.find_all_by_agent_id(agent_id) ⇒ [UltraVault::DiskSafe]

Returns an array of disk safes, if found.

Parameters:

  • agent_id (String)

    the UUID of the agent

Returns:

Raises:

  • (Savon::SOAP::Fault)

    errors from the soap transaction



40
41
42
# File 'lib/ultravault/data_objects/disk_safe.rb', line 40

def self.find_all_by_agent_id(agent_id)
  UltraVault::DiskSafeService.new.find_disksafes_by_agent_id agent_id
end

Instance Method Details

#policiesObject



31
32
33
# File 'lib/ultravault/data_objects/disk_safe.rb', line 31

def policies
  @policies ||= UltraVault::Policy.all.map { |policy| policy if policy.disk_safe_id == id }.compact
end

#recovery_pointsObject



27
28
29
# File 'lib/ultravault/data_objects/disk_safe.rb', line 27

def recovery_points
  @recovery_points ||= UltraVault::RecoveryPointService.new.find_recovery_points_by_disk_safe_id(id)
end