Skip to content

Commit b47b943

Browse files
committed
fix formatting
1 parent bdd502b commit b47b943

File tree

6 files changed

+289
-282
lines changed

6 files changed

+289
-282
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,17 @@
2929
/**
3030
* Fluent wrapper for {@link com.google.bigtable.admin.v2.CreateTableRequest}
3131
*
32-
* <p>
33-
* Allows for creating table with:
32+
* <p>Allows for creating table with:
3433
*
3534
* <ul>
36-
* <li>optional columnFamilies, including optional {@link GCRule}
37-
* <li>optional granularity
38-
* <li>and optional split points
35+
* <li>optional columnFamilies, including optional {@link GCRule}
36+
* <li>optional granularity
37+
* <li>and optional split points
3938
* </ul>
4039
*/
4140
public final class CreateTableRequest {
42-
private final com.google.bigtable.admin.v2.CreateTableRequest.Builder requestBuilder = com.google.bigtable.admin.v2.CreateTableRequest
43-
.newBuilder();
41+
private final com.google.bigtable.admin.v2.CreateTableRequest.Builder requestBuilder =
42+
com.google.bigtable.admin.v2.CreateTableRequest.newBuilder();
4443

4544
public static CreateTableRequest of(String tableId) {
4645
return new CreateTableRequest(tableId);
@@ -59,8 +58,7 @@ public CreateTableRequest addFamily(String familyId) {
5958
}
6059

6160
/**
62-
* Adds a new columnFamily with {@link GCRule} to the configuration. Please note
63-
* that calling this
61+
* Adds a new columnFamily with {@link GCRule} to the configuration. Please note that calling this
6462
* method with the same familyId will overwrite the previous family.
6563
*
6664
* @see GCRule for available options.
@@ -70,8 +68,7 @@ public CreateTableRequest addFamily(@Nonnull String familyId, @Nonnull GCRule gc
7068
}
7169

7270
/**
73-
* Adds a new columnFamily with a {@link Type} to the configuration. Please note
74-
* that calling this
71+
* Adds a new columnFamily with a {@link Type} to the configuration. Please note that calling this
7572
* method with the same familyId will overwrite the previous family.
7673
*
7774
* @see Type for available options.
@@ -81,10 +78,8 @@ public CreateTableRequest addFamily(@Nonnull String familyId, @Nonnull Type valu
8178
}
8279

8380
/**
84-
* Adds a new columnFamily with a {@link GCRule} and {@link Type} to the
85-
* configuration. Please
86-
* note that calling this method with the same familyId will overwrite the
87-
* previous family.
81+
* Adds a new columnFamily with a {@link GCRule} and {@link Type} to the configuration. Please
82+
* note that calling this method with the same familyId will overwrite the previous family.
8883
*
8984
* @see GCRule for available options.
9085
* @see Type for available options.
@@ -135,19 +130,20 @@ public CreateTableRequest setDeletionProtection(boolean deletionProtection) {
135130
}
136131

137132
/** Set an automated backup policy for the table. */
138-
public CreateTableRequest setAutomatedBackup(Duration retentionPeriod,
139-
Duration frequency) {
140-
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy policy = com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy
141-
.newBuilder()
142-
.setRetentionPeriod(com.google.protobuf.Duration.newBuilder()
143-
.setSeconds(retentionPeriod.getSeconds())
144-
.setNanos(retentionPeriod.getNano())
145-
.build())
146-
.setFrequency(com.google.protobuf.Duration.newBuilder()
147-
.setSeconds(frequency.getSeconds())
148-
.setNanos(frequency.getNano())
149-
.build())
150-
.build();
133+
public CreateTableRequest setAutomatedBackup(Duration retentionPeriod, Duration frequency) {
134+
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy policy =
135+
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder()
136+
.setRetentionPeriod(
137+
com.google.protobuf.Duration.newBuilder()
138+
.setSeconds(retentionPeriod.getSeconds())
139+
.setNanos(retentionPeriod.getNano())
140+
.build())
141+
.setFrequency(
142+
com.google.protobuf.Duration.newBuilder()
143+
.setSeconds(frequency.getSeconds())
144+
.setNanos(frequency.getNano())
145+
.build())
146+
.build();
151147

152148
requestBuilder.getTableBuilder().setAutomatedBackupPolicy(policy);
153149
return this;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,49 +34,44 @@ public enum ReplicationState {
3434
/** The replication state of the table is unknown in this cluster. */
3535
NOT_KNOWN(com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.STATE_NOT_KNOWN),
3636
/**
37-
* The cluster was recently created, and the table must finish copying over
38-
* pre-existing data from other clusters before it can begin receiving live
39-
* replication updates and serving Data API requests.
37+
* The cluster was recently created, and the table must finish copying over pre-existing data
38+
* from other clusters before it can begin receiving live replication updates and serving Data
39+
* API requests.
4040
*/
4141
INITIALIZING(com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.INITIALIZING),
4242
/**
43-
* The table is temporarily unable to serve Data API requests from this cluster
44-
* due to planned internal maintenance.
43+
* The table is temporarily unable to serve Data API requests from this cluster due to planned
44+
* internal maintenance.
4545
*/
4646
PLANNED_MAINTENANCE(
4747
com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.PLANNED_MAINTENANCE),
4848
/**
49-
* The table is temporarily unable to serve Data API requests from this cluster
50-
* due to unplanned or emergency maintenance.
49+
* The table is temporarily unable to serve Data API requests from this cluster due to unplanned
50+
* or emergency maintenance.
5151
*/
5252
UNPLANNED_MAINTENANCE(
5353
com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.UNPLANNED_MAINTENANCE),
5454
/**
55-
* The table can serve Data API requests from this cluster. Depending on
56-
* replication delay, reads may not immediately reflect the state of the
57-
* table in other clusters.
55+
* The table can serve Data API requests from this cluster. Depending on replication delay,
56+
* reads may not immediately reflect the state of the table in other clusters.
5857
*/
5958
READY(com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.READY),
6059

6160
/**
62-
* The table is fully created and ready for use after a restore, and is being
63-
* optimized for performance. When optimizations are complete, the table will
64-
* transition to`READY` state.
61+
* The table is fully created and ready for use after a restore, and is being optimized for
62+
* performance. When optimizations are complete, the table will transition to`READY` state.
6563
*/
6664
READY_OPTIMIZING(
6765
com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.READY_OPTIMIZING),
6866

69-
/**
70-
* The replication state of table is not known by this client. Please upgrade
71-
* your client.
72-
*/
67+
/** The replication state of table is not known by this client. Please upgrade your client. */
7368
UNRECOGNIZED(com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.UNRECOGNIZED);
7469

7570
private final com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState proto;
7671

7772
/**
78-
* Wraps the protobuf. This method is considered an internal implementation
79-
* detail and not meant to be used by applications.
73+
* Wraps the protobuf. This method is considered an internal implementation detail and not meant
74+
* to be used by applications.
8075
*/
8176
@InternalApi
8277
public static ReplicationState fromProto(
@@ -96,8 +91,8 @@ public static ReplicationState fromProto(
9691
}
9792

9893
/**
99-
* Creates the request protobuf. This method is considered an internal
100-
* implementation detail and not meant to be used by applications.
94+
* Creates the request protobuf. This method is considered an internal implementation detail and
95+
* not meant to be used by applications.
10196
*/
10297
@InternalApi
10398
public com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState toProto() {
@@ -109,32 +104,29 @@ public static class AutomatedBackupPolicy {
109104
private final com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto;
110105

111106
/**
112-
* Wraps the protobuf. This method is considered an internal implementation
113-
* detail and not meant to be used by applications.
107+
* Wraps the protobuf. This method is considered an internal implementation detail and not meant
108+
* to be used by applications.
114109
*/
115110
@InternalApi
116111
public static AutomatedBackupPolicy fromProto(
117112
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto) {
118113
return new AutomatedBackupPolicy(proto);
119114
}
120115

121-
AutomatedBackupPolicy(
122-
@Nonnull com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto) {
116+
AutomatedBackupPolicy(@Nonnull com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto) {
123117
this.proto = proto;
124118
}
125119

126120
/**
127-
* Creates the request protobuf. This method is considered an internal
128-
* implementation detail and not meant to be used by applications.
121+
* Creates the request protobuf. This method is considered an internal implementation detail and
122+
* not meant to be used by applications.
129123
*/
130124
@InternalApi
131125
public com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy toProto() {
132126
return proto;
133127
}
134128

135-
/**
136-
* Returns policy config contents as a string.
137-
*/
129+
/** Returns policy config contents as a string. */
138130
public String viewConfig() {
139131
AutomatedBackupPolicy config = fromProto(proto);
140132
return config.proto.getAllFields().toString();
@@ -154,23 +146,25 @@ public String viewConfig() {
154146
public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto) {
155147
ImmutableMap.Builder<String, ReplicationState> replicationStates = ImmutableMap.builder();
156148

157-
for (Entry<String, com.google.bigtable.admin.v2.Table.ClusterState> entry : proto.getClusterStatesMap()
158-
.entrySet()) {
149+
for (Entry<String, com.google.bigtable.admin.v2.Table.ClusterState> entry :
150+
proto.getClusterStatesMap().entrySet()) {
159151
replicationStates.put(
160152
entry.getKey(), ReplicationState.fromProto(entry.getValue().getReplicationState()));
161153
}
162154

163155
ImmutableList.Builder<ColumnFamily> columnFamilies = ImmutableList.builder();
164156

165-
for (Entry<String, com.google.bigtable.admin.v2.ColumnFamily> entry : proto.getColumnFamiliesMap().entrySet()) {
157+
for (Entry<String, com.google.bigtable.admin.v2.ColumnFamily> entry :
158+
proto.getColumnFamiliesMap().entrySet()) {
166159
columnFamilies.add(ColumnFamily.fromProto(entry.getKey(), entry.getValue()));
167160
}
168161

169162
Duration changeStreamConfig = null;
170163
if (proto.hasChangeStreamConfig()) {
171-
changeStreamConfig = Duration.ofSeconds(
172-
proto.getChangeStreamConfig().getRetentionPeriod().getSeconds(),
173-
proto.getChangeStreamConfig().getRetentionPeriod().getNanos());
164+
changeStreamConfig =
165+
Duration.ofSeconds(
166+
proto.getChangeStreamConfig().getRetentionPeriod().getSeconds(),
167+
proto.getChangeStreamConfig().getRetentionPeriod().getNanos());
174168
}
175169

176170
if (proto.hasAutomatedBackupPolicy()) {
@@ -184,7 +178,7 @@ public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto)
184178
replicationStates.build(),
185179
columnFamilies.build(),
186180
changeStreamConfig,
187-
proto.getDeletionProtection(),
181+
proto.getDeletionProtection(),
188182
automatedBackupPolicy);
189183
}
190184

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public class UpdateTableRequest {
3939
private final com.google.bigtable.admin.v2.UpdateTableRequest.Builder requestBuilder =
4040
com.google.bigtable.admin.v2.UpdateTableRequest.newBuilder();
4141

42-
private final com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.Builder automatedPolicyBuilder =
43-
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder();
42+
private final com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.Builder
43+
automatedPolicyBuilder =
44+
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder();
4445

4546
public static UpdateTableRequest of(String tableId) {
4647
return new UpdateTableRequest(tableId);
@@ -84,28 +85,28 @@ public UpdateTableRequest setDeletionProtection(boolean deletionProtection) {
8485
return this;
8586
}
8687

87-
/** Disables table automated backup policy. */
88+
/** Disables table automated backup policy. */
8889
public UpdateTableRequest disableAutomatedBackup() {
89-
requestBuilder.getTableBuilder().setAutomatedBackupPolicy(
90-
automatedPolicyBuilder.build());
90+
requestBuilder.getTableBuilder().setAutomatedBackupPolicy(automatedPolicyBuilder.build());
9191
requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy");
9292
return this;
9393
}
9494

9595
/** Set an automated backup policy for the table. */
96-
public UpdateTableRequest setAutomatedBackup(Duration retentionPeriod,
97-
Duration frequency) {
98-
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy policy = com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy
99-
.newBuilder()
100-
.setRetentionPeriod(com.google.protobuf.Duration.newBuilder()
101-
.setSeconds(retentionPeriod.getSeconds())
102-
.setNanos(retentionPeriod.getNano())
103-
.build())
104-
.setFrequency(com.google.protobuf.Duration.newBuilder()
105-
.setSeconds(frequency.getSeconds())
106-
.setNanos(frequency.getNano())
107-
.build())
108-
.build();
96+
public UpdateTableRequest setAutomatedBackup(Duration retentionPeriod, Duration frequency) {
97+
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy policy =
98+
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder()
99+
.setRetentionPeriod(
100+
com.google.protobuf.Duration.newBuilder()
101+
.setSeconds(retentionPeriod.getSeconds())
102+
.setNanos(retentionPeriod.getNano())
103+
.build())
104+
.setFrequency(
105+
com.google.protobuf.Duration.newBuilder()
106+
.setSeconds(frequency.getSeconds())
107+
.setNanos(frequency.getNano())
108+
.build())
109+
.build();
109110

110111
requestBuilder.getTableBuilder().setAutomatedBackupPolicy(policy);
111112
requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy");
@@ -114,29 +115,35 @@ public UpdateTableRequest setAutomatedBackup(Duration retentionPeriod,
114115

115116
/** Updates table automated backup policy retention period. */
116117
public UpdateTableRequest setAutomatedBackupRetentionPeriod(Duration retention) {
117-
requestBuilder.getTableBuilder().setAutomatedBackupPolicy(
118-
automatedPolicyBuilder
119-
.setRetentionPeriod(com.google.protobuf.Duration.newBuilder()
120-
.setSeconds(retention.getSeconds())
121-
.setNanos(retention.getNano())
122-
.build())
123-
.build());
118+
requestBuilder
119+
.getTableBuilder()
120+
.setAutomatedBackupPolicy(
121+
automatedPolicyBuilder
122+
.setRetentionPeriod(
123+
com.google.protobuf.Duration.newBuilder()
124+
.setSeconds(retention.getSeconds())
125+
.setNanos(retention.getNano())
126+
.build())
127+
.build());
124128
requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy.retention_period");
125129
return this;
126130
}
127131

128132
/** Updates table automated backup policy frequency. */
129133
public UpdateTableRequest setAutomatedBackupFrequency(Duration frequency) {
130-
requestBuilder.getTableBuilder().setAutomatedBackupPolicy(
131-
automatedPolicyBuilder
132-
.setFrequency(com.google.protobuf.Duration.newBuilder()
133-
.setSeconds(frequency.getSeconds())
134-
.setNanos(frequency.getNano())
135-
.build())
136-
.build());
134+
requestBuilder
135+
.getTableBuilder()
136+
.setAutomatedBackupPolicy(
137+
automatedPolicyBuilder
138+
.setFrequency(
139+
com.google.protobuf.Duration.newBuilder()
140+
.setSeconds(frequency.getSeconds())
141+
.setNanos(frequency.getNano())
142+
.build())
143+
.build());
137144
requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy.frequency");
138145
return this;
139-
}
146+
}
140147

141148
@InternalApi
142149
public com.google.bigtable.admin.v2.UpdateTableRequest toProto(

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequestTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ public void testToProto() {
7373
.setRetentionPeriod(
7474
com.google.protobuf.Duration.newBuilder().setSeconds(86400))
7575
.build())
76-
.setAutomatedBackupPolicy(com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder()
77-
.setRetentionPeriod(com.google.protobuf.Duration.newBuilder()
76+
.setAutomatedBackupPolicy(
77+
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder()
78+
.setRetentionPeriod(
79+
com.google.protobuf.Duration.newBuilder()
7880
.setSeconds(86400)
7981
.setNanos(0))
80-
.setFrequency(com.google.protobuf.Duration.newBuilder()
82+
.setFrequency(
83+
com.google.protobuf.Duration.newBuilder()
8184
.setSeconds(86400)
8285
.setNanos(0))
8386
.build())

0 commit comments

Comments
 (0)