Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(subscription): support oidcToken #865

Merged
merged 4 commits into from
Feb 7, 2020

Conversation

stayradiated
Copy link
Contributor

@stayradiated stayradiated commented Jan 26, 2020

Issue

It is currently not possible to create a new Subscription with the Service Account Email or Audience properties configured. These properties are part of the PushConfig.oidcToken field which is not being formatted correctly.

Changes

Similar to the pushEndpoint option, when formatting the metadata of a Subscription, the property needs to be moved into the pushConfig object.

    if (metadata.pushEndpoint) {
      formatted.pushConfig = {
        pushEndpoint: metadata.pushEndpoint,
      };
      delete formatted.pushEndpoint;
    }

    // fix
    if (metadata.oidcToken) {
      formatted.pushConfig = {
        ...formatted.pushConfig,
        oidcToken: metadata.oidcToken,
      };
      delete formatted.oidcToken;
    }

I have added tests and updated documentation for PubSub.createSubscription and Subscription.modifyPushConfig.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 26, 2020
@feywind
Copy link
Collaborator

feywind commented Feb 6, 2020

@bcoe Code review wise this looks fine to me, but I don't know all the inner workings enough to give a yay/nay on the functionality. Do you mind taking a quick look tomorrow? (Or tag someone who would know...)

@feywind feywind added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 6, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 6, 2020
@codecov
Copy link

codecov bot commented Feb 6, 2020

Codecov Report

Merging #865 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #865   +/-   ##
======================================
  Coverage    83.5%   83.5%           
======================================
  Files          31      31           
  Lines       11269   11269           
  Branches      333     333           
======================================
  Hits         9410    9410           
  Misses       1858    1858           
  Partials        1       1

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 d159f71...e089ff7. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 6, 2020

Codecov Report

Merging #865 into master will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #865      +/-   ##
==========================================
+ Coverage   83.46%   83.50%   +0.03%     
==========================================
  Files          31       31              
  Lines       11246    11269      +23     
  Branches      332      333       +1     
==========================================
+ Hits         9387     9410      +23     
  Misses       1858     1858              
  Partials        1        1              

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 32ae411...d159f71. Read the comment docs.

@bcoe
Copy link
Contributor

bcoe commented Feb 6, 2020

@feywind this looks reasonable to me too, but I think perhaps we should loop in @bshaffer for a review who's been doing work around ID Tokens.

@bcoe
Copy link
Contributor

bcoe commented Feb 6, 2020

@stayradiated have you tested end to end with your branch against the actual service?

...formatted.pushConfig,
oidcToken: metadata.oidcToken,
};
delete formatted.oidcToken;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm relatively green in this codebase, but mind clarifying why we need to delete the key off the formatted object?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem to already be happening above it for formatted.pushEndpoint and as well...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was my take as well, oidcToken is just being treated like what's above. My main question is on the sort of systemic goodness of the patch - I don't understand the gestalt of the library enough to say yay or nay yet.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the changes here just expose access to the underlying API call, and is already exposed in other client libraries. With the exception of deleting the key (is this for memory management?) this is LGTM.

@bcoe bcoe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 7, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 7, 2020
@feywind feywind merged commit a786ca0 into googleapis:master Feb 7, 2020
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.

6 participants