Skip to content

Commit

Permalink
feat(spanner): add processing_units to Instance resource (#1248)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 378758342

Source-Author: Google APIs <noreply@google.com>
Source-Date: Thu Jun 10 16:19:06 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: d8698715e4f5b7c45505dadd679255987c260180
Source-Link: googleapis/googleapis@d869871
  • Loading branch information
yoshi-automation committed Jun 15, 2021
1 parent 7d7f390 commit e3c7e8f
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 115 deletions.
Expand Up @@ -374,6 +374,7 @@ public void getInstanceTest() throws Exception {
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.setNodeCount(1539922066)
.setProcessingUnits(-329117885)
.putAllLabels(new HashMap<String, String>())
.addAllEndpointUris(new ArrayList<String>())
.build();
Expand Down Expand Up @@ -417,6 +418,7 @@ public void getInstanceTest2() throws Exception {
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.setNodeCount(1539922066)
.setProcessingUnits(-329117885)
.putAllLabels(new HashMap<String, String>())
.addAllEndpointUris(new ArrayList<String>())
.build();
Expand Down Expand Up @@ -460,6 +462,7 @@ public void createInstanceTest() throws Exception {
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.setNodeCount(1539922066)
.setProcessingUnits(-329117885)
.putAllLabels(new HashMap<String, String>())
.addAllEndpointUris(new ArrayList<String>())
.build();
Expand Down Expand Up @@ -517,6 +520,7 @@ public void createInstanceTest2() throws Exception {
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.setNodeCount(1539922066)
.setProcessingUnits(-329117885)
.putAllLabels(new HashMap<String, String>())
.addAllEndpointUris(new ArrayList<String>())
.build();
Expand Down Expand Up @@ -574,6 +578,7 @@ public void updateInstanceTest() throws Exception {
.setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.setNodeCount(1539922066)
.setProcessingUnits(-329117885)
.putAllLabels(new HashMap<String, String>())
.addAllEndpointUris(new ArrayList<String>())
.build();
Expand Down
Expand Up @@ -131,6 +131,11 @@ private Instance(
endpointUris_.add(s);
break;
}
case 72:
{
processingUnits_ = input.readInt32();
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
Expand Down Expand Up @@ -525,6 +530,26 @@ public int getNodeCount() {
return nodeCount_;
}

public static final int PROCESSING_UNITS_FIELD_NUMBER = 9;
private int processingUnits_;
/**
*
*
* <pre>
* The number of processing units allocated to this instance. At most one of
* processing_units or node_count should be present in the message. This may
* be zero in API responses for instances that are not yet in state `READY`.
* </pre>
*
* <code>int32 processing_units = 9;</code>
*
* @return The processingUnits.
*/
@java.lang.Override
public int getProcessingUnits() {
return processingUnits_;
}

public static final int STATE_FIELD_NUMBER = 6;
private int state_;
/**
Expand Down Expand Up @@ -837,6 +862,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
for (int i = 0; i < endpointUris_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 8, endpointUris_.getRaw(i));
}
if (processingUnits_ != 0) {
output.writeInt32(9, processingUnits_);
}
unknownFields.writeTo(output);
}

Expand Down Expand Up @@ -880,6 +908,9 @@ public int getSerializedSize() {
size += dataSize;
size += 1 * getEndpointUrisList().size();
}
if (processingUnits_ != 0) {
size += com.google.protobuf.CodedOutputStream.computeInt32Size(9, processingUnits_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -900,6 +931,7 @@ public boolean equals(final java.lang.Object obj) {
if (!getConfig().equals(other.getConfig())) return false;
if (!getDisplayName().equals(other.getDisplayName())) return false;
if (getNodeCount() != other.getNodeCount()) return false;
if (getProcessingUnits() != other.getProcessingUnits()) return false;
if (state_ != other.state_) return false;
if (!internalGetLabels().equals(other.internalGetLabels())) return false;
if (!getEndpointUrisList().equals(other.getEndpointUrisList())) return false;
Expand All @@ -922,6 +954,8 @@ public int hashCode() {
hash = (53 * hash) + getDisplayName().hashCode();
hash = (37 * hash) + NODE_COUNT_FIELD_NUMBER;
hash = (53 * hash) + getNodeCount();
hash = (37 * hash) + PROCESSING_UNITS_FIELD_NUMBER;
hash = (53 * hash) + getProcessingUnits();
hash = (37 * hash) + STATE_FIELD_NUMBER;
hash = (53 * hash) + state_;
if (!internalGetLabels().getMap().isEmpty()) {
Expand Down Expand Up @@ -1105,6 +1139,8 @@ public Builder clear() {

nodeCount_ = 0;

processingUnits_ = 0;

state_ = 0;

internalGetMutableLabels().clear();
Expand Down Expand Up @@ -1142,6 +1178,7 @@ public com.google.spanner.admin.instance.v1.Instance buildPartial() {
result.config_ = config_;
result.displayName_ = displayName_;
result.nodeCount_ = nodeCount_;
result.processingUnits_ = processingUnits_;
result.state_ = state_;
result.labels_ = internalGetLabels();
result.labels_.makeImmutable();
Expand Down Expand Up @@ -1214,6 +1251,9 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.Instance other) {
if (other.getNodeCount() != 0) {
setNodeCount(other.getNodeCount());
}
if (other.getProcessingUnits() != 0) {
setProcessingUnits(other.getProcessingUnits());
}
if (other.state_ != 0) {
setStateValue(other.getStateValue());
}
Expand Down Expand Up @@ -1676,6 +1716,64 @@ public Builder clearNodeCount() {
return this;
}

private int processingUnits_;
/**
*
*
* <pre>
* The number of processing units allocated to this instance. At most one of
* processing_units or node_count should be present in the message. This may
* be zero in API responses for instances that are not yet in state `READY`.
* </pre>
*
* <code>int32 processing_units = 9;</code>
*
* @return The processingUnits.
*/
@java.lang.Override
public int getProcessingUnits() {
return processingUnits_;
}
/**
*
*
* <pre>
* The number of processing units allocated to this instance. At most one of
* processing_units or node_count should be present in the message. This may
* be zero in API responses for instances that are not yet in state `READY`.
* </pre>
*
* <code>int32 processing_units = 9;</code>
*
* @param value The processingUnits to set.
* @return This builder for chaining.
*/
public Builder setProcessingUnits(int value) {

processingUnits_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The number of processing units allocated to this instance. At most one of
* processing_units or node_count should be present in the message. This may
* be zero in API responses for instances that are not yet in state `READY`.
* </pre>
*
* <code>int32 processing_units = 9;</code>
*
* @return This builder for chaining.
*/
public Builder clearProcessingUnits() {

processingUnits_ = 0;
onChanged();
return this;
}

private int state_ = 0;
/**
*
Expand Down
Expand Up @@ -129,6 +129,21 @@ public interface InstanceOrBuilder
*/
int getNodeCount();

/**
*
*
* <pre>
* The number of processing units allocated to this instance. At most one of
* processing_units or node_count should be present in the message. This may
* be zero in API responses for instances that are not yet in state `READY`.
* </pre>
*
* <code>int32 processing_units = 9;</code>
*
* @return The processingUnits.
*/
int getProcessingUnits();

/**
*
*
Expand Down

0 comments on commit e3c7e8f

Please sign in to comment.