Google Cloud C++ Client  0.4.0
C++ Client Library for Google Cloud Platform
Public Types | Public Member Functions | List of all members
google::cloud::v0::IamBindings Class Reference

Represents a container for providing users with a handful of operation to users which they can use to add and remove members to Binding which is used for defining IAM Policy for Cloud Platform Resources. More...

#include <google/cloud/iam_bindings.h>

Public Types

using iterator = std::map< std::string, std::set< std::string > >::const_iterator
 

Public Member Functions

 IamBindings ()=default
 
 IamBindings (std::vector< IamBinding > bindings)
 
 IamBindings (std::string const &role, std::set< std::string > const &members)
 
iterator begin () const
 Returns an iterator referring to the first element in IamBindings container. More...
 
iterator end () const
 Returns an iterator referring to the past-the-end element in IamBindings container. More...
 
bool empty () const
 Returns whether the Bindings container is empty. More...
 
std::size_t size () const
 Return number of Bindings in container. More...
 
std::map< std::string, std::set< std::string > > const & bindings () const
 
iterator find (std::string const &role) const
 Finds the members for a role. More...
 
std::set< std::string > at (std::string const &role) const
 Returns the members for a role. More...
 
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 and member to the container. More...
 
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 binding else appends members of given binding to the associated role's key-value entry. More...
 
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 else appends the given members to the give role's member set. More...
 
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. More...
 
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 container. More...
 
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. More...
 
bool operator== (IamBindings const &rhs) const
 
bool operator< (IamBindings const &rhs) const
 
bool operator!= (IamBindings const &rhs) const
 
bool operator> (IamBindings const &rhs) const
 
bool operator<= (IamBindings const &rhs) const
 
bool operator>= (IamBindings const &rhs) const
 

Detailed Description

Represents a container for providing users with a handful of operation to users which they can use to add and remove members to Binding which is used for defining IAM Policy for Cloud Platform Resources.

For more information about a Binding please refer to: https://cloud.google.com/resource-manager/reference/rest/Shared.Types/Binding

Definition at line 35 of file iam_bindings.h.

Member Typedef Documentation

◆ iterator

using google::cloud::v0::IamBindings::iterator = std::map<std::string, std::set<std::string> >::const_iterator

Definition at line 49 of file iam_bindings.h.

Constructor & Destructor Documentation

◆ IamBindings() [1/3]

google::cloud::v0::IamBindings::IamBindings ( )
default

◆ IamBindings() [2/3]

google::cloud::v0::IamBindings::IamBindings ( std::vector< IamBinding bindings)
inlineexplicit

Definition at line 39 of file iam_bindings.h.

◆ IamBindings() [3/3]

google::cloud::v0::IamBindings::IamBindings ( std::string const &  role,
std::set< std::string > const &  members 
)
inline

Definition at line 45 of file iam_bindings.h.

Member Function Documentation

◆ AddMember()

void google::cloud::v0::IamBindings::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 and member to the container.

Parameters
rolerole of the new member.
memberspecifies the identity requesting access for a cloud platform resource.

Definition at line 23 of file iam_bindings.cc.

◆ AddMembers() [1/2]

void google::cloud::v0::IamBindings::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 binding else appends members of given binding to the associated role's key-value entry.

Parameters
iam_bindingbinding representing a set of members and role for them.

Definition at line 27 of file iam_bindings.cc.

◆ AddMembers() [2/2]

void google::cloud::v0::IamBindings::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 else appends the given members to the give role's member set.

Parameters
rolerole of the member set to be added.
membersa set of member which are needed to be added.

Definition at line 34 of file iam_bindings.cc.

◆ at()

std::set<std::string> google::cloud::v0::IamBindings::at ( std::string const &  role) const
inline

Returns the members for a role.

Definition at line 87 of file iam_bindings.h.

◆ begin()

iterator google::cloud::v0::IamBindings::begin ( ) const
inline

Returns an iterator referring to the first element in IamBindings container.

Definition at line 55 of file iam_bindings.h.

◆ bindings()

std::map<std::string, std::set<std::string> > const& google::cloud::v0::IamBindings::bindings ( ) const
inline

Definition at line 77 of file iam_bindings.h.

◆ empty()

bool google::cloud::v0::IamBindings::empty ( ) const
inline

Returns whether the Bindings container is empty.

Returns
bool whether the container is empty or not.

Definition at line 68 of file iam_bindings.h.

◆ end()

iterator google::cloud::v0::IamBindings::end ( ) const
inline

Returns an iterator referring to the past-the-end element in IamBindings container.

Definition at line 61 of file iam_bindings.h.

◆ find()

iterator google::cloud::v0::IamBindings::find ( std::string const &  role) const
inline

Finds the members for a role.

Definition at line 84 of file iam_bindings.h.

◆ operator!=()

bool google::cloud::v0::IamBindings::operator!= ( IamBindings const &  rhs) const
inline

Definition at line 161 of file iam_bindings.h.

◆ operator<()

bool google::cloud::v0::IamBindings::operator< ( IamBindings const &  rhs) const
inline

Definition at line 157 of file iam_bindings.h.

◆ operator<=()

bool google::cloud::v0::IamBindings::operator<= ( IamBindings const &  rhs) const
inline

Definition at line 169 of file iam_bindings.h.

◆ operator==()

bool google::cloud::v0::IamBindings::operator== ( IamBindings const &  rhs) const
inline

Definition at line 153 of file iam_bindings.h.

◆ operator>()

bool google::cloud::v0::IamBindings::operator> ( IamBindings const &  rhs) const
inline

Definition at line 165 of file iam_bindings.h.

◆ operator>=()

bool google::cloud::v0::IamBindings::operator>= ( IamBindings const &  rhs) const
inline

Definition at line 173 of file iam_bindings.h.

◆ RemoveMember()

void google::cloud::v0::IamBindings::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.

Parameters
rolerole of the member to be removed.
memberspecifies the identity requesting access for a cloud platform resource.

Definition at line 39 of file iam_bindings.cc.

◆ RemoveMembers() [1/2]

void google::cloud::v0::IamBindings::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 container.

Parameters
iam_bindingbinding representing a set of members and role for them.

Definition at line 57 of file iam_bindings.cc.

◆ RemoveMembers() [2/2]

void google::cloud::v0::IamBindings::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.

Parameters
rolerole of the member set to be removed.
membersa set of members which are needed to be removed.

Definition at line 61 of file iam_bindings.cc.

◆ size()

std::size_t google::cloud::v0::IamBindings::size ( ) const
inline

Return number of Bindings in container.

Returns
int the size of the container.

Definition at line 75 of file iam_bindings.h.