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

fix: update GrpcConversions to use Bucket.RetentionPolicy.retention_duration #1798

Merged
merged 2 commits into from Jan 5, 2023

Conversation

BenWhitehead
Copy link
Collaborator

No description provided.

@BenWhitehead BenWhitehead requested a review from a team as a code owner December 5, 2022 23:58
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. labels Dec 5, 2022
@BenWhitehead BenWhitehead marked this pull request as draft December 6, 2022 18:23
@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Jan 4, 2023
…uration

Also update Apiary Conversions to carry through all fields, while updating HttpStorageRpc#update(Bucket) to take rpc specific action to filter down fields in the case of a patch.
@BenWhitehead BenWhitehead marked this pull request as ready for review January 4, 2023 21:50
@BenWhitehead BenWhitehead added owlbot:ignore instruct owl-bot to ignore a PR owlbot:run Add this label to trigger the Owlbot post processor. and removed owlbot:ignore instruct owl-bot to ignore a PR labels Jan 4, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 4, 2023
bucket.setRetentionPolicy(Data.nullOf(RetentionPolicy.class));
} else {
retentionPolicy.setEffectiveTime(Data.nullOf(DateTime.class));
retentionPolicy.setIsLocked(Data.nullOf(Boolean.class));
Copy link
Member

Choose a reason for hiding this comment

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

Why do you set these values to the "null of" of their type? This does seem necessary in the client if they're read-only anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That else branch is leftover from some debugging, I'll clean it up. You're correct, it effectively don't have any impact.

private static void maybeEncodeRetentionPolicy(BucketInfo from, Bucket to) {
if (from.getRetentionPeriodDuration() != null
|| from.retentionPolicyIsLocked() != null
|| from.getRetentionEffectiveTimeOffsetDateTime() != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not use from.getRententionPeriodDuration() or from.retentionPolicyIsLocked() only and leave out from.getRetentionEffectiveTimeOffsetDateTime()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These converters are ignorant to the services constraints on fields. Our converters are always fully mapping, so we care about each of the fields. When this makes its way down to an actual request, that request handler is the place to apply service level field filtering.

Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

LGTM!

@BenWhitehead BenWhitehead merged commit 82fb014 into main Jan 5, 2023
@BenWhitehead BenWhitehead deleted the grpc/policy-duration branch January 5, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants