def create_restore(self, backup_id, source_agent, destination_path,
                    destination_agent=None, overwrite=False):
     url = '{0}/{1}'.format(self._connection.host, 'restore')
     data = json.dumps({
         'BackupId': backup_id,
         'BackupMachineId': source_agent.id,
         'DestinationMachineId': (source_agent.id if not destination_agent
                                  else destination_agent.id),
         'DestinationPath': destination_path,
         'OverwriteFiles': overwrite
     })
     resp = self._connection.request(Http.put, url, data=data)
     restore_action = restore.from_dict(resp.json(),
                                        connection=self._connection)
     return restore_action
 def create_restore(self,
                    backup_id,
                    source_agent,
                    destination_path,
                    destination_agent=None,
                    overwrite=False):
     url = '{0}/{1}'.format(self._connection.host, 'restore')
     data = json.dumps({
         'BackupId':
         backup_id,
         'BackupMachineId':
         source_agent.id,
         'DestinationMachineId': (source_agent.id if not destination_agent
                                  else destination_agent.id),
         'DestinationPath':
         destination_path,
         'OverwriteFiles':
         overwrite
     })
     resp = self._connection.request(Http.put, url, data=data)
     restore_action = restore.from_dict(resp.json(),
                                        connection=self._connection)
     return restore_action
 def get_restore(self, restore_id):
     url = '{0}/restore/{1}'.format(self._connection.host, restore_id)
     resp = self._connection.request(Http.get, url)
     restore_action = restore.from_dict(resp.json(), self._connection)
     return restore_action
 def test_restore_from_dict_works(self):
     mock = mock_restore.restore()
     restore_obj = restore.from_dict(mock)
     self.assertEqual(restore_obj.overwrites, False)
     self.assertEqual(restore_obj.id, 1)
     self.assertEqual(restore_obj.state, 'Unknown')
 def get_restore(self, restore_id):
     url = '{0}/restore/{1}'.format(self._connection.host, restore_id)
     resp = self._connection.request(Http.get, url)
     restore_action = restore.from_dict(resp.json(), self._connection)
     return restore_action
Exemple #6
0
 def test_restore_from_dict_works(self):
     mock = mock_restore.restore()
     restore_obj = restore.from_dict(mock)
     self.assertEqual(restore_obj.overwrites, False)
     self.assertEqual(restore_obj.id, 1)
     self.assertEqual(restore_obj.state, 'Unknown')