blob: e97540958cb09236bd179e42de955ad1e117e008 [file] [log] [blame]
tierno5c012612018-04-19 16:01:59 +02001
2from http import HTTPStatus
3
4__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
5
6
7class FsException(Exception):
8 def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR):
9 self.http_code = http_code
10 Exception.__init__(self, "storage exception " + message)
11
12
13class FsBase(object):
14 def __init__(self):
15 pass
16
17 def get_params(self):
18 return {}
19
20 def fs_connect(self, config):
21 pass
22
23 def fs_disconnect(self):
24 pass
25
26 def mkdir(self, folder):
tiernoebbf3532018-05-03 17:49:37 +020027 raise FsException("Method 'mkdir' not implemented")
tierno5c012612018-04-19 16:01:59 +020028
29 def file_exists(self, storage):
tiernoebbf3532018-05-03 17:49:37 +020030 raise FsException("Method 'file_exists' not implemented")
tierno5c012612018-04-19 16:01:59 +020031
32 def file_size(self, storage):
tiernoebbf3532018-05-03 17:49:37 +020033 raise FsException("Method 'file_size' not implemented")
tierno5c012612018-04-19 16:01:59 +020034
35 def file_extract(self, tar_object, path):
tiernoebbf3532018-05-03 17:49:37 +020036 raise FsException("Method 'file_extract' not implemented")
tierno5c012612018-04-19 16:01:59 +020037
38 def file_open(self, storage, mode):
tiernoebbf3532018-05-03 17:49:37 +020039 raise FsException("Method 'file_open' not implemented")
tierno5c012612018-04-19 16:01:59 +020040
41 def file_delete(self, storage, ignore_non_exist=False):
tiernoebbf3532018-05-03 17:49:37 +020042 raise FsException("Method 'file_delete' not implemented")