Refactor PCIeDeviceList to use getCollectionMembers

This commit refactors the code in the PCIeDeviceList function to use the
getCollectionMembers function for retrieving collection members.
Additionally, a new function getCollectionToKey() is added to
handle the retrieval of collection members with custom key name.

Tested: Validator passed

'''
Test1: Redfish query of PCI devices on a system that does not have
any PCIe devices

curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices
{
  "@odata.id": "/redfish/v1/Systems/system/PCIeDevices",
  "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection",
  "Description": "Collection of PCIe Devices",
  "Members": [],
  "Members@odata.count": 0,
  "Name": "PCIe Device Collection"
}

Test2: Redfish query of PCIe devices on a system that has PCIe devices

curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices
{
  "@odata.id": "/redfish/v1/Systems/system/PCIeDevices",
  "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection",
  "Description": "Collection of PCIe Devices",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/drive0"
    },
.......
    {
      "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1"
    },
    {
      "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card2"
    },
.......
    {
      "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card12"
    }
  ],
  "Members@odata.count": 22,
  "Name": "PCIe Device Collection"
}

Test3: Redfish query of system with PCIe devices
curl -k https://$bmc/redfish/v1/Systems/system
{
  "@odata.id": "/redfish/v1/Systems/system",
  "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
  "Actions": {
    "#ComputerSystem.Reset": {
      "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo",
      "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
    }
  },
......
  "PCIeDevices": [
    {
      "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/drive0"
    },
.......
    {
      "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1"
    },
....
  ],
  "PCIeDevices@odata.count": 22,
  "PartNumber": "",
....
  "SubModel": "S0",
  "SystemType": "Physical"
}
'''

Change-Id: Icb38945a2c7bc5219ff3917fbbc8a9986c9c6155
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 6bd74f9..e8da219 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -131,10 +131,9 @@
         "/redfish/v1/Systems/system/PCIeDevices";
     asyncResp->res.jsonValue["Name"] = "PCIe Device Collection";
     asyncResp->res.jsonValue["Description"] = "Collection of PCIe Devices";
-    asyncResp->res.jsonValue["Members"] = nlohmann::json::array();
-    asyncResp->res.jsonValue["Members@odata.count"] = 0;
 
-    pcie_util::getPCIeDeviceList(asyncResp, "Members");
+    pcie_util::getPCIeDeviceList(asyncResp,
+                                 nlohmann::json::json_pointer("/Members"));
 }
 
 inline void requestRoutesSystemPCIeDeviceCollection(App& app)