googleapis / googleapis/google-cloud-rust
Implement an OCC loop to update IAM policy bindings
- Dominant language
- Rust
- Stars
- 955
- Forks
- 144
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 279
Description
When working with IAM policies, applications typically want to do something like "add this member to that role". Because the IAM only support "change all the policies", applications need make multiple RPCs, something like:
1. Call `get_iam_policy(...)` to get the current IAM policy
2. Update the local copy of the policy
3. Apply the change with `set_iam_policy(...)`.
The IAM policy may change between steps 1 and 3, without some pre-condition that sequence of steps may overwrite the other changes. So the code becomes:
1. Call `get_iam_policy(..)` to get the current IAM policy
2. Update the local copy of the policy.
3. Apply the change with `set_iam_policy(...)` and with the `etag` obtained in (1) to avoid overwrites
4. If it succeeds: 🎉 we are done.
5. If it fails with `ABORTED` that indicates a separate change, go back to step (1)
6. If it fails with a different error, return this error.
Contributor guide
Assessment
This issue has not been assessed yet.