@java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(2, getCreateTime());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeMessage(3, getUpdateTime());
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4);
    if (state_
        != com.google.cloud.memorystore.v1beta.Instance.State.STATE_UNSPECIFIED.getNumber()) {
      output.writeEnum(5, state_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      output.writeMessage(6, getStateInfo());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 7, uid_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      output.writeInt32(8, replicaCount_);
    }
    if (authorizationMode_
        != com.google.cloud.memorystore.v1beta.Instance.AuthorizationMode
            .AUTHORIZATION_MODE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(9, authorizationMode_);
    }
    if (transitEncryptionMode_
        != com.google.cloud.memorystore.v1beta.Instance.TransitEncryptionMode
            .TRANSIT_ENCRYPTION_MODE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(10, transitEncryptionMode_);
    }
    if (shardCount_ != 0) {
      output.writeInt32(11, shardCount_);
    }
    for (int i = 0; i < discoveryEndpoints_.size(); i++) {
      output.writeMessage(12, discoveryEndpoints_.get(i));
    }
    if (nodeType_
        != com.google.cloud.memorystore.v1beta.Instance.NodeType.NODE_TYPE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(13, nodeType_);
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      output.writeMessage(14, getPersistenceConfig());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(engineVersion_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 15, engineVersion_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetEngineConfigs(), EngineConfigsDefaultEntryHolder.defaultEntry, 16);
    if (((bitField0_ & 0x00000020) != 0)) {
      output.writeMessage(17, getNodeConfig());
    }
    if (((bitField0_ & 0x00000040) != 0)) {
      output.writeMessage(18, getZoneDistributionConfig());
    }
    if (((bitField0_ & 0x00000080) != 0)) {
      output.writeBool(19, deletionProtectionEnabled_);
    }
    for (int i = 0; i < pscAutoConnections_.size(); i++) {
      output.writeMessage(20, pscAutoConnections_.get(i));
    }
    for (int i = 0; i < endpoints_.size(); i++) {
      output.writeMessage(25, endpoints_.get(i));
    }
    if (mode_ != com.google.cloud.memorystore.v1beta.Instance.Mode.MODE_UNSPECIFIED.getNumber()) {
      output.writeEnum(26, mode_);
    }
    getUnknownFields().writeTo(output);
  }
<pre>
Optional. The mode config for the instance.
</pre>

<code>
.google.cloud.memorystore.v1beta.Instance.Mode mode = 26 [(.google.api.field_behavior) = OPTIONAL];
</code>

@return The mode.
java-valkey/proto-google-cloud-valkey-v1beta/src/main/java/com/google/cloud/memorystore/v1beta/Instance.java