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_IAM_MESSAGING_BOOTSTRAP_PROTOCOL_HPP
21#define ORES_IAM_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#include "ores.comms/messaging/message_traits.hpp"
30
31namespace ores::iam::messaging {
32
40 std::string code;
41 std::string name;
42 std::string description;
43};
44
45std::ostream& operator<<(std::ostream& s, const bootstrap_bundle_info& v);
46
54 std::string username;
55 std::string password;
56 std::string email;
57
69 std::vector<std::byte> serialize() const;
70
74 static std::expected<create_initial_admin_request, ores::utility::serialization::error_code>
75 deserialize(std::span<const std::byte> data);
76};
77
78std::ostream& operator<<(std::ostream& s, const create_initial_admin_request& v);
79
84 bool success;
85 std::string error_message;
86 boost::uuids::uuid account_id;
87
97 std::vector<std::byte> serialize() const;
98
102 static std::expected<create_initial_admin_response, ores::utility::serialization::error_code>
103 deserialize(std::span<const std::byte> data);
104};
105
106std::ostream& operator<<(std::ostream& s, const create_initial_admin_response& v);
107
120 std::vector<std::byte> serialize() const;
121
125 static std::expected<bootstrap_status_request, ores::utility::serialization::error_code>
126 deserialize(std::span<const std::byte> data);
127};
128
129std::ostream& operator<<(std::ostream& s, const bootstrap_status_request& v);
130
135 bool is_in_bootstrap_mode;
136 std::string message;
137
143 std::vector<bootstrap_bundle_info> available_bundles;
144
158 std::vector<std::byte> serialize() const;
159
163 static std::expected<bootstrap_status_response, ores::utility::serialization::error_code>
164 deserialize(std::span<const std::byte> data);
165};
166
167std::ostream& operator<<(std::ostream& s, const bootstrap_status_response& v);
168
169}
170
171namespace ores::comms::messaging {
172
176template<>
177struct message_traits<iam::messaging::create_initial_admin_request> {
180 static constexpr message_type request_message_type =
181 message_type::create_initial_admin_request;
182};
183
187template<>
188struct message_traits<iam::messaging::bootstrap_status_request> {
191 static constexpr message_type request_message_type =
192 message_type::bootstrap_status_request;
193};
194
195}
196
197#endif
Contains messaging related infrastructure in the comms library.
Definition assets_protocol.hpp:122
Network messaging infrastructure for the IAM module.
Definition account_history_protocol.hpp:33
Traits template for mapping request types to their response types and message type enum values.
Definition message_traits.hpp:66
Lightweight bundle info for bootstrap wizard.
Definition bootstrap_protocol.hpp:39
Request to create the initial administrator account.
Definition bootstrap_protocol.hpp:53
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition bootstrap_protocol.cpp:36
static std::expected< create_initial_admin_request, ores::utility::serialization::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition bootstrap_protocol.cpp:45
Response from creating the initial administrator account.
Definition bootstrap_protocol.hpp:83
static std::expected< create_initial_admin_response, ores::utility::serialization::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition bootstrap_protocol.cpp:77
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition bootstrap_protocol.cpp:68
Request to check the bootstrap mode status.
Definition bootstrap_protocol.hpp:114
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition bootstrap_protocol.cpp:105
static std::expected< bootstrap_status_request, ores::utility::serialization::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition bootstrap_protocol.cpp:111
Response containing the bootstrap mode status.
Definition bootstrap_protocol.hpp:134
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition bootstrap_protocol.cpp:121
std::vector< bootstrap_bundle_info > available_bundles
Available dataset bundles for provisioning.
Definition bootstrap_protocol.hpp:143
static std::expected< bootstrap_status_response, ores::utility::serialization::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition bootstrap_protocol.cpp:137