diff options
author | Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> | 2021-03-23 13:16:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 13:16:34 -0600 |
commit | 536c2cad814b8fa8cd346a3d7bd5f6b9889c4a6f (patch) | |
tree | 3050797e05d26fa3de1eeefdd6c9d17c35aebc9d /google | |
parent | b4860fec797f7d9f02a7241b2b6cef2d27f96f28 (diff) | |
download | python-api-core-536c2cad814b8fa8cd346a3d7bd5f6b9889c4a6f.tar.gz |
fix: save empty IAM policy bindings (#155)
Diffstat (limited to 'google')
-rw-r--r-- | google/api_core/iam.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/google/api_core/iam.py b/google/api_core/iam.py index f130936..d83cbf3 100644 --- a/google/api_core/iam.py +++ b/google/api_core/iam.py @@ -136,7 +136,10 @@ class Policy(collections_abc.MutableMapping): for b in self._bindings: if b["role"] == key: return b["members"] - return set() + # binding does not yet exist, create one + new_binding = {"role": key, "members": set()} + self._bindings.append(new_binding) + return new_binding["members"] def __setitem__(self, key, value): self.__check_version__() |