diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-11-18 20:45:15 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-11-18 20:45:15 +0100 |
commit | 5f26bbcc37eb4bf78c1ab1e231a55ec98f2e3d4e (patch) | |
tree | c28dba330343abb0b055a1523096558cd23c0c20 /ick2/logapi.py | |
parent | ab4060f964f4ec55d0bf671aa85c3f99af9fa21a (diff) | |
download | ick2-5f26bbcc37eb4bf78c1ab1e231a55ec98f2e3d4e.tar.gz |
Refactor: move LogAPI to its own module
Diffstat (limited to 'ick2/logapi.py')
-rw-r--r-- | ick2/logapi.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ick2/logapi.py b/ick2/logapi.py new file mode 100644 index 0000000..2a6f2f4 --- /dev/null +++ b/ick2/logapi.py @@ -0,0 +1,36 @@ +# Copyright (C) 2017 Lars Wirzenius +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +import ick2 + + +class LogAPI(ick2.ResourceApiBase): # pragma: no cover + + def __init__(self, state): + super().__init__('log', state) + + def get_resource_name(self, resource): + return resource['log'] + + def create(self, body): # pragma: no cover + raise ick2.MethodNotAllowed('Creating builds directly is not allowed') + + def update(self, body, name): # pragma: no cover + raise ick2.MethodNotAllowed('Updating builds directly is not allowed') + + def show(self, name): + log = self._state.get_resource('log', str(name)) + ick2.log.log('info', msg_text='Returning log', log=log) + return log['log'] |