-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add Data Catalog createEntry quickstart samples and tests. #1731
Add Data Catalog createEntry quickstart samples and tests. #1731
Conversation
...catalog/cloud-client/src/main/java/com/example/datacatalog/CreateFilesetEntryQuickStart.java
Outdated
Show resolved
Hide resolved
datacatalog/cloud-client/src/main/java/com/example/datacatalog/CreateFilesetEntry.java
Outdated
Show resolved
Hide resolved
datacatalog/cloud-client/src/main/java/com/example/datacatalog/CreateEntryGroup.java
Outdated
Show resolved
Hide resolved
|
||
// Store names for clean up on teardown | ||
String expectedEntryGroupName = | ||
EntryGroupName.of(PROJECT_ID, LOCATION, entryGroupId).toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I think these helpers are being deprecated. At least, they were deprecated in Python (googleapis/gapic-generator#3012) and the same reasoning applies to the Java generator (it's not possible with new proto annotations for configuring the generator).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know the recommended way?
I see two alternatives...
- Use EntryGroupName.Builder....setProject(project).setLocation(location).setEntryGroup(entryGroup).build()
- Build the string manually
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least in Python (2) is recommended, as the resource builders are going away there. I haven't seen any discussion about it outside of Python, though.
I don't know why, as the same configuration changes affect all languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it makes sense going that way if this configuration will affect all languages...
@kurtisvg Could you point me the recommended way in Java ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, they aren't going away for Java. They are generally preferred to manually formatting the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tswast WDYT can we keep the helpers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have doubts that they will actually stay in Java, based on my conversations with Luke on the ACtools team. I'll check with him if the resource helper deprecation is supposed to affect more than just Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will wait for your confirmation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can proceed with using the resource builders. I misunderstood the reasoning for removal in Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so AFAIK the PR is ready to be merged, @tswast are you able to review it and merge if everything is ok?
I just added the label to run our CI. Once that passes, I think this is OK to merge. |
Test failures:
|
.setDisplayName("My Fileset") | ||
.setDescription("This fileset consists of ....") | ||
.setGcsFilesetSpec( | ||
GcsFilesetSpec.newBuilder().addFilePatterns("gs://my_bucket/*").build()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to use a real bucket here, such as gs://cloud-samples-data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the docs, underscore should be accepted, I filled a bug to check this, but using a real bucket is better, so made the change, thanks.
ping @tswast |
…1731) * ADD sample for create fileset entry quickstart * RAN google java format * CHANGE exception comment * FIX lint issues * Split quickstart into a new folder * Rename files since class name will appear on samples * Ran java formatter * revert region tags change * remove extra space * change to real bucket name
I would like to add samples for Data Catalog create_entry method, released on 0.28.0-alpha google-cloud-datacatalog version.
Since we already have samples for createEntry and createEntryGroup, I would like to submit this PR as an integrated version, which would be used here:
https://cloud.google.com/data-catalog/docs/how-to/filesets#data-catalog-fileset-java