20#ifndef ORES_IAM_MESSAGING_AUTHORIZATION_PROTOCOL_HPP
21#define ORES_IAM_MESSAGING_AUTHORIZATION_PROTOCOL_HPP
27#include "ores.iam.api/domain/role.hpp"
28#include "ores.iam.api/domain/permission.hpp"
30namespace ores::iam::messaging {
32struct list_roles_request {
33 using response_type =
struct list_roles_response;
34 static constexpr std::string_view nats_subject =
"iam.v1.roles.list";
37struct list_roles_response {
38 std::vector<ores::iam::domain::role> roles;
41struct list_permissions_request {};
43struct list_permissions_response {
44 std::vector<ores::iam::domain::permission>
permissions;
47struct get_role_request {
48 std::string identifier;
51struct get_role_response {
53 std::optional<ores::iam::domain::role> role;
54 std::string error_message;
57struct assign_role_request {
58 using response_type =
struct assign_role_response;
59 static constexpr std::string_view nats_subject =
"iam.v1.roles.assign";
60 std::string account_id;
64struct assign_role_response {
66 std::string error_message;
69struct assign_role_by_name_response {
71 std::string error_message;
74struct assign_role_by_name_request {
75 using response_type =
struct assign_role_by_name_response;
76 static constexpr std::string_view nats_subject =
"iam.v1.roles.assign-by-name";
77 std::string principal;
78 std::string role_name;
81struct revoke_role_request {
82 using response_type =
struct revoke_role_response;
83 static constexpr std::string_view nats_subject =
"iam.v1.roles.revoke";
84 std::string account_id;
88struct revoke_role_response {
90 std::string error_message;
93struct revoke_role_by_name_response {
95 std::string error_message;
98struct revoke_role_by_name_request {
99 using response_type =
struct revoke_role_by_name_response;
100 static constexpr std::string_view nats_subject =
"iam.v1.roles.revoke-by-name";
101 std::string principal;
102 std::string role_name;
105struct get_account_roles_request {
106 using response_type =
struct get_account_roles_response;
107 static constexpr std::string_view nats_subject =
"iam.v1.roles.by-account";
108 std::string account_id;
111struct get_account_roles_response {
112 std::vector<ores::iam::domain::role> roles;
115struct get_account_permissions_request {
116 std::string account_id;
119struct get_account_permissions_response {
120 std::vector<std::string> permission_codes;
123struct suggest_role_commands_request {
124 using response_type =
struct suggest_role_commands_response;
125 static constexpr std::string_view nats_subject =
"iam.v1.roles.suggest-commands";
126 std::string username;
127 std::string tenant_id;
128 std::string hostname;
131struct suggest_role_commands_response {
132 std::vector<std::string> commands;
Well-known permission codes used throughout the system.
Definition permission.hpp:78