Skip to content

Conversation

@jkwlui
Copy link
Member

@jkwlui jkwlui commented Aug 15, 2019

  • pending service account email.
  • lint

@jkwlui jkwlui requested a review from a team as a code owner August 15, 2019 23:14
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 15, 2019
@jkwlui jkwlui changed the base branch from hmacsa to master August 15, 2019 23:17

/** Example of creating an HMAC key for a service account * */
public HmacKey createHmacKey(String serviceAccountEmail) throws StorageException {
// [START storage_create_hmac_key]
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 guessing this is part of some doc set somewhere? (A filed issue explaining all this would be helpful.) Is there documentation for how the example inclusion works?

Storage storage = StorageOptions.getDefaultInstance().getService();

// The service account email for which the new HMAC key will be created.
// String serviceAccountEmail = "service-account@iam.gserviceaccount.com";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this commented out?

Storage storage = StorageOptions.getDefaultInstance().getService();

// The access ID of the HMAC key, e.g. "GOOG0234230X00"
// String accessId = "GOOG0234230X00";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

The code section between the START and END region tags are extracted and put on the doc site. When copy and pasting the sample into their own project, the developer is expected to uncomment the variable declaration and replace the value with their own.

@codecov
Copy link

codecov bot commented Aug 16, 2019

Codecov Report

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

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6088      +/-   ##
============================================
+ Coverage     47.38%    47.4%   +0.01%     
+ Complexity    27182    27123      -59     
============================================
  Files          2523     2501      -22     
  Lines        274581   273249    -1332     
  Branches      31380    31185     -195     
============================================
- Hits         130123   129544     -579     
+ Misses       134850   134174     -676     
+ Partials       9608     9531      -77
Impacted Files Coverage Δ Complexity Δ
.../bigtable/admin/v2/BigtableTableAdminSettings.java 63.63% <0%> (-8.11%) 8% <0%> (+1%)
...gtable/admin/v2/BigtableInstanceAdminSettings.java 96.55% <0%> (-3.45%) 6% <0%> (ø)
...ud/bigtable/data/v2/stub/EnhancedBigtableStub.java 95.45% <0%> (-3.02%) 21% <0%> (-1%)
...le/cloud/bigtable/data/v2/models/BulkMutation.java 97.29% <0%> (-2.71%) 9% <0%> (+2%)
...e/cloud/bigtable/data/v2/BigtableDataSettings.java 32.14% <0%> (-2.64%) 4% <0%> (+1%)
.../google/cloud/spanner/jdbc/CredentialsService.java 91.11% <0%> (-2.23%) 11% <0%> (-1%)
...able/gaxx/reframing/ReframingResponseObserver.java 88.99% <0%> (-1.84%) 29% <0%> (-1%)
...oogle/cloud/spanner/jdbc/SingleUseTransaction.java 86.5% <0%> (-1.29%) 36% <0%> (-4%)
...table/admin/v2/BaseBigtableTableAdminSettings.java 10.93% <0%> (-1.14%) 2% <0%> (ø)
.../com/google/cloud/spanner/jdbc/ConnectionImpl.java 82.58% <0%> (-1.12%) 155% <0%> (ø)
... and 159 more

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 1daf76a...be87a93. Read the comment docs.

Copy link
Contributor

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

Please add service account for samples IT to kokoro builds in case they are re-enabled. Marking that as a requested change.

@jkwlui
Copy link
Member Author

jkwlui commented Sep 9, 2019

@frankyn I reverted the commit to add the env var for integration tests since it's not whitelisted in the Kokoro configs in the backend. This will not block this, we just need an action item for when we add sample test running on Kokoro.

Please take another look :)

Copy link
Contributor

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

Small nits. Overall LGTM.

}

/** Example of retrieving the metadata of an existing HMAC key. * */
public HmacKeyMetadata getHmacKey(String accessId) throws StorageException {
Copy link
Contributor

Choose a reason for hiding this comment

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

pass in projectId in this example and the others as well. It's a small level of detail but it keeps consistency.

return newMetadata;
}

public Page<HmacKeyMetadata> listHmacKeys(String serviceAccountEmail) throws StorageException {
Copy link
Contributor

Choose a reason for hiding this comment

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

use projectId instead of serviceAccountEmail.

@jkwlui
Copy link
Member Author

jkwlui commented Sep 9, 2019

I couldn't find an option to provide projectId for deleteHmacKey or updateHmacKey. Am I missing something here? @JesseLovelace

Copy link
Contributor

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

Thanks @jkwlui two nits.

//
// The ID of the project to which the service account belongs.
// String projectId = "project-id";
HmacKeyMetadata metadata = storage.getHmacKey(accessId);
Copy link
Contributor

Choose a reason for hiding this comment

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

set projectId here.

Storage storage = StorageOptions.getDefaultInstance().getService();

// The service account to list HMAC keys for.
// String serviceAccountEmail = "service-account@iam.gserviceaccount.com";
Copy link
Contributor

Choose a reason for hiding this comment

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

This deviates a bit from other samples.

Copy link
Member Author

Choose a reason for hiding this comment

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

in what way?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@jkwlui jkwlui Sep 10, 2019

Choose a reason for hiding this comment

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

Gotcha! Nice catch.

@jkwlui
Copy link
Member Author

jkwlui commented Sep 13, 2019

I don't think the test failure is due to this PR. Can someone with admin privileges add kokoro:run?

@JesseLovelace

@rahulKQL rahulKQL added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 13, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 13, 2019
@frankyn frankyn merged commit 06d2065 into googleapis:master Sep 16, 2019
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.

7 participants