@@ -77,7 +77,9 @@ public Table apply(TableInfo tableInfo) {
77
77
private final BigInteger numRows ;
78
78
private final TableDefinition definition ;
79
79
private final EncryptionConfiguration encryptionConfiguration ;
80
- private final Labels labels ;
80
+ private final Annotations labels ;
81
+
82
+ private final Annotations resourceTags ;
81
83
private final Boolean requirePartitionFilter ;
82
84
private final String defaultCollation ;
83
85
@@ -152,6 +154,9 @@ public abstract static class Builder {
152
154
@ BetaApi
153
155
public abstract Builder setLabels (Map <String , String > labels );
154
156
157
+ /** Sets the resource tags applied to this table. */
158
+ public abstract Builder setResourceTags (Map <String , String > resourceTags );
159
+
155
160
/** Creates a {@code TableInfo} object. */
156
161
public abstract TableInfo build ();
157
162
@@ -191,7 +196,9 @@ static class BuilderImpl extends Builder {
191
196
private BigInteger numRows ;
192
197
private TableDefinition definition ;
193
198
private EncryptionConfiguration encryptionConfiguration ;
194
- private Labels labels = Labels .ZERO ;
199
+ private Annotations labels = Annotations .ZERO ;
200
+
201
+ private Annotations resourceTags = Annotations .ZERO ;
195
202
private Boolean requirePartitionFilter ;
196
203
private String defaultCollation ;
197
204
private CloneDefinition cloneDefinition ;
@@ -222,6 +229,7 @@ static class BuilderImpl extends Builder {
222
229
this .definition = tableInfo .definition ;
223
230
this .encryptionConfiguration = tableInfo .encryptionConfiguration ;
224
231
this .labels = tableInfo .labels ;
232
+ this .resourceTags = tableInfo .resourceTags ;
225
233
this .requirePartitionFilter = tableInfo .requirePartitionFilter ;
226
234
this .defaultCollation = tableInfo .defaultCollation ;
227
235
this .cloneDefinition = tableInfo .cloneDefinition ;
@@ -255,7 +263,8 @@ static class BuilderImpl extends Builder {
255
263
this .encryptionConfiguration =
256
264
new EncryptionConfiguration .Builder (tablePb .getEncryptionConfiguration ()).build ();
257
265
}
258
- this .labels = Labels .fromPb (tablePb .getLabels ());
266
+ this .labels = Annotations .fromPb (tablePb .getLabels ());
267
+ this .resourceTags = Annotations .fromPb (tablePb .getResourceTags ());
259
268
this .requirePartitionFilter = tablePb .getRequirePartitionFilter ();
260
269
this .defaultCollation = tablePb .getDefaultCollation ();
261
270
if (tablePb .getCloneDefinition () != null ) {
@@ -394,7 +403,13 @@ public Builder setEncryptionConfiguration(EncryptionConfiguration configuration)
394
403
395
404
@ Override
396
405
public Builder setLabels (Map <String , String > labels ) {
397
- this .labels = Labels .fromUser (labels );
406
+ this .labels = Annotations .fromUser (labels );
407
+ return this ;
408
+ }
409
+
410
+ @ Override
411
+ public Builder setResourceTags (Map <String , String > resourceTags ) {
412
+ this .resourceTags = Annotations .fromUser (resourceTags );
398
413
return this ;
399
414
}
400
415
@@ -449,6 +464,7 @@ public TableInfo build() {
449
464
this .definition = builder .definition ;
450
465
this .encryptionConfiguration = builder .encryptionConfiguration ;
451
466
this .labels = builder .labels ;
467
+ this .resourceTags = builder .resourceTags ;
452
468
this .requirePartitionFilter = builder .requirePartitionFilter ;
453
469
this .defaultCollation = builder .defaultCollation ;
454
470
this .cloneDefinition = builder .cloneDefinition ;
@@ -610,6 +626,11 @@ public Map<String, String> getLabels() {
610
626
return labels .userMap ();
611
627
}
612
628
629
+ /** Return a map for resource tags applied to the table. */
630
+ public Map <String , String > getResourceTags () {
631
+ return resourceTags .userMap ();
632
+ }
633
+
613
634
/**
614
635
* Returns true if a partition filter (that can be used for partition elimination) is required for
615
636
* queries over this table.
@@ -660,6 +681,7 @@ public String toString() {
660
681
.add ("definition" , definition )
661
682
.add ("encryptionConfiguration" , encryptionConfiguration )
662
683
.add ("labels" , labels )
684
+ .add ("resourceTags" , resourceTags )
663
685
.add ("requirePartitionFilter" , requirePartitionFilter )
664
686
.add ("defaultCollation" , defaultCollation )
665
687
.add ("cloneDefinition" , cloneDefinition )
@@ -724,6 +746,7 @@ Table toPb() {
724
746
tablePb .setEncryptionConfiguration (encryptionConfiguration .toPb ());
725
747
}
726
748
tablePb .setLabels (labels .toPb ());
749
+ tablePb .setResourceTags (resourceTags .toPb ());
727
750
tablePb .setRequirePartitionFilter (requirePartitionFilter );
728
751
if (defaultCollation != null ) {
729
752
tablePb .setDefaultCollation (defaultCollation );
0 commit comments