Skip to content

feat: Java SDK Api Key authorization sample #9586

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

Merged
merged 13 commits into from
Oct 24, 2024
Merged

feat: Java SDK Api Key authorization sample #9586

merged 13 commits into from
Oct 24, 2024

Conversation

ldetmer
Copy link
Contributor

@ldetmer ldetmer commented Oct 15, 2024

Description

Java Cloud SDK introduced a new API to allow users to authenticate via an API key. This provides a sample usage of the new setApiKey function.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@ldetmer ldetmer requested review from yoshi-approver and a team as code owners October 15, 2024 22:02
@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: auth labels Oct 15, 2024
@@ -104,11 +108,6 @@ limitations under the License.
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

please note I had to remove this specification as it was causing all AuthExamples tests to fail. I have updated the readme so DownscopingExample can run without it.

Copy link

snippet-bot bot commented Oct 15, 2024

Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

Hello, thank you for submitting this code sample.

Please do the following modifications:

  • split code samples one per class (and file)
  • resolve code snippet mismatching region tags
  • add test(s) to the new code sample

@ldetmer ldetmer requested review from suztomo and minherz October 16, 2024 18:38
Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

Thank you for addressing the feedback quickly. There are a couple of additional changes related to using the standard language constructs as best practices and some guidance regarding code sample parameters and return types.

If you find time, would you mind to split other code samples in the same folder to stand-alone classes? It is not big deal if you don't but we are trying to use each opportunity to improve our code when we touch it.

Thank you.

@ldetmer ldetmer requested a review from minherz October 22, 2024 18:00
Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

please fix the potential test resource generation without deleting.

@ldetmer ldetmer requested a review from minherz October 23, 2024 18:44
Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

thank you for the quick fixes

@ldetmer ldetmer merged commit 51748e8 into main Oct 24, 2024
11 checks passed
@ldetmer ldetmer deleted the java-api-key-sample branch October 24, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: auth samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants