1 # -*- coding: utf-8 -*-
3 # Copyright 2018 Telefonica S.A.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
19 from http
import HTTPStatus
21 __author__
= "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
24 class 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
)
37 def fs_connect(self
, config
):
40 def fs_disconnect(self
):
43 def mkdir(self
, folder
):
44 raise FsException("Method 'mkdir' not implemented")
46 def file_exists(self
, storage
):
47 raise FsException("Method 'file_exists' not implemented")
49 def file_size(self
, storage
):
50 raise FsException("Method 'file_size' not implemented")
52 def file_extract(self
, tar_object
, path
):
53 raise FsException("Method 'file_extract' not implemented")
55 def file_open(self
, storage
, mode
):
56 raise FsException("Method 'file_open' not implemented")
58 def file_delete(self
, storage
, ignore_non_exist
=False):
59 raise FsException("Method 'file_delete' not implemented")