fae45ff197
The linters in the Opensuse build service are failing because cgts-client has unneeded python shebangs in the code. This is because a python source code file that is not intended to be executed shouldn't include this shebang. Story: 2006508 Task: 36723 Change-Id: I7e46bd175ce3873168be6f28109aa0bd43e0bf5a Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
36 lines
794 B
Python
36 lines
794 B
Python
#
|
|
# Copyright (c) 2018 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from cgtsclient.common import base
|
|
|
|
|
|
class FernetKey(base.Resource):
|
|
def __repr__(self):
|
|
return "<keys %s>" % self._info
|
|
|
|
|
|
class FernetManager(base.Manager):
|
|
resource_class = FernetKey
|
|
|
|
@staticmethod
|
|
def _path(id=None):
|
|
return '/v1/fernet_repo/%s' % id if id else '/v1/fernet_repo'
|
|
|
|
def list(self):
|
|
return self._list(self._path(), "keys")
|
|
|
|
def get(self, id):
|
|
try:
|
|
return self._list(self._path(id))[0]
|
|
except IndexError:
|
|
return None
|
|
|
|
def create(self, data):
|
|
return self._create(self._path(), data)
|
|
|
|
def put(self, patch, id=None):
|
|
return self._update(self._path(id), patch, http_method='PUT')
|