15 #include "google/cloud/iam_bindings.h" 24 bindings_[role].emplace(std::move(member));
28 std::string
const& role(iam_binding
.role());
29 std::set<std::string>
const& members = iam_binding
.members();
31 bindings_[role].insert(members.begin(), members.end());
35 std::set<std::string>
const& members) {
36 bindings_[role].insert(members.begin(), members.end());
40 std::string
const& member) {
41 auto it = bindings_.find(role);
42 if (it == bindings_.end()) {
46 auto& members = it->second;
47 auto member_loc = members.find(member);
49 if (member_loc != members.end()) {
50 members.erase(member_loc);
52 if (members.empty()) {
62 std::set<std::string>
const& members) {
63 auto it = bindings_.find(role);
64 if (it == bindings_.end()) {
68 auto& binding_members = it->second;
69 for (
auto const& member : members) {
70 auto member_loc = binding_members.find(member);
71 if (member_loc != binding_members.end()) {
72 binding_members.erase(member_loc);
75 if (binding_members.empty()) {
80 std::ostream& operator<<(std::ostream& os,
IamBindings const& rhs) {
81 os <<
"IamBindings={";
83 for (
auto const& kv : rhs) {
84 os << sep << kv.first <<
": [";
85 char const* sep2 =
"";
86 for (
auto const& member : kv.second) {
void AddMembers(google::cloud::IamBinding const &iam_binding)
Adds a new key-value pair of role and members to the container if there is none for the role of given...
#define GOOGLE_CLOUD_CPP_NS
Contains all the Google Cloud C++ Library APIs.
void AddMembers(std::string const &role, std::set< std::string > const &members)
Adds a new key-value pair of role and members to the container if there no existing for given role el...
void RemoveMembers(std::string const &role, std::set< std::string > const &members)
Removes the given members from given role's member set if there exists one in container.
void AddMember(std::string const &role, std::string member)
Adds a new member if a binding exists with given role otherwise inserts a new key-value pair of role ...
void RemoveMembers(google::cloud::IamBinding const &iam_binding)
Removes the given binding's member from the given binding's role's member set if there exists one in ...
void RemoveMember(std::string const &role, std::string const &member)
Removes the given member from the given role's member set if there exists one in container.
std::set< std::string > const & members() const
std::string const & role() const
Represents a container for providing users with a handful of operation to users which they can use to...
Represents a Binding which associates a member with a particular role which can be used for Identity ...