def get_snapshots(): db_cloner = DatabaseCloner() snapshot_pattern = '{}\_'.format(DATABASE_BACKUP) snapshots = db_cloner.get_list_schemas(snapshot_pattern) msg = dict() msg['status'] = 'success' msg['snapshots'] = sorted(snapshots, reverse=True) return jsonify(msg)
def restore_database(): snapshotId = request.json['snapshotId'] app.logger.info('restore: snapshotId = {}'.format(snapshotId)) db_cloner = DatabaseCloner() db_cloner.restore(snapshotId, DATABASE_BACKUP) msg = dict() msg['status'] = 'success' return jsonify(msg)
def backup_database(): db_cloner = DatabaseCloner() snapshotId = db_cloner.backup(DATABASE_BACKUP) # time.sleep(10) # snapshotId = 'fake{:02}'.format(len(snapshots)) # snapshots.append(snapshotId) msg = dict() msg['status'] = 'success' msg['snapshotId'] = snapshotId return jsonify(msg)