Patrick Venture | 6d7735d | 2019-06-21 10:03:19 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "status.hpp" |
| 4 | |
| 5 | #include <memory> |
| 6 | #include <sdbusplus/bus.hpp> |
| 7 | #include <string> |
| 8 | |
| 9 | namespace ipmi_flash |
| 10 | { |
| 11 | |
| 12 | class SystemdPreparation : public TriggerableActionInterface |
| 13 | { |
| 14 | public: |
| 15 | static std::unique_ptr<TriggerableActionInterface> |
| 16 | CreatePreparation(sdbusplus::bus::bus&& bus, |
| 17 | const std::string& service); |
| 18 | |
| 19 | SystemdPreparation(sdbusplus::bus::bus&& bus, const std::string& service) : |
| 20 | bus(std::move(bus)), triggerService(service) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | ~SystemdPreparation() = default; |
| 25 | SystemdPreparation(const SystemdPreparation&) = delete; |
| 26 | SystemdPreparation& operator=(const SystemdPreparation&) = delete; |
| 27 | SystemdPreparation(SystemdPreparation&&) = default; |
| 28 | SystemdPreparation& operator=(SystemdPreparation&&) = default; |
| 29 | |
| 30 | bool trigger() override; |
| 31 | void abort() override; |
| 32 | ActionStatus status() override; |
| 33 | |
| 34 | private: |
| 35 | sdbusplus::bus::bus bus; |
| 36 | const std::string triggerService; |
| 37 | ActionStatus state = ActionStatus::unknown; |
| 38 | }; |
| 39 | |
| 40 | } // namespace ipmi_flash |