Skip to content
Permalink
Browse files
feat(spanner): add leader_options to InstanceConfig and default_leade…
…r to Database (#1271)

* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* feat(spanner): add leader_options to InstanceConfig and default_leader to Database

PiperOrigin-RevId: 382409094

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jun 30 16:30:14 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 2c6e4dd22260e34403b468cc6d19aa43a9c684ed
Source-Link: googleapis/googleapis@2c6e4dd
  • Loading branch information
yoshi-automation committed Jul 5, 2021
1 parent 224cc7f commit f25767144344f0df67662f1b3ef662902384599a
@@ -223,6 +223,7 @@ public void createDatabaseTest() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -278,6 +279,7 @@ public void createDatabaseTest2() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -333,6 +335,7 @@ public void getDatabaseTest() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
mockDatabaseAdmin.addResponse(expectedResponse);

@@ -377,6 +380,7 @@ public void getDatabaseTest2() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
mockDatabaseAdmin.addResponse(expectedResponse);

@@ -1307,6 +1311,7 @@ public void restoreDatabaseTest() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1365,6 +1370,7 @@ public void restoreDatabaseTest2() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1423,6 +1429,7 @@ public void restoreDatabaseTest3() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1481,6 +1488,7 @@ public void restoreDatabaseTest4() throws Exception {
.addAllEncryptionInfo(new ArrayList<EncryptionInfo>())
.setVersionRetentionPeriod("versionRetentionPeriod-629783929")
.setEarliestVersionTime(Timestamp.newBuilder().build())
.setDefaultLeader("defaultLeader759009962")
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -205,6 +205,7 @@ public void getInstanceConfigTest() throws Exception {
.setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.addAllReplicas(new ArrayList<ReplicaInfo>())
.addAllLeaderOptions(new ArrayList<String>())
.build();
mockInstanceAdmin.addResponse(expectedResponse);

@@ -245,6 +246,7 @@ public void getInstanceConfigTest2() throws Exception {
.setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
.setDisplayName("displayName1714148973")
.addAllReplicas(new ArrayList<ReplicaInfo>())
.addAllLeaderOptions(new ArrayList<String>())
.build();
mockInstanceAdmin.addResponse(expectedResponse);

@@ -42,6 +42,7 @@ private Database() {
state_ = 0;
encryptionInfo_ = java.util.Collections.emptyList();
versionRetentionPeriod_ = "";
defaultLeader_ = "";
}

@java.lang.Override
@@ -171,6 +172,13 @@ private Database(
extensionRegistry));
break;
}
case 74:
{
java.lang.String s = input.readStringRequireUtf8();

defaultLeader_ = s;
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
@@ -904,6 +912,63 @@ public com.google.protobuf.TimestampOrBuilder getEarliestVersionTimeOrBuilder()
return getEarliestVersionTime();
}

public static final int DEFAULT_LEADER_FIELD_NUMBER = 9;
private volatile java.lang.Object defaultLeader_;
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @return The defaultLeader.
*/
@java.lang.Override
public java.lang.String getDefaultLeader() {
java.lang.Object ref = defaultLeader_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
defaultLeader_ = s;
return s;
}
}
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @return The bytes for defaultLeader.
*/
@java.lang.Override
public com.google.protobuf.ByteString getDefaultLeaderBytes() {
java.lang.Object ref = defaultLeader_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
defaultLeader_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
@@ -943,6 +1008,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
for (int i = 0; i < encryptionInfo_.size(); i++) {
output.writeMessage(8, encryptionInfo_.get(i));
}
if (!getDefaultLeaderBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 9, defaultLeader_);
}
unknownFields.writeTo(output);
}

@@ -977,6 +1045,9 @@ public int getSerializedSize() {
for (int i = 0; i < encryptionInfo_.size(); i++) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, encryptionInfo_.get(i));
}
if (!getDefaultLeaderBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, defaultLeader_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
@@ -1013,6 +1084,7 @@ public boolean equals(final java.lang.Object obj) {
if (hasEarliestVersionTime()) {
if (!getEarliestVersionTime().equals(other.getEarliestVersionTime())) return false;
}
if (!getDefaultLeader().equals(other.getDefaultLeader())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@@ -1050,6 +1122,8 @@ public int hashCode() {
hash = (37 * hash) + EARLIEST_VERSION_TIME_FIELD_NUMBER;
hash = (53 * hash) + getEarliestVersionTime().hashCode();
}
hash = (37 * hash) + DEFAULT_LEADER_FIELD_NUMBER;
hash = (53 * hash) + getDefaultLeader().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
@@ -1233,6 +1307,8 @@ public Builder clear() {
earliestVersionTime_ = null;
earliestVersionTimeBuilder_ = null;
}
defaultLeader_ = "";

return this;
}

@@ -1293,6 +1369,7 @@ public com.google.spanner.admin.database.v1.Database buildPartial() {
} else {
result.earliestVersionTime_ = earliestVersionTimeBuilder_.build();
}
result.defaultLeader_ = defaultLeader_;
onBuilt();
return result;
}
@@ -1392,6 +1469,10 @@ public Builder mergeFrom(com.google.spanner.admin.database.v1.Database other) {
if (other.hasEarliestVersionTime()) {
mergeEarliestVersionTime(other.getEarliestVersionTime());
}
if (!other.getDefaultLeader().isEmpty()) {
defaultLeader_ = other.defaultLeader_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
@@ -3177,6 +3258,132 @@ public com.google.protobuf.TimestampOrBuilder getEarliestVersionTimeOrBuilder()
return earliestVersionTimeBuilder_;
}

private java.lang.Object defaultLeader_ = "";
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @return The defaultLeader.
*/
public java.lang.String getDefaultLeader() {
java.lang.Object ref = defaultLeader_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
defaultLeader_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @return The bytes for defaultLeader.
*/
public com.google.protobuf.ByteString getDefaultLeaderBytes() {
java.lang.Object ref = defaultLeader_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
defaultLeader_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @param value The defaultLeader to set.
* @return This builder for chaining.
*/
public Builder setDefaultLeader(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}

defaultLeader_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @return This builder for chaining.
*/
public Builder clearDefaultLeader() {

defaultLeader_ = getDefaultInstance().getDefaultLeader();
onChanged();
return this;
}
/**
*
*
* <pre>
* Output only. The read-write region which contains the database's leader
* replicas.
* This is the same as the value of default_leader
* database option set using DatabaseAdmin.CreateDatabase or
* DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
* </pre>
*
* <code>string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*
* @param value The bytes for defaultLeader to set.
* @return This builder for chaining.
*/
public Builder setDefaultLeaderBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);

defaultLeader_ = value;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);

0 comments on commit f257671

Please sign in to comment.