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

Google Cloud Dataflow/Apache Beam and gcloud-java-core #1207

Closed
lukecwik opened this issue Aug 29, 2016 · 10 comments · Fixed by #1380
Closed

Google Cloud Dataflow/Apache Beam and gcloud-java-core #1207

lukecwik opened this issue Aug 29, 2016 · 10 comments · Fixed by #1380
Assignees

Comments

@lukecwik
Copy link

lukecwik commented Aug 29, 2016

We have two external pull requests which add logic to support the active gcloud profile, and also to get the project from the service account which are already supported by gcloud-java-core.

Dataflow/Apache Beam would like to depend on gcloud-java-core for the project detection logic found here: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-core/src/main/java/com/google/cloud/ServiceOptions.java?l=66

And also the auth credentials detection here: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-core/src/main/java/com/google/cloud/ServiceOptions.java?l=237

Currently these are hidden away, is there a way for you to expose these concepts without needing to create a ServiceOptions subclass?

If not, how do you advise Dataflow/Apache Beam to integrate with gcloud-java-core?

Note, that Apache Beam would be interested in the python versions of that code, and in general this would be useful in the other language implementations as well.

@mziccard
Copy link
Contributor

Hi @lukecwik!

Currently these are hidden away, is there a way for you to expose these concepts without needing to create a ServiceOptions subclass?

I can have a look and see if we can expose those functionalities, perhaps as static methods. Out of curiosity (I can thing of a couple of valid reasons) what blocks you from subclassing ServiceOptions?

@lukecwik
Copy link
Author

The constructor for ServiceOptions takes in a bunch of content which seems like it would be brittle to extend with the least amount of code.

Implementing defaultServiceFactory and defaultRpcFactory seems to have the same issues.

@lukecwik
Copy link
Author

lukecwik commented Sep 7, 2016

Ping?

@mziccard
Copy link
Contributor

mziccard commented Sep 7, 2016

@lukecwik Sorry I haven't had the time to work on this yet. I'll try to draft a PR soon.

Did you consider using depending on google-auth-library for the credentials detection part?

@lukecwik
Copy link
Author

lukecwik commented Sep 7, 2016

We already depend on the application default credentials, unfortunately the Apiary generated libraries use a credentials object which is different than the credentials object used by gRPC generated libraries in Java (they are very similar, but not the same package). It seems as though gcloud-java-core creates an abstraction that sits on top of both of these.

@mziccard
Copy link
Contributor

mziccard commented Sep 8, 2016

gRPC generated libraries in Java

Can you provide more details on this? What class are you referring to? Maybe CallCredentials?

It seems as though gcloud-java-core creates an abstraction that sits on top of both of these.

We surely sit on top of google-auth-library but I wouldn't say we sit on top of any gRPC-related credentials class. Also, the long term plan is for us to directly expose classes in google-auth-library as soon as those support all the functionality we need.

@lukecwik
Copy link
Author

lukecwik commented Sep 8, 2016

Apiary generated clients use:
com.google.api.client.googleapis.auth.oauth2.GoogleCredential

gRPC generated clients use:
com.google.auth.oauth2.GoogleCredentials

I though glcoud-java-core sat on top of both, but it seems as though HttpCredentialsAdapter was created which converts a com.google.auth.oauth2.GoogleCredentials to be a HttpRequestInitializer that is compatible with Apiary generated clients and gRPC generated clients use com.google.auth.oauth2.GoogleCredentials directly.

AuthCredentials was what I was thinking of was your common point between Apiary and gRPC generated code and it was what I was referring to as the common abstraction point that Dataflow could depend on/expose instead of exposing com.google.api.client.googleapis.auth.oauth2.GoogleCredential or com.google.auth.oauth2.GoogleCredentials

What functionality are you waiting on from google-auth-library?

@mziccard
Copy link
Contributor

mziccard commented Sep 8, 2016

What functionality are you waiting on from google-auth-library?

Main blockers at the moment are that those classes are not Serializable and do not expose a method to sign byte arrays. Are you going to need this?

@lukecwik
Copy link
Author

