@@ -105,6 +105,7 @@ public com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState toProto(
105
105
private final List <ColumnFamily > columnFamilies ;
106
106
107
107
private final Duration changeStreamRetention ;
108
+ private final boolean deletionProtection ;
108
109
109
110
@ InternalApi
110
111
public static Table fromProto (@ Nonnull com .google .bigtable .admin .v2 .Table proto ) {
@@ -135,19 +136,22 @@ public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto)
135
136
TableName .parse (proto .getName ()),
136
137
replicationStates .build (),
137
138
columnFamilies .build (),
138
- changeStreamConfig );
139
+ changeStreamConfig ,
140
+ proto .getDeletionProtection ());
139
141
}
140
142
141
143
private Table (
142
144
TableName tableName ,
143
145
Map <String , ReplicationState > replicationStatesByClusterId ,
144
146
List <ColumnFamily > columnFamilies ,
145
- Duration changeStreamRetention ) {
147
+ Duration changeStreamRetention ,
148
+ boolean deletionProtection ) {
146
149
this .instanceId = tableName .getInstance ();
147
150
this .id = tableName .getTable ();
148
151
this .replicationStatesByClusterId = replicationStatesByClusterId ;
149
152
this .columnFamilies = columnFamilies ;
150
153
this .changeStreamRetention = changeStreamRetention ;
154
+ this .deletionProtection = deletionProtection ;
151
155
}
152
156
153
157
/** Gets the table's id. */
@@ -172,6 +176,11 @@ public Duration getChangeStreamRetention() {
172
176
return changeStreamRetention ;
173
177
}
174
178
179
+ /** Returns whether this table is deletion protected. */
180
+ public boolean isDeletionProtected () {
181
+ return deletionProtection ;
182
+ }
183
+
175
184
@ Override
176
185
public boolean equals (Object o ) {
177
186
if (this == o ) {
@@ -185,12 +194,18 @@ public boolean equals(Object o) {
185
194
&& Objects .equal (instanceId , table .instanceId )
186
195
&& Objects .equal (replicationStatesByClusterId , table .replicationStatesByClusterId )
187
196
&& Objects .equal (columnFamilies , table .columnFamilies )
188
- && Objects .equal (changeStreamRetention , table .changeStreamRetention );
197
+ && Objects .equal (changeStreamRetention , table .changeStreamRetention )
198
+ && Objects .equal (deletionProtection , table .deletionProtection );
189
199
}
190
200
191
201
@ Override
192
202
public int hashCode () {
193
203
return Objects .hashCode (
194
- id , instanceId , replicationStatesByClusterId , columnFamilies , changeStreamRetention );
204
+ id ,
205
+ instanceId ,
206
+ replicationStatesByClusterId ,
207
+ columnFamilies ,
208
+ changeStreamRetention ,
209
+ deletionProtection );
195
210
}
196
211
}
0 commit comments