certificate: Use string certId in getCertificateProperties

Current implementation assumes only the DBus paths with numbers are the
paths for certificates, so here certId is of type long int. This patch
changes the type to std::string for removing such incorrect assumption
in future commits as dbus paths are not limited to numbers.

Tested:
* Verified both GET Certificate and POST CertificateCollection works.
* Redfish Service Validator passed.
Change-Id: I747adf4bf955194f82650a11f9dc11a85e00d6e4
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 22d77a7..0c1bc62 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -640,8 +640,9 @@
  */
 static void getCertificateProperties(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-    const std::string& objectPath, const std::string& service, long certId,
-    const std::string& certURL, const std::string& name)
+    const std::string& objectPath, const std::string& service,
+    const std::string& certId, const std::string& certURL,
+    const std::string& name)
 {
     BMCWEB_LOG_DEBUG << "getCertificateProperties Path=" << objectPath
                      << " certId=" << certId << " certURl=" << certURL;
@@ -652,14 +653,13 @@
         if (ec)
         {
             BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
-            messages::resourceNotFound(asyncResp->res, name,
-                                       std::to_string(certId));
+            messages::resourceNotFound(asyncResp->res, name, certId);
             return;
         }
         asyncResp->res.jsonValue["@odata.id"] = certURL;
         asyncResp->res.jsonValue["@odata.type"] =
             "#Certificate.v1_0_0.Certificate";
-        asyncResp->res.jsonValue["Id"] = std::to_string(certId);
+        asyncResp->res.jsonValue["Id"] = certId;
         asyncResp->res.jsonValue["Name"] = name;
         asyncResp->res.jsonValue["Description"] = name;
         for (const auto& property : properties)
@@ -845,8 +845,8 @@
                 messages::internalError(asyncResp->res);
                 return;
             }
-            getCertificateProperties(asyncResp, objectPath, service, id,
-                                     certURI, name);
+            getCertificateProperties(asyncResp, objectPath, service,
+                                     std::to_string(id), certURI, name);
             BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
                              << certFile->getCertFilePath();
             },
@@ -890,9 +890,9 @@
             std::string objectPath = certs::httpsObjectPath;
             objectPath += "/";
             objectPath += std::to_string(id);
-            getCertificateProperties(asyncResp, objectPath,
-                                     certs::httpsServiceName, id, certURL,
-                                     "HTTPS Certificate");
+            getCertificateProperties(
+                asyncResp, objectPath, certs::httpsServiceName,
+                std::to_string(id), certURL, "HTTPS Certificate");
         });
 }
 
@@ -971,9 +971,9 @@
             std::string certURL =
                 "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/" +
                 std::to_string(certId);
-            getCertificateProperties(asyncResp, objectPath,
-                                     certs::httpsServiceName, certId, certURL,
-                                     "HTTPS Certificate");
+            getCertificateProperties(
+                asyncResp, objectPath, certs::httpsServiceName,
+                std::to_string(certId), certURL, "HTTPS Certificate");
             BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
                              << certFile->getCertFilePath();
             },
@@ -1082,9 +1082,9 @@
             std::string certURL =
                 "/redfish/v1/AccountService/LDAP/Certificates/" +
                 std::to_string(certId);
-            getCertificateProperties(asyncResp, objectPath,
-                                     certs::ldapServiceName, certId, certURL,
-                                     "LDAP Certificate");
+            getCertificateProperties(
+                asyncResp, objectPath, certs::ldapServiceName,
+                std::to_string(certId), certURL, "LDAP Certificate");
             BMCWEB_LOG_DEBUG << "LDAP certificate install file="
                              << certFile->getCertFilePath();
             },
@@ -1123,7 +1123,8 @@
         objectPath += "/";
         objectPath += std::to_string(id);
         getCertificateProperties(asyncResp, objectPath, certs::ldapServiceName,
-                                 id, certURL, "LDAP Certificate");
+                                 std::to_string(id), certURL,
+                                 "LDAP Certificate");
         });
 } // requestRoutesLDAPCertificate
 /**
@@ -1194,9 +1195,9 @@
                 "/redfish/v1/Managers/bmc/Truststore/Certificates/" +
                 std::to_string(certId);
 
-            getCertificateProperties(asyncResp, objectPath,
-                                     certs::authorityServiceName, certId,
-                                     certURL, "TrustStore Certificate");
+            getCertificateProperties(
+                asyncResp, objectPath, certs::authorityServiceName,
+                std::to_string(certId), certURL, "TrustStore Certificate");
             BMCWEB_LOG_DEBUG << "TrustStore certificate install file="
                              << certFile->getCertFilePath();
             },
@@ -1236,9 +1237,9 @@
         std::string objectPath = certs::authorityObjectPath;
         objectPath += "/";
         objectPath += std::to_string(id);
-        getCertificateProperties(asyncResp, objectPath,
-                                 certs::authorityServiceName, id, certURL,
-                                 "TrustStore Certificate");
+        getCertificateProperties(
+            asyncResp, objectPath, certs::authorityServiceName,
+            std::to_string(id), certURL, "TrustStore Certificate");
         });
 
     BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/<str>/")