24
24
import com .google .common .collect .ImmutableMap ;
25
25
import com .google .protobuf .FieldMask ;
26
26
import com .google .spanner .admin .instance .v1 .AutoscalingConfig ;
27
+ import com .google .spanner .admin .instance .v1 .Instance .Edition ;
27
28
import java .util .HashMap ;
28
29
import java .util .Map ;
29
30
import java .util .Objects ;
@@ -37,6 +38,7 @@ public enum InstanceField implements FieldSelector {
37
38
NODE_COUNT ("node_count" ),
38
39
PROCESSING_UNITS ("processing_units" ),
39
40
AUTOSCALING_CONFIG ("autoscaling_config" ),
41
+ EDITION ("edition" ),
40
42
LABELS ("labels" );
41
43
42
44
static InstanceField [] defaultFieldsToUpdate (InstanceInfo info ) {
@@ -116,6 +118,10 @@ public Builder setAutoscalingConfig(AutoscalingConfig autoscalingConfig) {
116
118
throw new UnsupportedOperationException ("Unimplemented" );
117
119
}
118
120
121
+ public Builder setEdition (Edition edition ) {
122
+ throw new UnsupportedOperationException ("Unimplemented" );
123
+ }
124
+
119
125
public abstract Builder setState (State state );
120
126
121
127
public abstract Builder addLabel (String key , String value );
@@ -132,6 +138,7 @@ static class BuilderImpl extends Builder {
132
138
private int nodeCount ;
133
139
private int processingUnits ;
134
140
private AutoscalingConfig autoscalingConfig ;
141
+ private Edition edition ;
135
142
private State state ;
136
143
private Map <String , String > labels ;
137
144
private Timestamp updateTime ;
@@ -153,6 +160,7 @@ static class BuilderImpl extends Builder {
153
160
this .labels = new HashMap <>(instance .labels );
154
161
this .updateTime = instance .updateTime ;
155
162
this .createTime = instance .createTime ;
163
+ this .edition = instance .edition ;
156
164
}
157
165
158
166
@ Override
@@ -197,6 +205,12 @@ public BuilderImpl setAutoscalingConfig(AutoscalingConfig autoscalingConfig) {
197
205
return this ;
198
206
}
199
207
208
+ @ Override
209
+ public BuilderImpl setEdition (Edition edition ) {
210
+ this .edition = edition ;
211
+ return this ;
212
+ }
213
+
200
214
@ Override
201
215
public BuilderImpl setState (State state ) {
202
216
this .state = state ;
@@ -227,6 +241,7 @@ public InstanceInfo build() {
227
241
private final int nodeCount ;
228
242
private final int processingUnits ;
229
243
private final AutoscalingConfig autoscalingConfig ;
244
+ private final Edition edition ;
230
245
private final State state ;
231
246
private final ImmutableMap <String , String > labels ;
232
247
private final Timestamp updateTime ;
@@ -239,6 +254,7 @@ public InstanceInfo build() {
239
254
this .nodeCount = builder .nodeCount ;
240
255
this .processingUnits = builder .processingUnits ;
241
256
this .autoscalingConfig = builder .autoscalingConfig ;
257
+ this .edition = builder .edition ;
242
258
this .state = builder .state ;
243
259
this .labels = ImmutableMap .copyOf (builder .labels );
244
260
this .updateTime = builder .updateTime ;
@@ -283,6 +299,10 @@ public AutoscalingConfig getAutoscalingConfig() {
283
299
return autoscalingConfig ;
284
300
}
285
301
302
+ public Edition getEdition () {
303
+ return edition ;
304
+ }
305
+
286
306
/** Returns the current state of the instance. */
287
307
public State getState () {
288
308
return state ;
@@ -306,6 +326,7 @@ public String toString() {
306
326
.add ("nodeCount" , nodeCount )
307
327
.add ("processingUnits" , processingUnits )
308
328
.add ("autoscaling_config" , autoscalingConfig )
329
+ .add ("edition" , edition )
309
330
.add ("state" , state )
310
331
.add ("labels" , labels )
311
332
.add ("createTime" , createTime )
@@ -328,6 +349,7 @@ public boolean equals(Object o) {
328
349
&& nodeCount == that .nodeCount
329
350
&& processingUnits == that .processingUnits
330
351
&& Objects .equals (autoscalingConfig , that .autoscalingConfig )
352
+ && edition == that .edition
331
353
&& state == that .state
332
354
&& Objects .equals (labels , that .labels )
333
355
&& Objects .equals (updateTime , that .updateTime )
@@ -343,6 +365,7 @@ public int hashCode() {
343
365
nodeCount ,
344
366
processingUnits ,
345
367
autoscalingConfig ,
368
+ edition ,
346
369
state ,
347
370
labels ,
348
371
updateTime ,
@@ -365,6 +388,9 @@ com.google.spanner.admin.instance.v1.Instance toProto() {
365
388
if (getAutoscalingConfig () != null ) {
366
389
builder .setAutoscalingConfig (getAutoscalingConfig ());
367
390
}
391
+ if (getEdition () != null ) {
392
+ builder .setEdition (getEdition ());
393
+ }
368
394
return builder .build ();
369
395
}
370
396
0 commit comments