Skip to content

Commit

Permalink
Address review comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
devbww committed Sep 7, 2021
1 parent dd74da0 commit 4d3950b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
22 changes: 16 additions & 6 deletions generator/integration_tests/golden/golden_thing_admin_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,23 @@ class GoldenThingAdminClient {
SetIamPolicy(std::string const& resource, google::iam::v1::Policy const& policy);

/**
* Updates the IAM policy for @p resource using an optimistic concurrency control loop.
*
* The loop fetches the current policy for @p resource, and passes it to @p updater, which should return the new policy. This new policy should use the current etag so that the read-modify-write cycle can detect races and rerun the update when there is a mismatch. If the new policy does not have an etag, the existing policy will be blindly overwritten. If @p updater does not yield a policy, the control loop is terminated and kCancelled is returned.
*
* @param resource Required. The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
* Updates the IAM policy for @p resource using an optimistic concurrency
* control loop.
*
* The loop fetches the current policy for @p resource, and passes it to @p
* updater, which should return the new policy. This new policy should use the
* current etag so that the read-modify-write cycle can detect races and rerun
* the update when there is a mismatch. If the new policy does not have an
* etag, the existing policy will be blindly overwritten. If @p updater does
* not yield a policy, the control loop is terminated and kCancelled is
* returned.
*
* @param resource Required. The resource for which the policy is being
* specified. See the operation documentation for the appropriate value for
* this field.
* @param updater Required. Functor to map the current policy to a new one.
* @param options Optional. Options to control the loop. Expected options are:
* @param options Optional. Options to control the loop. Expected options
* are:
* - `GoldenThingAdminBackoffPolicyOption`
* @return google::iam::v1::Policy
*/
Expand Down
41 changes: 20 additions & 21 deletions generator/internal/client_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,26 @@ Status ClientGenerator::GenerateHeader() {
auto get_method_name = get_iam_policy_extension_->name();
HeaderPrint({
PredicatedFragment<void>(""),
{" /**\n"
" * Updates the IAM policy for @p resource using an"
" optimistic concurrency control loop.\n"
" *\n"
" * The loop fetches the current policy for @p resource, and"
" passes it to @p updater, which should return the new policy."
" This new policy should use the current etag so that the"
" read-modify-write cycle can detect races and rerun the update"
" when there is a mismatch. If the new policy does not have an"
" etag, the existing policy will be blindly overwritten. If"
" @p updater does not yield a policy, the control loop is"
" terminated and kCancelled is returned.\n"
" *\n"
" * @param resource Required. The resource for which the"
" policy is being specified. See the operation documentation"
" for the appropriate value for this field.\n"
" * @param updater Required. Functor to map the current policy"
" to a new one.\n"
" * @param options Optional. Options to control the loop."
" Expected options are:\n"
" * - `$service_name$BackoffPolicyOption`\n"},
{R"""( /**
* Updates the IAM policy for @p resource using an optimistic concurrency
* control loop.
*
* The loop fetches the current policy for @p resource, and passes it to @p
* updater, which should return the new policy. This new policy should use the
* current etag so that the read-modify-write cycle can detect races and rerun
* the update when there is a mismatch. If the new policy does not have an
* etag, the existing policy will be blindly overwritten. If @p updater does
* not yield a policy, the control loop is terminated and kCancelled is
* returned.
*
* @param resource Required. The resource for which the policy is being
* specified. See the operation documentation for the appropriate value for
* this field.
* @param updater Required. Functor to map the current policy to a new one.
* @param options Optional. Options to control the loop. Expected options
* are:
* - `$service_name$BackoffPolicyOption`
)"""},
{" * @return " + response_type + "\n"},
{" */\n"},
{" StatusOr<" + response_type + ">\n"},
Expand Down

0 comments on commit 4d3950b

Please sign in to comment.