Beispiel #1
0
 def delete_backup(self, name):
     try:
         stub = medusa_pb2_grpc.MedusaStub(self.channel)
         request = medusa_pb2.DeleteBackupRequest(name=name)
         stub.DeleteBackup(request)
     except grpc.RpcError as e:
         logging.error("Failed to delete backup for name: {} due to error: {}".format(name, e))
Beispiel #2
0
 def backup_exists(self, name):
     try:
         stub = medusa_pb2_grpc.MedusaStub(self.channel)
         request = medusa_pb2.BackupStatusRequest(backupName=name)
         stub.BackupStatus(request)
         return True
     except grpc.RpcError as e:
         logging.error("Failed to determine if backup exists for backup name: {} due to error: {}".format(name, e))
         return False
Beispiel #3
0
 def get_backup_status(self, name):
     try:
         stub = medusa_pb2_grpc.MedusaStub(self.channel)
         request = medusa_pb2.BackupStatusRequest(backupName=name)
         resp = stub.BackupStatus(request)
         return resp.status
     except grpc.RpcError as e:
         logging.error("Failed to determine backup status for name: {} due to error: {}".format(name, e))
         return medusa_pb2.StatusType.UNKNOWN
Beispiel #4
0
 def get_backups(self):
     try:
         stub = medusa_pb2_grpc.MedusaStub(self.channel)
         request = medusa_pb2.GetBackupsRequest()
         response = stub.GetBackups(request)
         return response.backups
     except grpc.RpcError as e:
         logging.error("Failed to obtain list of backups due to error: {}".format(e))
         return None
Beispiel #5
0
 def create_backup_stub(self, mode):
     stub = medusa_pb2_grpc.MedusaStub(self.channel)
     if mode == "differential":
         backup_mode = 0
     elif mode == "full":
         backup_mode = 1
     else:
         raise RuntimeError("{} is not a recognized backup mode".format(mode))
     return backup_mode, stub
Beispiel #6
0
 def backup_exists(self, name):
     stub = medusa_pb2_grpc.MedusaStub(self.channel)
     try:
         request = medusa_pb2.BackupStatusRequest(backupName=name)
         stub.BackupStatus(request)
         return True
     except grpc.RpcError as e:
         if e.code() == grpc.StatusCode.NOT_FOUND:
             return False
         raise e
Beispiel #7
0
    def backup(self, name, mode):
        stub = medusa_pb2_grpc.MedusaStub(self.channel)
        if mode == "differential":
            backup_mode = 0
        elif mode == "full":
            backup_mode = 1
        else:
            raise Exception("{} is not a recognized backup mode".format(mode))

        request = medusa_pb2.BackupRequest(name=name, mode=backup_mode)
        return stub.Backup(request)
Beispiel #8
0
 def get_backups(self):
     stub = medusa_pb2_grpc.MedusaStub(self.channel)
     request = medusa_pb2.GetBackupsRequest()
     response = stub.GetBackups(request)
     return response.backups
Beispiel #9
0
 def delete_backup(self, name):
     stub = medusa_pb2_grpc.MedusaStub(self.channel)
     request = medusa_pb2.DeleteBackupRequest(name=name)
     stub.DeleteBackup(request)