lukecwik commented Sep 8, 2016

Signing isn't important for us yet, Serializable could be useful for our end users but not useful for us since Dataflow uses the GCE VM credentials, but for other runners like Spark/Flink, this could be very useful.

How do you deal with short lived credentials, do you have hooks into expiry time?

@mziccard
Copy link
Contributor

mziccard commented Sep 9, 2016

How do you deal with short lived credentials, do you have hooks into expiry time?

Credentials expose a refresh method. The HttpCredentialsAdapter automatically refreshes tokens if needed (see HttpCredentialsAdapter.handlerResponse).

You can also create AuthCredentials from an existing accessToken (see createFor(String accessToken, Date expirationTime)), these are one-time-only credentials. Same applies to google-auth-library credentials created from just an access token (see this constructor).

@garrettjonesgoogle garrettjonesgoogle added api: datastore Issues related to the Datastore API. and removed triaged for beta labels Dec 12, 2016
@garrettjonesgoogle garrettjonesgoogle self-assigned this Dec 12, 2016
@garrettjonesgoogle garrettjonesgoogle added Extension in external code and removed api: datastore Issues related to the Datastore API. labels Jan 26, 2017
github-actions bot pushed a commit that referenced this issue Aug 9, 2022
🤖 I have created a release *beep* *boop*
---


## [2.3.3](googleapis/java-automl@v2.3.2...v2.3.3) (2022-08-09)


### Dependencies

* update dependency com.google.cloud:google-cloud-bigquery to v2.14.1 ([#1195](googleapis/java-automl#1195)) ([e676c4c](googleapis/java-automl@e676c4c))
* update dependency com.google.cloud:google-cloud-bigquery to v2.14.2 ([#1203](googleapis/java-automl#1203)) ([b6d75e2](googleapis/java-automl@b6d75e2))
* update dependency com.google.cloud:google-cloud-bigquery to v2.14.3 ([#1205](googleapis/java-automl#1205)) ([18ee6b6](googleapis/java-automl@18ee6b6))
* update dependency com.google.cloud:google-cloud-core to v2.8.3 ([#1189](googleapis/java-automl#1189)) ([90f3232](googleapis/java-automl@90f3232))
* update dependency com.google.cloud:google-cloud-core to v2.8.4 ([#1190](googleapis/java-automl#1190)) ([77b2a7d](googleapis/java-automl@77b2a7d))
* update dependency com.google.cloud:google-cloud-core to v2.8.5 ([#1191](googleapis/java-automl#1191)) ([f6f08ba](googleapis/java-automl@f6f08ba))
* update dependency com.google.cloud:google-cloud-core to v2.8.6 ([#1197](googleapis/java-automl#1197)) ([9c1ff45](googleapis/java-automl@9c1ff45))
* update dependency com.google.cloud:google-cloud-core to v2.8.7 ([#1199](googleapis/java-automl#1199)) ([7bd891b](googleapis/java-automl@7bd891b))
* update dependency com.google.cloud:google-cloud-core to v2.8.8 ([#1201](googleapis/java-automl#1201)) ([026ae49](googleapis/java-automl@026ae49))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#1192](googleapis/java-automl#1192)) ([94c1c3c](googleapis/java-automl@94c1c3c))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.1 ([#1198](googleapis/java-automl#1198)) ([1be2ead](googleapis/java-automl@1be2ead))
* update dependency com.google.cloud:google-cloud-storage to v2.10.0 ([#1196](googleapis/java-automl#1196)) ([73871d6](googleapis/java-automl@73871d6))
* update dependency com.google.cloud:google-cloud-storage to v2.11.0 ([#1200](googleapis/java-automl#1200)) ([ea4490e](googleapis/java-automl@ea4490e))
* update dependency com.google.cloud:google-cloud-storage to v2.11.1 ([#1202](googleapis/java-automl#1202)) ([3c8f71e](googleapis/java-automl@3c8f71e))
* update dependency com.google.cloud:google-cloud-storage to v2.11.2 ([#1204](googleapis/java-automl#1204)) ([cc4d715](googleapis/java-automl@cc4d715))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants