ORE Studio 0.0.4
Loading...
Searching...
No Matches
bootstrap_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_ACCOUNTS_MESSAGING_BOOTSTRAP_PROTOCOL_HPP
21#define ORES_ACCOUNTS_MESSAGING_BOOTSTRAP_PROTOCOL_HPP
22
23#include <span>
24#include <iosfwd>
25#include <vector>
26#include <expected>
27#include <boost/uuid/uuid.hpp>
28#include "ores.comms/messaging/message_types.hpp"
29
30namespace ores::accounts::messaging {
31
39 std::string username;
40 std::string password;
41 std::string email;
42
54 std::vector<std::byte> serialize() const;
55
59 static std::expected<create_initial_admin_request, comms::messaging::error_code>
60 deserialize(std::span<const std::byte> data);
61};
62
63std::ostream& operator<<(std::ostream& s, const create_initial_admin_request& v);
64
69 bool success;
70 std::string error_message;
71 boost::uuids::uuid account_id;
72
82 std::vector<std::byte> serialize() const;
83
87 static std::expected<create_initial_admin_response, comms::messaging::error_code>
88 deserialize(std::span<const std::byte> data);
89};
90
91std::ostream& operator<<(std::ostream& s, const create_initial_admin_response& v);
92
105 std::vector<std::byte> serialize() const;
106
110 static std::expected<bootstrap_status_request, comms::messaging::error_code>
111 deserialize(std::span<const std::byte> data);
112};
113
114std::ostream& operator<<(std::ostream& s, const bootstrap_status_request& v);
115
120 bool is_in_bootstrap_mode;
121 std::string message;
122
131 std::vector<std::byte> serialize() const;
132
136 static std::expected<bootstrap_status_response, comms::messaging::error_code>
137 deserialize(std::span<const std::byte> data);
138};
139
140std::ostream& operator<<(std::ostream& s, const bootstrap_status_response& v);
141
142}
143
144#endif
Request to create the initial administrator account.
Definition bootstrap_protocol.hpp:38
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition bootstrap_protocol.cpp:35
static std::expected< create_initial_admin_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition bootstrap_protocol.cpp:44
Response from creating the initial administrator account.
Definition bootstrap_protocol.hpp:68
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition bootstrap_protocol.cpp:67
static std::expected< create_initial_admin_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition bootstrap_protocol.cpp:76
Request to check the bootstrap mode status.
Definition bootstrap_protocol.hpp:99
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition bootstrap_protocol.cpp:99
static std::expected< bootstrap_status_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition bootstrap_protocol.cpp:105
Response containing the bootstrap mode status.
Definition bootstrap_protocol.hpp:119
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition bootstrap_protocol.cpp:115
static std::expected< bootstrap_status_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition bootstrap_protocol.cpp:123