Google Cloud IAM C++ Client 2.13.0
A C++ Client Library for Google Cloud IAM
Loading...
Searching...
No Matches
Public Member Functions | List of all members
google::cloud::iam_v1::IAMPolicyClient Class Reference

API Overview. More...

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

Public Member Functions

 IAMPolicyClient (std::shared_ptr< IAMPolicyConnection > connection, Options opts={})
 
 ~IAMPolicyClient ()
 
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...
 
Copy and move support
 IAMPolicyClient (IAMPolicyClient const &)=default
 
IAMPolicyClientoperator= (IAMPolicyClient const &)=default
 
 IAMPolicyClient (IAMPolicyClient &&)=default
 
IAMPolicyClientoperator= (IAMPolicyClient &&)=default
 

Friends

Equality
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.

Constructor & Destructor Documentation

◆ IAMPolicyClient() [1/3]

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

◆ ~IAMPolicyClient()

google::cloud::iam_v1::IAMPolicyClient::~IAMPolicyClient ( )

◆ IAMPolicyClient() [2/3]

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

◆ IAMPolicyClient() [3/3]

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

Member Function Documentation

◆ GetIamPolicy()

StatusOr< google::iam::v1::Policy > google::cloud::iam_v1::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
requestUnary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.GetIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
optsOptional. Override the class-level options, such as retry and backoff policies.
Returns
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the `StatusOr` contains the error details.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ SetIamPolicy()

StatusOr< google::iam::v1::Policy > google::cloud::iam_v1::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
requestUnary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.SetIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
optsOptional. Override the class-level options, such as retry and backoff policies.
Returns
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the `StatusOr` contains the error details.

◆ TestIamPermissions()

StatusOr< google::iam::v1::TestIamPermissionsResponse > google::cloud::iam_v1::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
requestUnary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.TestIamPermissionsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.
optsOptional. Override the class-level options, such as retry and backoff policies.
Returns
the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the `StatusOr` contains the error details.

Friends And Related Function Documentation

◆ operator!=

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

◆ operator==

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