Google Cloud IAM C++ Client 2.13.0
A C++ Client Library for Google Cloud IAM
Loading...
Searching...
No Matches
Override iam_admin_v1::IAMClient Retry Policies

This shows how to override the retry policies for iam_admin_v1::IAMClient:

auto options =
.set<google::cloud::iam_admin_v1::
IAMConnectionIdempotencyPolicyOption>(
CustomIdempotencyPolicy().clone())
.set<google::cloud::iam_admin_v1::IAMRetryPolicyOption>(
.clone())
.set<google::cloud::iam_admin_v1::IAMBackoffPolicyOption>(
/*initial_delay=*/std::chrono::milliseconds(200),
/*maximum_delay=*/std::chrono::seconds(45),
/*scaling=*/2.0)
.clone());
// c1 and c2 share the same retry policies
// You can override any of the policies in a new client. This new client
// will share the policies from c1 (or c2) *except* from the retry policy.
connection,
std::chrono::minutes(5))
.clone()));
// You can also override the policies in a single call:
// c3.SomeRpc(..., google::cloud::Options{}
// .set<google::cloud::iam_admin_v1::IAMRetryPolicyOption>(
// google::cloud::iam_admin_v1::IAMLimitedErrorCountRetryPolicy(10).clone()));
Options & set(ValueTypeT< T > v)
Creates and manages Identity and Access Management (IAM) resources.
Definition: iam_client.h:90
std::shared_ptr< IAMConnection > MakeIAMConnection(Options options={})
A factory function to construct an object of type IAMConnection.
::google::cloud::internal::LimitedTimeRetryPolicy< iam_admin_v1_internal::IAMRetryTraits > IAMLimitedTimeRetryPolicy
Definition: iam_connection.h:42
::google::cloud::internal::LimitedErrorCountRetryPolicy< iam_admin_v1_internal::IAMRetryTraits > IAMLimitedErrorCountRetryPolicy
Definition: iam_connection.h:46
google::cloud::internal::ExponentialBackoffPolicy ExponentialBackoffPolicy
Use with google::cloud::Options to configure the retry policy.
Definition: iam_options.h:39

Assuming you have created a custom idempotency policy. Such as:

class CustomIdempotencyPolicy
public:
~CustomIdempotencyPolicy() override = default;
std::unique_ptr<google::cloud::iam_admin_v1::IAMConnectionIdempotencyPolicy>
clone() const override {
return std::make_unique<CustomIdempotencyPolicy>(*this);
}
// Override inherited functions to define as needed.
};
Definition: iam_connection_idempotency_policy.h:33
virtual std::unique_ptr< IAMConnectionIdempotencyPolicy > clone() const
Create a new copy of this object.