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

ComputeEngineSample.java uses deprecated APIs #2885

Closed
rameshvenk opened this issue May 15, 2020 · 6 comments · Fixed by #3023
Closed

ComputeEngineSample.java uses deprecated APIs #2885

rameshvenk opened this issue May 15, 2020 · 6 comments · Fixed by #3023
Assignees
Labels
api: compute Issues related to the Compute Engine API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: docs Improvement to the documentation for an API.

Comments

@rameshvenk
Copy link

In which file did you encounter the issue?

https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/compute/cmdline/src/main/java/ComputeEngineSample.java

Did you change the file? If so, how?

GoogleCredentials credential = GoogleCredentials.getApplicationDefault();

HttpRequestInitializer httpRequestInitializer =
                new HttpCredentialsAdapter(credential);

Compute compute =
          new Compute.Builder(httpTransport, JSON_FACTORY, httpRequestInitializer)
              .setApplicationName(APPLICATION_NAME)
              .build();

Describe the issue

The code uses the GoogleCredential class, but the api docs have it marked deprecated. The API reference page also has the same error. After some help via StackOverflow I was able to get this to work.

It would be helpful to update these examples as I feel they are critical for someone trying to navigate the vast maze of the Google APIs. The java sdk is very nice to use, but the authentication part feels a bit hard.

@lesv lesv added api: compute Issues related to the Compute Engine API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 15, 2020
@lesv
Copy link
Contributor

lesv commented May 15, 2020

@chingor13 FYI
@JustinBeckwith FYI

@lesv lesv assigned averikitsch and unassigned stephaniewang526 May 15, 2020
@lesv
Copy link
Contributor

lesv commented May 15, 2020

@tequilarista PTAL

@lesv
Copy link
Contributor

lesv commented May 15, 2020

@averikitsch Do you own this?

@averikitsch
Copy link
Contributor

averikitsch commented May 15, 2020

It would be a good idea to know what the priority is of maintaining/supporting these samples and who is best to do that work(@tequilarista).

@lesv
Copy link
Contributor

lesv commented May 26, 2020

GoogleCredential is deprecated. Samples should be updates to use GoogleCredentials.
See Issue #2885

Search results

@averikitsch averikitsch removed their assignment May 26, 2020
@averikitsch
Copy link
Contributor

Removing myself so it can be picked up by someone during the FixIt

@lesv lesv added type: docs Improvement to the documentation for an API. and removed 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 28, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label May 28, 2020
@lesv lesv removed the 🚨 This issue needs some love. label May 28, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label May 28, 2020
@averikitsch averikitsch self-assigned this Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: docs Improvement to the documentation for an API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants