feat(api_core): support version 3 policy bindings#9869
Conversation
74a32cc to
583ca42
Compare
583ca42 to
6c9556d
Compare
api_core/google/api_core/iam.py
Outdated
|
|
||
| @property | ||
| def bindings(self): | ||
| """:obj:`list` of :obj:`dict`: The policy's bindings list. |
There was a problem hiding this comment.
Not sure how we'd document dict keys, I couldn't find any examples in the Google style guides.
There was a problem hiding this comment.
Mypy uses the form Dict[key_type, value_type]. Not sure if this is an official guideline, but at least in BigQuery we follow this format (at least in the docstrings that follow the Google-style format). I also found quite a few occurrences of the same in firestore.
Hope this helps!
api_core/google/api_core/iam.py
Outdated
| members (:obj:`set` of str): Specifies the identities associated to this binding. | ||
| condition (dict of str:str): Specifies a condition under which this binding will apply. | ||
|
|
||
| :obj:`dict` Condition: |
There was a problem hiding this comment.
should this be nested under binding?
|
This PR broke Looking at the source, the error is raised if Question: What significance does |
* feat(api_core): support version 3 policy bindings * fix(doc): fix documenting bindings structure * try fixing docs * fix pytype error * fill test coverage * indent docs * fix docs * improve test coverage * linty * remove unused variable
* feat(api_core): support version 3 policy bindings * fix(doc): fix documenting bindings structure * try fixing docs * fix pytype error * fill test coverage * indent docs * fix docs * improve test coverage * linty * remove unused variable
This
proposalchange uses a list of (binding) dicts as the underlying data structure, while providing backwards compatibility for v1 Policy.The
Policyclass is still inheriting fromMutableMapping, but throws an exception if policy's version is3and the user try to access it as if it were a dict (via accessors, setter, iterator etc).