config/sysinv/cgts-client/cgts-client/cgtsclient/v1/fernet.py
Tao Liu 485445def0 Fernet key synchronization
This update contains the following changes for Distributed
Cloud Fernet Key Synching & Management:

1.Disable key rotation cron job for distributed cloud
2.Add a fernet key repo config option in puppet sysinv
3.Add fernet repo sysinv APIs for create/update/retrieve keys
4.Add a fernet operator to create/update/retrieve the keys

Story: 2002842
Task: 22786

Change-Id: Ia14caeef067fa481e3a4159c1658289250632779
Signed-off-by: Tao Liu <tao.liu@windriver.com>
2018-10-26 14:56:42 -05:00

37 lines
816 B
Python

#!/usr/bin/env 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')