Class: RMC::Item::ExpressProtect

Inherits:
Object
  • Object
show all
Defined in:
lib/rmc/item/express_protect.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, data) ⇒ ExpressProtect

Returns a new instance of ExpressProtect.


15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rmc/item/express_protect.rb', line 15

def initialize(connection, data)
  @connection = connection

  @id = data['id']
  @name = data['name']
  @status = data['status']
  @backups = data['backups']
  @createdAt = data['createdAt']
  @recoverySetId = data['recoverySetId']

end

Instance Attribute Details

#backupsObject (readonly)

Returns the value of attribute backups.


11
12
13
# File 'lib/rmc/item/express_protect.rb', line 11

def backups
  @backups
end

#connectionObject

Returns the value of attribute connection.


6
7
8
# File 'lib/rmc/item/express_protect.rb', line 6

def connection
  @connection
end

#createdAtObject (readonly)

Returns the value of attribute createdAt.


12
13
14
# File 'lib/rmc/item/express_protect.rb', line 12

def createdAt
  @createdAt
end

#idObject (readonly)

Returns the value of attribute id.


8
9
10
# File 'lib/rmc/item/express_protect.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.


9
10
11
# File 'lib/rmc/item/express_protect.rb', line 9

def name
  @name
end

#recoverySetIdObject (readonly)

Returns the value of attribute recoverySetId.


13
14
15
# File 'lib/rmc/item/express_protect.rb', line 13

def recoverySetId
  @recoverySetId
end

#statusObject (readonly)

Returns the value of attribute status.


10
11
12
# File 'lib/rmc/item/express_protect.rb', line 10

def status
  @status
end

Instance Method Details

#deleteObject


37
38
39
40
41
42
# File 'lib/rmc/item/express_protect.rb', line 37

def delete
  @connection.request(
      :url => "/backup-sets/#{@id}",
      :method => :delete,
  )
end

#restore_to_parent_volumesObject


44
45
46
47
48
49
50
51
# File 'lib/rmc/item/express_protect.rb', line 44

def restore_to_parent_volumes
  response = @connection.request(
      :url => "/backup-sets/#{@id}/restore",
      :method => :post
  )

  @connection.wait_for_task(response['taskUri'].split('/').last)
end

#restore_to_recovery_set(id) ⇒ Object


53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/rmc/item/express_protect.rb', line 53

def restore_to_recovery_set(id)
  response = @connection.request(
      :url => "/backup-sets/#{@id}/restore",
      :payload => {
          backupSet: {
              restoreRecoverysetId: id
          }
      },
      :method => :post
  )

  @connection.wait_for_task(response['taskUri'].split('/').last)
end

#update(data) ⇒ Object


27
28
29
30
31
32
33
34
35
# File 'lib/rmc/item/express_protect.rb', line 27

def update(data)
  @connection.request(
      :url => "/backup-sets/#{@id}",
      :method => :put,
      :payload => {
          backupSet: data
      }
  )
end