Skip to content

Commit e3c7e8f

Browse files
feat(spanner): add processing_units to Instance resource (#1248)
PiperOrigin-RevId: 378758342 Source-Author: Google APIs <[email protected]> Source-Date: Thu Jun 10 16:19:06 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: d8698715e4f5b7c45505dadd679255987c260180 Source-Link: googleapis/googleapis@d869871
1 parent 7d7f390 commit e3c7e8f

File tree

6 files changed

+246
-115
lines changed

6 files changed

+246
-115
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ public void getInstanceTest() throws Exception {
374374
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
375375
.setDisplayName("displayName1714148973")
376376
.setNodeCount(1539922066)
377+
.setProcessingUnits(-329117885)
377378
.putAllLabels(new HashMap<String, String>())
378379
.addAllEndpointUris(new ArrayList<String>())
379380
.build();
@@ -417,6 +418,7 @@ public void getInstanceTest2() throws Exception {
417418
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
418419
.setDisplayName("displayName1714148973")
419420
.setNodeCount(1539922066)
421+
.setProcessingUnits(-329117885)
420422
.putAllLabels(new HashMap<String, String>())
421423
.addAllEndpointUris(new ArrayList<String>())
422424
.build();
@@ -460,6 +462,7 @@ public void createInstanceTest() throws Exception {
460462
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
461463
.setDisplayName("displayName1714148973")
462464
.setNodeCount(1539922066)
465+
.setProcessingUnits(-329117885)
463466
.putAllLabels(new HashMap<String, String>())
464467
.addAllEndpointUris(new ArrayList<String>())
465468
.build();
@@ -517,6 +520,7 @@ public void createInstanceTest2() throws Exception {
517520
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
518521
.setDisplayName("displayName1714148973")
519522
.setNodeCount(1539922066)
523+
.setProcessingUnits(-329117885)
520524
.putAllLabels(new HashMap<String, String>())
521525
.addAllEndpointUris(new ArrayList<String>())
522526
.build();
@@ -574,6 +578,7 @@ public void updateInstanceTest() throws Exception {
574578
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
575579
.setDisplayName("displayName1714148973")
576580
.setNodeCount(1539922066)
581+
.setProcessingUnits(-329117885)
577582
.putAllLabels(new HashMap<String, String>())
578583
.addAllEndpointUris(new ArrayList<String>())
579584
.build();

proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/Instance.java

+98
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ private Instance(
131131
endpointUris_.add(s);
132132
break;
133133
}
134+
case 72:
135+
{
136+
processingUnits_ = input.readInt32();
137+
break;
138+
}
134139
default:
135140
{
136141
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
@@ -525,6 +530,26 @@ public int getNodeCount() {
525530
return nodeCount_;
526531
}
527532

533+
public static final int PROCESSING_UNITS_FIELD_NUMBER = 9;
534+
private int processingUnits_;
535+
/**
536+
*
537+
*
538+
* <pre>
539+
* The number of processing units allocated to this instance. At most one of
540+
* processing_units or node_count should be present in the message. This may
541+
* be zero in API responses for instances that are not yet in state `READY`.
542+
* </pre>
543+
*
544+
* <code>int32 processing_units = 9;</code>
545+
*
546+
* @return The processingUnits.
547+
*/
548+
@java.lang.Override
549+
public int getProcessingUnits() {
550+
return processingUnits_;
551+
}
552+
528553
public static final int STATE_FIELD_NUMBER = 6;
529554
private int state_;
530555
/**
@@ -837,6 +862,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
837862
for (int i = 0; i < endpointUris_.size(); i++) {
838863
com.google.protobuf.GeneratedMessageV3.writeString(output, 8, endpointUris_.getRaw(i));
839864
}
865+
if (processingUnits_ != 0) {
866+
output.writeInt32(9, processingUnits_);
867+
}
840868
unknownFields.writeTo(output);
841869
}
842870

@@ -880,6 +908,9 @@ public int getSerializedSize() {
880908
size += dataSize;
881909
size += 1 * getEndpointUrisList().size();
882910
}
911+
if (processingUnits_ != 0) {
912+
size += com.google.protobuf.CodedOutputStream.computeInt32Size(9, processingUnits_);
913+
}
883914
size += unknownFields.getSerializedSize();
884915
memoizedSize = size;
885916
return size;
@@ -900,6 +931,7 @@ public boolean equals(final java.lang.Object obj) {
900931
if (!getConfig().equals(other.getConfig())) return false;
901932
if (!getDisplayName().equals(other.getDisplayName())) return false;
902933
if (getNodeCount() != other.getNodeCount()) return false;
934+
if (getProcessingUnits() != other.getProcessingUnits()) return false;
903935
if (state_ != other.state_) return false;
904936
if (!internalGetLabels().equals(other.internalGetLabels())) return false;
905937
if (!getEndpointUrisList().equals(other.getEndpointUrisList())) return false;
@@ -922,6 +954,8 @@ public int hashCode() {
922954
hash = (53 * hash) + getDisplayName().hashCode();
923955
hash = (37 * hash) + NODE_COUNT_FIELD_NUMBER;
924956
hash = (53 * hash) + getNodeCount();
957+
hash = (37 * hash) + PROCESSING_UNITS_FIELD_NUMBER;
958+
hash = (53 * hash) + getProcessingUnits();
925959
hash = (37 * hash) + STATE_FIELD_NUMBER;
926960
hash = (53 * hash) + state_;
927961
if (!internalGetLabels().getMap().isEmpty()) {
@@ -1105,6 +1139,8 @@ public Builder clear() {
11051139

11061140
nodeCount_ = 0;
11071141

1142+
processingUnits_ = 0;
1143+
11081144
state_ = 0;
11091145

11101146
internalGetMutableLabels().clear();
@@ -1142,6 +1178,7 @@ public com.google.spanner.admin.instance.v1.Instance buildPartial() {
11421178
result.config_ = config_;
11431179
result.displayName_ = displayName_;
11441180
result.nodeCount_ = nodeCount_;
1181+
result.processingUnits_ = processingUnits_;
11451182
result.state_ = state_;
11461183
result.labels_ = internalGetLabels();
11471184
result.labels_.makeImmutable();
@@ -1214,6 +1251,9 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.Instance other) {
12141251
if (other.getNodeCount() != 0) {
12151252
setNodeCount(other.getNodeCount());
12161253
}
1254+
if (other.getProcessingUnits() != 0) {
1255+
setProcessingUnits(other.getProcessingUnits());
1256+
}
12171257
if (other.state_ != 0) {
12181258
setStateValue(other.getStateValue());
12191259
}
@@ -1676,6 +1716,64 @@ public Builder clearNodeCount() {
16761716
return this;
16771717
}
16781718

1719+
private int processingUnits_;
1720+
/**
1721+
*
1722+
*
1723+
* <pre>
1724+
* The number of processing units allocated to this instance. At most one of
1725+
* processing_units or node_count should be present in the message. This may
1726+
* be zero in API responses for instances that are not yet in state `READY`.
1727+
* </pre>
1728+
*
1729+
* <code>int32 processing_units = 9;</code>
1730+
*
1731+
* @return The processingUnits.
1732+
*/
1733+
@java.lang.Override
1734+
public int getProcessingUnits() {
1735+
return processingUnits_;
1736+
}
1737+
/**
1738+
*
1739+
*
1740+
* <pre>
1741+
* The number of processing units allocated to this instance. At most one of
1742+
* processing_units or node_count should be present in the message. This may
1743+
* be zero in API responses for instances that are not yet in state `READY`.
1744+
* </pre>
1745+
*
1746+
* <code>int32 processing_units = 9;</code>
1747+
*
1748+
* @param value The processingUnits to set.
1749+
* @return This builder for chaining.
1750+
*/
1751+
public Builder setProcessingUnits(int value) {
1752+
1753+
processingUnits_ = value;
1754+
onChanged();
1755+
return this;
1756+
}
1757+
/**
1758+
*
1759+
*
1760+
* <pre>
1761+
* The number of processing units allocated to this instance. At most one of
1762+
* processing_units or node_count should be present in the message. This may
1763+
* be zero in API responses for instances that are not yet in state `READY`.
1764+
* </pre>
1765+
*
1766+
* <code>int32 processing_units = 9;</code>
1767+
*
1768+
* @return This builder for chaining.
1769+
*/
1770+
public Builder clearProcessingUnits() {
1771+
1772+
processingUnits_ = 0;
1773+
onChanged();
1774+
return this;
1775+
}
1776+
16791777
private int state_ = 0;
16801778
/**
16811779
*

proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceOrBuilder.java

+15
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@ public interface InstanceOrBuilder
129129
*/
130130
int getNodeCount();
131131

132+
/**
133+
*
134+
*
135+
* <pre>
136+
* The number of processing units allocated to this instance. At most one of
137+
* processing_units or node_count should be present in the message. This may
138+
* be zero in API responses for instances that are not yet in state `READY`.
139+
* </pre>
140+
*
141+
* <code>int32 processing_units = 9;</code>
142+
*
143+
* @return The processingUnits.
144+
*/
145+
int getProcessingUnits();
146+
132147
/**
133148
*
134149
*

0 commit comments

Comments
 (0)