blob: 6f82cd31170d27a326913fafc4c219e7e05fcae7 [file] [log] [blame]
tierno87858ca2018-10-08 16:30:15 +02001# -*- coding: utf-8 -*-
2
3# Copyright 2018 Telefonica S.A.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14# implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
tierno5c012612018-04-19 16:01:59 +020018
19from http import HTTPStatus
20
21__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
22
23
24class FsException(Exception):
25 def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR):
26 self.http_code = http_code
27 Exception.__init__(self, "storage exception " + message)
28
29
30class FsBase(object):
31 def __init__(self):
32 pass
33
34 def get_params(self):
35 return {}
36
37 def fs_connect(self, config):
38 pass
39
40 def fs_disconnect(self):
41 pass
42
43 def mkdir(self, folder):
tiernoebbf3532018-05-03 17:49:37 +020044 raise FsException("Method 'mkdir' not implemented")
tierno5c012612018-04-19 16:01:59 +020045
46 def file_exists(self, storage):
tiernoebbf3532018-05-03 17:49:37 +020047 raise FsException("Method 'file_exists' not implemented")
tierno5c012612018-04-19 16:01:59 +020048
49 def file_size(self, storage):
tiernoebbf3532018-05-03 17:49:37 +020050 raise FsException("Method 'file_size' not implemented")
tierno5c012612018-04-19 16:01:59 +020051
52 def file_extract(self, tar_object, path):
tiernoebbf3532018-05-03 17:49:37 +020053 raise FsException("Method 'file_extract' not implemented")
tierno5c012612018-04-19 16:01:59 +020054
55 def file_open(self, storage, mode):
tiernoebbf3532018-05-03 17:49:37 +020056 raise FsException("Method 'file_open' not implemented")
tierno5c012612018-04-19 16:01:59 +020057
58 def file_delete(self, storage, ignore_non_exist=False):
tiernoebbf3532018-05-03 17:49:37 +020059 raise FsException("Method 'file_delete' not implemented")