Implement Certificate and Install interface
Implemented Certificate interface for certificate properties
and install interface to cater for replacing certificate
Change-Id: I06c1b0ee4258a1cf8670f8a9c25254465e1cad48
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/certificate.cpp b/certificate.cpp
index 43b9725..afd15ce 100644
--- a/certificate.cpp
+++ b/certificate.cpp
@@ -42,8 +42,8 @@
const UnitsToRestart& unit,
const CertInstallPath& installPath,
const CertUploadPath& uploadPath) :
- bus(bus),
- objectPath(objPath), certType(type), unitToRestart(unit),
+ CertIfaces(bus, objPath.c_str(), true),
+ bus(bus), objectPath(objPath), certType(type), unitToRestart(unit),
certInstallPath(installPath)
{
auto installHelper = [this](const auto& filePath) {
@@ -57,6 +57,7 @@
typeFuncMap[CLIENT] = installHelper;
typeFuncMap[AUTHORITY] = [](auto filePath) {};
install(uploadPath);
+ this->emit_object_added();
}
Certificate::~Certificate()
diff --git a/certificate.hpp b/certificate.hpp
index 8227b05..fc48f03 100644
--- a/certificate.hpp
+++ b/certificate.hpp
@@ -4,11 +4,19 @@
#include <filesystem>
#include <phosphor-logging/elog.hpp>
+#include <xyz/openbmc_project/Certs/Certificate/server.hpp>
+#include <xyz/openbmc_project/Certs/Install/server.hpp>
namespace phosphor
{
namespace certs
{
+using CertificateIface = sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Certs::server::Certificate>;
+using InstallIface = sdbusplus::xyz::openbmc_project::Certs::server::Install;
+using CertIfaces =
+ sdbusplus::server::object::object<CertificateIface, InstallIface>;
+
using CertificateType = std::string;
using UnitsToRestart = std::string;
using CertInstallPath = std::string;
@@ -36,7 +44,7 @@
* xyz.openbmc_project.Certs.Certificate DBus API
* xyz.openbmc_project.Certs.Instal DBus API
*/
-class Certificate
+class Certificate : public CertIfaces
{
public:
Certificate() = delete;
@@ -64,7 +72,7 @@
* (possibly CA signed) Certificate file.
* @param[in] filePath - Certificate file path.
*/
- void install(const std::string filePath);
+ void install(const std::string filePath) override;
private:
/** @brief Load Certificate file into the X509 structre.