-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat: add support for table deletion protection #2430
Changes from 6 commits
d9308f7
688a972
244a4ab
239c256
77e368b
ff5dd5b
e537f37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,13 @@ public UpdateTableRequest disableChangeStreamRetention() { | |
return addChangeStreamRetention(Duration.ZERO); | ||
} | ||
|
||
/** Changes the deletion protection of an existing table. */ | ||
public UpdateTableRequest setDeletionProtection(boolean deletionProtection) { | ||
requestBuilder.getTableBuilder().setDeletionProtection(deletionProtection); | ||
requestBuilder.getUpdateMaskBuilder().addPaths("deletion_protection"); | ||
return this; | ||
} | ||
|
||
@InternalApi | ||
public com.google.bigtable.admin.v2.UpdateTableRequest toProto( | ||
String projectId, String instanceId) { | ||
|
@@ -88,11 +95,11 @@ public boolean equals(Object o) { | |
if (this == o) return true; | ||
if (!(o instanceof UpdateTableRequest)) return false; | ||
UpdateTableRequest that = (UpdateTableRequest) o; | ||
return Objects.equals(requestBuilder, that.requestBuilder); | ||
return Objects.equals(requestBuilder.build(), that.requestBuilder.build()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why changing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can remove it but that's what we do in other like CreateTableRequest |
||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(requestBuilder); | ||
return Objects.hash(requestBuilder.build()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, why changing this? |
||
} | ||
} |
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.
Add a comment: /** Returns whether this table is deletion protected. */
and rename it to
isDeletionProtected
to be consistent with authorized view