Google Cloud IAM C++ Client  2.2.1
A C++ Client Library for Google Cloud IAM
Public Member Functions | Friends | List of all members
google::cloud::iam::IAMPolicyClient Class Reference

API Overview. More...

#include <google/cloud/iam/iam_policy_client.h>

Public Member Functions

 IAMPolicyClient (std::shared_ptr< IAMPolicyConnection > connection, Options opts={})
 
 ~IAMPolicyClient ()
 
 IAMPolicyClient (IAMPolicyClient const &)=default
 
IAMPolicyClientoperator= (IAMPolicyClient const &)=default
 
 IAMPolicyClient (IAMPolicyClient &&)=default
 
IAMPolicyClientoperator= (IAMPolicyClient &&)=default
 
StatusOr< google::iam::v1::Policy > SetIamPolicy (google::iam::v1::SetIamPolicyRequest const &request, Options opts={})
 Sets the access control policy on the specified resource. More...
 
StatusOr< google::iam::v1::Policy > GetIamPolicy (google::iam::v1::GetIamPolicyRequest const &request, Options opts={})
 Gets the access control policy for a resource. More...
 
StatusOr< google::iam::v1::TestIamPermissionsResponse > TestIamPermissions (google::iam::v1::TestIamPermissionsRequest const &request, Options opts={})
 Returns permissions that a caller has on the specified resource. More...
 

Friends

bool operator== (IAMPolicyClient const &a, IAMPolicyClient const &b)
 
bool operator!= (IAMPolicyClient const &a, IAMPolicyClient const &b)
 

Detailed Description

API Overview.

Manages Identity and Access Management (IAM) policies.

Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface.

Data model

Access control is applied when a principal (user or service account), takes some action on a resource exposed by a service. Resources, identified by URI-like names, are the unit of access control specification. Service implementations can choose the granularity of access control and the supported permissions for their resources. For example one database service may allow access control to be specified only at the Table level, whereas another might allow access control to also be specified at the Column level.

Policy Structure

See google.iam.v1.Policy

This is intentionally not a CRUD style API because access control policies are created and deleted implicitly with the resources to which they are attached.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Definition at line 86 of file iam_policy_client.h.

Constructor & Destructor Documentation

◆ IAMPolicyClient() [1/3]

google::cloud::iam::IAMPolicyClient::IAMPolicyClient ( std::shared_ptr< IAMPolicyConnection connection,
Options  opts = {} 
)
explicit

◆ ~IAMPolicyClient()

google::cloud::iam::IAMPolicyClient::~IAMPolicyClient ( )

◆ IAMPolicyClient() [2/3]

google::cloud::iam::IAMPolicyClient::IAMPolicyClient ( IAMPolicyClient const &  )
default

◆ IAMPolicyClient() [3/3]

google::cloud::iam::IAMPolicyClient::IAMPolicyClient ( IAMPolicyClient &&  )
default

Member Function Documentation

◆ GetIamPolicy()

StatusOr<google::iam::v1::Policy> google::cloud::iam::IAMPolicyClient::GetIamPolicy ( google::iam::v1::GetIamPolicyRequest const &  request,
Options  opts = {} 
)

Gets the access control policy for a resource.

Returns an empty policy if the resource exists and does not have a policy set.

Parameters
requestgoogle::iam::v1::GetIamPolicyRequest
optsOptional. Override the class-level options, such as retry and backoff policies.
Returns
google::iam::v1::Policy

◆ operator=() [1/2]

IAMPolicyClient& google::cloud::iam::IAMPolicyClient::operator= ( IAMPolicyClient &&  )
default

◆ operator=() [2/2]

IAMPolicyClient& google::cloud::iam::IAMPolicyClient::operator= ( IAMPolicyClient const &  )
default

◆ SetIamPolicy()

StatusOr<google::iam::v1::Policy> google::cloud::iam::IAMPolicyClient::SetIamPolicy ( google::iam::v1::SetIamPolicyRequest const &  request,
Options  opts = {} 
)

Sets the access control policy on the specified resource.

Replaces any existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

Parameters
requestgoogle::iam::v1::SetIamPolicyRequest
optsOptional. Override the class-level options, such as retry and backoff policies.
Returns
google::iam::v1::Policy

◆ TestIamPermissions()

StatusOr<google::iam::v1::TestIamPermissionsResponse> google::cloud::iam::IAMPolicyClient::TestIamPermissions ( google::iam::v1::TestIamPermissionsRequest const &  request,
Options  opts = {} 
)

Returns permissions that a caller has on the specified resource.

If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
requestgoogle::iam::v1::TestIamPermissionsRequest
optsOptional. Override the class-level options, such as retry and backoff policies.
Returns
google::iam::v1::TestIamPermissionsResponse

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( IAMPolicyClient const &  a,
IAMPolicyClient const &  b 
)
friend

Definition at line 105 of file iam_policy_client.h.

◆ operator==

bool operator== ( IAMPolicyClient const &  a,
IAMPolicyClient const &  b 
)
friend

Definition at line 102 of file iam_policy_client.h.