Skip to content

Conversation

@busunkim96
Copy link
Contributor

@busunkim96 busunkim96 commented Jul 22, 2020

Closes #536

This adds a new generator option add-iam-methods.

The option adds the three standard IAM methods get_iam_policy, set_iam_policy, and test_iam_permissions. This option is a replacement for reroute_to_grpc_interface in the monolith. reroute_to_grpc_interface is used by KMS and Pub/Sub to expose the IAM methods. Future clients are not expected to use this option.

This PR copy-pastes the IAM methods from the cloud functions client into the templates. The only edits are to the endpoint.

I tried get_iam_policy with KMS and I get the same result as the existing library.

The down-side of copy-pasting is that this code is prone to being missed in changes to the templated methods/tests. I tried adding the methods at the API schema level but was unsuccessful. I'm not very familiar with how the schema works, so if there's a good way to make the change at that level I'm happy to rework this PR.

Failing showcase tests should pass once proto-plus 1.3.2 makes it to PyPI.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 22, 2020
@busunkim96 busunkim96 marked this pull request as ready for review July 22, 2020 04:56
@codecov
Copy link

codecov bot commented Jul 22, 2020

Codecov Report

Merging #545 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #545   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         1507      1477   -30     
  Branches       308       308           
=========================================
- Hits          1507      1477   -30     
Impacted Files Coverage Δ
gapic/generator/options.py 100.00% <100.00%> (ø)
gapic/schema/api.py 100.00% <0.00%> (ø)
gapic/schema/imp.py 100.00% <0.00%> (ø)
gapic/utils/cache.py 100.00% <0.00%> (ø)
gapic/schema/metadata.py 100.00% <0.00%> (ø)
gapic/schema/wrappers.py 100.00% <0.00%> (ø)
gapic/samplegen/samplegen.py 100.00% <0.00%> (ø)
gapic/samplegen_utils/types.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbc6b36...3d51808. Read the comment docs.

@software-dov software-dov merged commit 3f42c3c into master Jul 22, 2020
@software-dov software-dov deleted the add-iam-methods branch July 22, 2020 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add alternative to reroute_to_grpc_interface

2 participants