xref: /openbmc/bmcweb/features/redfish/include/redfish.hpp (revision aecb47a427e201f685369cb2eb94dc524358ea19)
1b6df6dc7SBorawski.Lukasz /*
2b6df6dc7SBorawski.Lukasz // Copyright (c) 2018 Intel Corporation
3b6df6dc7SBorawski.Lukasz //
4b6df6dc7SBorawski.Lukasz // Licensed under the Apache License, Version 2.0 (the "License");
5b6df6dc7SBorawski.Lukasz // you may not use this file except in compliance with the License.
6b6df6dc7SBorawski.Lukasz // You may obtain a copy of the License at
7b6df6dc7SBorawski.Lukasz //
8b6df6dc7SBorawski.Lukasz //      http://www.apache.org/licenses/LICENSE-2.0
9b6df6dc7SBorawski.Lukasz //
10b6df6dc7SBorawski.Lukasz // Unless required by applicable law or agreed to in writing, software
11b6df6dc7SBorawski.Lukasz // distributed under the License is distributed on an "AS IS" BASIS,
12b6df6dc7SBorawski.Lukasz // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b6df6dc7SBorawski.Lukasz // See the License for the specific language governing permissions and
14b6df6dc7SBorawski.Lukasz // limitations under the License.
15b6df6dc7SBorawski.Lukasz */
16b6df6dc7SBorawski.Lukasz #pragma once
17b6df6dc7SBorawski.Lukasz 
182b7981f6SKowalski, Kamil #include "../lib/redfish_sessions.hpp"
194e49bd4bSLewanczyk, Dawid #include "../lib/roles.hpp"
20b6df6dc7SBorawski.Lukasz #include "../lib/service_root.hpp"
21b6df6dc7SBorawski.Lukasz 
22b6df6dc7SBorawski.Lukasz namespace redfish {
23b6df6dc7SBorawski.Lukasz /*
24b6df6dc7SBorawski.Lukasz  * @brief Top level class installing and providing Redfish services
25b6df6dc7SBorawski.Lukasz  */
26b6df6dc7SBorawski.Lukasz class RedfishService {
27b6df6dc7SBorawski.Lukasz  public:
28b6df6dc7SBorawski.Lukasz   /*
29b6df6dc7SBorawski.Lukasz    * @brief Redfish service constructor
30b6df6dc7SBorawski.Lukasz    *
31b6df6dc7SBorawski.Lukasz    * Loads Redfish configuration and installs schema resources
32b6df6dc7SBorawski.Lukasz    *
33b6df6dc7SBorawski.Lukasz    * @param[in] app   Crow app on which Redfish will initialize
34b6df6dc7SBorawski.Lukasz    */
35b6df6dc7SBorawski.Lukasz   template <typename CrowApp>
36b6df6dc7SBorawski.Lukasz   RedfishService(CrowApp& app) {
37*aecb47a4SBorawski.Lukasz     auto privilegeProvider =
38*aecb47a4SBorawski.Lukasz         PrivilegeProvider("/etc/redfish.conf.d/privilege_registry.json");
394e49bd4bSLewanczyk, Dawid 
404e49bd4bSLewanczyk, Dawid     nodes.emplace_back(
414e49bd4bSLewanczyk, Dawid         std::make_unique<SessionCollection>(app, privilegeProvider));
424e49bd4bSLewanczyk, Dawid     nodes.emplace_back(std::make_unique<Roles>(app, privilegeProvider));
434e49bd4bSLewanczyk, Dawid     nodes.emplace_back(
444e49bd4bSLewanczyk, Dawid         std::make_unique<RoleCollection>(app, privilegeProvider));
454e49bd4bSLewanczyk, Dawid     nodes.emplace_back(std::make_unique<ServiceRoot>(app, privilegeProvider));
46b6df6dc7SBorawski.Lukasz   }
47b6df6dc7SBorawski.Lukasz 
48b6df6dc7SBorawski.Lukasz  private:
494e49bd4bSLewanczyk, Dawid   std::vector<std::unique_ptr<Node>> nodes;
50b6df6dc7SBorawski.Lukasz };
51b6df6dc7SBorawski.Lukasz 
52b6df6dc7SBorawski.Lukasz }  // namespace redfish
53