20
20
import com .google .cloud .Timestamp ;
21
21
import com .google .cloud .spanner .encryption .BackupEncryptionConfig ;
22
22
import com .google .cloud .spanner .encryption .EncryptionInfo ;
23
+ import com .google .protobuf .ProtocolStringList ;
23
24
import com .google .spanner .admin .database .v1 .Database ;
24
- import java . util . Objects ;
25
+
25
26
import javax .annotation .Nullable ;
27
+ import java .util .Objects ;
26
28
27
29
/** Represents a Cloud Spanner database backup. */
28
30
public class BackupInfo {
@@ -84,6 +86,9 @@ public abstract static class Builder {
84
86
85
87
/** Builds the backup from this builder. */
86
88
public abstract Backup build ();
89
+
90
+ protected abstract Builder setMaxExpireTime (Timestamp maxExpireTime );
91
+ protected abstract Builder setReferencingBackup (ProtocolStringList referencingBackup );
87
92
}
88
93
89
94
abstract static class BuilderImpl extends Builder {
@@ -96,6 +101,8 @@ abstract static class BuilderImpl extends Builder {
96
101
private BackupEncryptionConfig encryptionConfig ;
97
102
private EncryptionInfo encryptionInfo ;
98
103
private com .google .spanner .admin .database .v1 .Backup proto ;
104
+ private Timestamp maxExpireTime ;
105
+ private ProtocolStringList referencingBackup ;
99
106
100
107
BuilderImpl (BackupId id ) {
101
108
this .id = Preconditions .checkNotNull (id );
@@ -111,6 +118,8 @@ abstract static class BuilderImpl extends Builder {
111
118
this .encryptionConfig = other .encryptionConfig ;
112
119
this .encryptionInfo = other .encryptionInfo ;
113
120
this .proto = other .proto ;
121
+ this .maxExpireTime = other .maxExpireTime ;
122
+ this .referencingBackup = other .referencingBackup ;
114
123
}
115
124
116
125
@ Override
@@ -163,6 +172,19 @@ Builder setProto(@Nullable com.google.spanner.admin.database.v1.Backup proto) {
163
172
this .proto = proto ;
164
173
return this ;
165
174
}
175
+
176
+ @ Override
177
+ public Builder setMaxExpireTime (Timestamp maxExpireTime ) {
178
+ this .maxExpireTime = Preconditions .checkNotNull (maxExpireTime );
179
+ return this ;
180
+ }
181
+
182
+
183
+ @ Override
184
+ public Builder setReferencingBackup (ProtocolStringList referencingBackup ) {
185
+ this .referencingBackup = Preconditions .checkNotNull (referencingBackup );
186
+ return this ;
187
+ }
166
188
}
167
189
168
190
/** State of the backup. */
@@ -184,6 +206,8 @@ public enum State {
184
206
private final BackupEncryptionConfig encryptionConfig ;
185
207
private final EncryptionInfo encryptionInfo ;
186
208
private final com .google .spanner .admin .database .v1 .Backup proto ;
209
+ private final Timestamp maxExpireTime ;
210
+ private final ProtocolStringList referencingBackup ;
187
211
188
212
BackupInfo (BuilderImpl builder ) {
189
213
this .id = builder .id ;
@@ -195,6 +219,8 @@ public enum State {
195
219
this .versionTime = builder .versionTime ;
196
220
this .database = builder .database ;
197
221
this .proto = builder .proto ;
222
+ this .maxExpireTime = builder .maxExpireTime ;
223
+ this .referencingBackup = builder .referencingBackup ;
198
224
}
199
225
200
226
/** Returns the backup id. */
@@ -253,6 +279,14 @@ public DatabaseId getDatabase() {
253
279
return proto ;
254
280
}
255
281
282
+ public Timestamp getMaxExpireTime () {
283
+ return maxExpireTime ;
284
+ }
285
+
286
+ public ProtocolStringList getReferencingBackup () {
287
+ return referencingBackup ;
288
+ }
289
+
256
290
@ Override
257
291
public boolean equals (Object o ) {
258
292
if (this == o ) {
@@ -269,26 +303,30 @@ public boolean equals(Object o) {
269
303
&& Objects .equals (encryptionInfo , that .encryptionInfo )
270
304
&& Objects .equals (expireTime , that .expireTime )
271
305
&& Objects .equals (versionTime , that .versionTime )
272
- && Objects .equals (database , that .database );
306
+ && Objects .equals (database , that .database )
307
+ && Objects .equals (maxExpireTime , that .maxExpireTime )
308
+ && Objects .equals (referencingBackup , that .referencingBackup );
273
309
}
274
310
275
311
@ Override
276
312
public int hashCode () {
277
313
return Objects .hash (
278
- id , state , size , encryptionConfig , encryptionInfo , expireTime , versionTime , database );
314
+ id , state , size , encryptionConfig , encryptionInfo , expireTime , versionTime , database , maxExpireTime , referencingBackup );
279
315
}
280
316
281
317
@ Override
282
318
public String toString () {
283
319
return String .format (
284
- "Backup[%s, %s, %d, %s, %s, %s, %s, %s]" ,
320
+ "Backup[%s, %s, %d, %s, %s, %s, %s, %s, %s, %s ]" ,
285
321
id .getName (),
286
322
state ,
287
323
size ,
288
324
encryptionConfig ,
289
325
encryptionInfo ,
290
326
expireTime ,
291
327
versionTime ,
292
- database );
328
+ database ,
329
+ maxExpireTime ,
330
+ referencingBackup );
293
331
}
294
332
}
0 commit comments