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

samples: Add AuthorizedView examples #2192

Merged
merged 3 commits into from
Apr 4, 2024
Merged

Conversation

trollyxia
Copy link
Member

Change-Id: I77bb799eb448275928bcf0b562c0d4e06870c96d

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Rollback plan is reviewed and LGTMed
  • All new data plane features have a completed end to end testing plan

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

Change-Id: I77bb799eb448275928bcf0b562c0d4e06870c96d
Copy link

snippet-bot bot commented Apr 2, 2024

Here is the summary of changes.

You are about to add 8 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

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigtable Issues related to the googleapis/java-bigtable API. samples Issues that are directly related to samples. labels Apr 2, 2024
System.out.println(greeting);
}
} catch (NotFoundException e) {
System.err.println("Failed to write to non-existent authorized view: " + e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe update this to "Failed to write to non-existent table or authorized view: " .. cause I think if the table doesn't exist, it would also be NotFound?

Copy link
Member Author

@trollyxia trollyxia Apr 3, 2024

Choose a reason for hiding this comment

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

Hmmm but here we are targeting the authorized view only. In the AFE we would perform spanner lookups for the authorized view. So if the parent table doesn't exist, the NotFound error returned from the AFE is because of the missing authorized view instead of the missing table.

It's similar to when we are trying to write to a table and got a NotFound error, we wouldn't print the error msg as "Failed to write to non-existent table or instance"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, make sense :)

}
} catch (NotFoundException e) {
System.err.println("Failed to write to non-existent authorized view: " + e.getMessage());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also need to catch permission denied? If the writer doesn't have write permission to the view? Same for other examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

The other two read-only examples wouldn't receive permission denied error for reads outside of the authorized view. The server would simply return empty rows.

Change-Id: Ic0e4a16dfd7e17b3580669e7a8d53a9b427c6049
@mutianf
Copy link
Contributor

mutianf commented Apr 4, 2024

/gcbrun

@mutianf mutianf added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 4, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 4, 2024
@mutianf mutianf added automerge Merge the pull request once unit tests and other checks pass. owlbot:run Add this label to trigger the Owlbot post processor. labels Apr 4, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 4, 2024
@trollyxia trollyxia requested review from a team as code owners April 4, 2024 00:18
Copy link

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 4, 2024
@mutianf
Copy link
Contributor

mutianf commented Apr 4, 2024

/gcbrun

@mutianf mutianf merged commit a80aae7 into googleapis:main Apr 4, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/java-bigtable API. samples Issues that are directly related to samples. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants